speech_tools/Makefile0000644000076400007640000001232411461347213013325 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996-2010 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Top level Makefile for Edinburgh Speech tools library ## ## Authors: Paul Taylor, Simon King, Alan W Black, Richard Caley ## ## and others (see ACKNOWLEDGEMENTS) ## ## Version: 2.1 beta November 2010 ## ## ## ########################################################################### TOP=. DIRNAME=. LIB_BUILD_DIRS = audio utils base_class ling_class speech_class sigpr \ stats grammar intonation # Development directories are those that contain non-stable code #DEV_DIRS = $(shell if [ -f DEV_DIRS ]; then cat DEV_DIRS; fi ) BUILD_DIRS = $(LIB_BUILD_DIRS) lib main scripts testsuite bin TEMPLATE_DIRS=include audio utils base_class base_class/string \ ling_class speech_class sigpr stats grammar siod EXTRA_DIRS=siod java rxp wrappers ALL_DIRS = include $(BUILD_DIRS) $(EXTRA_DIRS) config doc VERSION=$(PROJECT_VERSION) CONFIG=configure configure.in config.sub config.guess \ missing install-sh mkinstalldirs FILES=Makefile README INSTALL $(CONFIG) LOCAL_CLEAN= Build.trace Test.trace Templates.DB ALL = .config_error .sub_directories # Try and say if config hasn't been created config_dummy := $(shell test -f config/config || ( echo '*** '; echo '*** Making default config file ***'; echo '*** '; ./configure; ) >&2) # force a check on the system file system_dummy := $(shell $(MAKE) -C $(TOP)/config -f make_system.mak TOP=.. system.mak) include $(TOP)/config/common_make_rules dist: backup backup: time-stamp @ $(MAKE) file-list @ sed 's/^\.\///' FileList.all @ (cd ..; tar cvf - `cat speech_tools/FileList.all` speech_tools/.time-stamp | gzip > speech_tools/speech_tools-$(VERSION)-$(PROJECT_STATE).tar.gz) @ $(RM) -f $(TOP)/FileList.all @ ls -l speech_tools-$(VERSION)-$(PROJECT_STATE).tar.gz time-stamp : @ echo speech_tools $(VERSION) >.time-stamp @ date >>.time-stamp minrev: backup @mv speech_tools-$(VERSION).tar.gz speech_tools-$(VERSION).`date +%y%m%d`.tar.gz tags: @ $(RM) -f FileList @ $(MAKE) --no-print-directory FileList @ etags `grep ".[ch]c*$$" FileList` test: make_library @ $(MAKE) --no-print-directory -C testsuite test rebuild_and_test: $(MAKE) -k clean $(MAKE) -k depend $(MAKE) -k all >Build.trace 2>&1 $(MAKE) -k test >Test.trace 2>&1 @if egrep 'FAILED|INCORRECT' Test.trace ;\ then \ echo test failed ;\ exit 1 ;\ fi @if cat Build.trace Test.trace | egrep 'warning:' ;\ then \ echo warnings found ;\ exit 2 ;\ fi config/config: config/config.in config.status ./config.status configure: configure.in autoconf include $(TOP)/config/rules/top_level.mak include $(TOP)/config/rules/install.mak speech_tools/README0000644000076400007640000002173611461354114012552 0ustar awbawb EDINBURGH SPEECH TOOLS LIBRARY VERSION 2.1 November 2010 Principal authors: Alan W Black, Paul Taylor, Richard Caley, Simon King, Rob Clark and Korin Richmond Centre for Speech Technology University of Edinburgh 2 Buccleuch Place Edinburgh EH8 9LW, UK http://www.cstr.ed.ac.uk/projects/speech_tools Although this is a considered stable release, there are still a number of known parts are missing or incomplete. ------------------------------------------------------------------------ The Edinburgh speech tools system is a library of C++ classes, functions and utility programs that are frequently used in speech software. The system compiles to a single unix library .a file which can be linked with software. At present, C++ classes for several useful speech and language classes have been written, along with audio software and some basic signal processing software. ======================================================================== Edinburgh Speech Tools Library version 2.1 Centre for Speech Technology Research University of Edinburgh, UK Copyright (c) 1994-2010 All Rights Reserved. Permission is hereby granted, free of charge, to use and distribute this software and its documentation without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this work, and to permit persons to whom this work is furnished to do so, subject to the following conditions: 1. The code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Any modifications must be clearly marked as such. 3. Original authors' names are not deleted. 4. The authors' names are not used to endorse or promote products derived from this software without specific prior written permission. THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ======================================================================== The following c++ programs are available: na_play: generic playback program for use with net_audio and CSTR ao. ch_wave: Waveform file conversion program. ch_lab: label file conversion program. ch_track: Track file conversion program. wagon: a CART tree build and test program And others The following C++ sub-libraries are available audio: C++ audio functions for Network Audio system, Suns Linux and FreeBSD speech_class: C++ speech classes, including waveform and track. ling_class: C++ linguistic classes. sigpr: Signal processing utils: Various utilities. COPYING ------------------------------------------------------------------------ Some files in the distribution do not fall under the above copyright. However none have any commercial restrictions, and no files fall under the GPL. Specifically files that have different licences are as follows: grammar/wfst/wfst_train.cc Copyright Carnegie Mellon University (under the same open licences as much of the rest of the code. siod/ include/siod*.h lib/siod/siod.scm Apart from some new functionality under our licence the SIOD files fall under the licence given in siod/slib.cc copyright Paradigm Associates. This code has been substantially modified by us though our changes are under that licence. editline.c editline.h el_complete.c el_sysunix.c el_unix.h are copyright 1992 Simmule Turner and Rich Salz under the "BSD like" licence in siod/editline.c Again substantial changes have been made by us which continue to be under that licence rxp/ include/rxp/ Is Copyright Richard Tobin. We have a specific version of RXP which allows free (including non-commercial) use. base_class/raveconv.cc Is copyright 1992, 1995 by Markus Mummert base_class/string/reg*.{c,cc} Copyright (c) 1986 by University of Toronto. base_class/string/EST_strcasecmp.c Copyright (c) 1987, 1993 The Regents of the University of California. All rights reserved. The standard BSD licence ACKNOWLEDGEMENTS ------------------------------------------------------------------------ Most of the software was written by Paul Taylor, Alan W Black, Simon King, Richard Caley, Rob Clark and Korin Richmond. Additional contributions have been made by the following people. Slightly different licence agreements accompany these pieces of code, so it is important that the various agreements be properly understood. Tony Robinson: some signal processing code. Markus Mummert: sample rate converter (rateconv.cc). Craig Reese and Joe Campbell: ulaw conversion code. Paul Bagshaw: pitch tracker. Theo Veenker: IRIX audio support. Stan Chen: AIX support Paradigm Assoc. and George Carrett: For Scheme In One Defun Simmule Turner and Rich Salz: for editline Henry Spencer: for regex code The Regents of the University of California: some string comparison code Richard Tobin: RXP, XML parser. Arthur Toth: Windows server code INSTALLATION ************ see INSTALL file for details FILE/DIRECTORY STRUCTURE ------------------------------------------------------------------------ The main directory contains minimal wrap-around main() functions which compile to form executables which use the algorithms in the speech tools. All these main() functions really do is to read command line options and read and write files, the algorithms themselves are completely contained within the libraries. The directory structure is as follows: config: shared make rules and configuration make rules speech_class: general speech class files, including waveforms, contours etc. ling_class: general linguistic class files, including a stream-based architecture. sigpr: signal processing code. doc: basic documentation, generates html, info and postscript include: class and general header files. lib: where the .a files are kept main: Directory containing main files which compile to executables. DOCUMENTATION ------------------------------------------------------------------------ There are two sources of documentation. Man pages exist for the more important stand-alone programs. These are found in the main directory. The library documentation has substantiall improved in this version using an integrated DOC++, JADE and docbook combination. Classes are described at the overview, theorectical, practical and code level. The build process for the documentation is still dependent on some more obscure packages so it is recommended that you take the pre-built documentation. Or access it on-line through http://www.cstr.ed.ac.uk/projects/speech_tools The library documentation is in texinfo format which can be converted into GNU info HTML and postscript, see Makefile in doc/ Note the documentation is not up to date. We are in the process of moving the documentation to Doxygen. BUGS/COMMENTS ETC ------------------------------------------------------------------------ Substantial parts of this release are considered mature and should be relatively free of bugs, however there are newer parts which have not been rigourously tested yet. If you find any bugs, please send a bug report to speechtools@cstr.ed.ac.uk. Any useful comments will also be appreciated. See also the bugs file in the doc directory. If you have some software that you think could be integrated into the speechtools system, please contact us at speechtools@cstr.ed.ac.uk. The whole point of writing and releasing code such as this is to prevent duplication of effort, and therefore we would appreciate greatly any code which will add to the usefulness of the system. Signal processing routines are particularly welcome. ====================================================================== ADDITIONAL SOFTWARE ====================================================================== CSTR supplies a number of different speech technology systems including speech synthesis systems and (in the future) a recognition system. To find out more information checkout http://www.cstr.ed.ac.uk/ speech_tools/INSTALL0000644000076400007640000002527611461104305012721 0ustar awbawbINSTALLATION Release notes This documentation covers version 2.1 of the Edinburgh Speech Tools Library. While previous versions of the speech tools were primarily released solely to support the Festival Speech Synthesis System, the Edinburgh Speech Tools Library now contains sufficiently useful tools that it is of use in its own right. Although hope that the speech tools has stabilised to a certain extent and less structural changes will occur in future versions we don't guaranteed future compatibility, although every effort will be made to make upgrading as easy as possible. In addition, we warn that while several programs and routines are quite mature, others are young and have not be rigorously tested. Please do not assume these programs work. Requirements In order to compile and install the Edinburgh Speech Tools you need the following GNU make Any recent version, the various make programs that come with different UNIX systems are wildly varying and hence it makes it too difficult to write Makefiles which are portable, so we depend on a version of make which is available for all of the platforms we are aiming at. A C++ compiler The system was developed primarily with GNU C++ (various versions from version 2.7.2), but we also have compiled it successfully with a number of other versions of gcc, and Visual C++. Hopefully we have now sanitized the code sufficiently to to make it possible for ports to other C++ compilers without too much difficulty. But please note C++ is not a fully standardized language and each compiler follows the incomplete standard to various degrees. Often there are many but simple problems when porting to new C++ compilers. We are trying to deal with this by increasing our support. However, it is likely that small changes will be required for C++ compilers we have not yet tested the system under. However we feel this is stable enough to make it worthwhile attempting ports to other C++ compilers that we haven't tried yet. Before installing the speech tools it is worth ensuring you have a fully installed and working version of your C++ compiler. Most of the problems people have had in installing the speech tools have been due to incomplete or bad compiler installation. It might be worth checking if the following program works, if you don't know if anyone has used your C++ installation before. #include int main (int argc, char **argv) { cout << "Hello world\n"; } Supported Systems We have successfully compiled and tested the speech tools on the following systems, except where specified we include support for both shared and static versions of the libraries: Sun Sparc Solaris 2.5.1/2.6/2.7/2.9 GCC 2.7.2, GCC 2.8.1, gcc-2.95.3, gcc-3.2 gcc-3.3 MacOS GCC 4.2.1 (Snow Leopard default) Linux GCC 4.2 - 4.5 Windows 7 GCC (from Cygwin 1.7), Visual C++ (VS2010). As stated before C++ compilers are not standard and it is non-trivial to find the correct dialect which compiles under all. We recommend the use of GCC 4.4 if you can use it, it is the most likely one to work. Some of the compilers listed above produce a large number of warnings when compiling the code. Previous versions of the system have successfully compiled under SGI IRIX 5.3, 6.x, OSF (Alphas) and HPUX but at time of writing this we have not yet rechecked this version. AIX4.3 probably works. Java Support The java directory contains optional Java classes which give some access to speech tools facilities from Java programs. This has been created to support the fringe graphical interface. There are three levels of support enabled by the JAVA JAVA_MEDIA and JAVA_CPP options in the config file. JAVA compiles some very basic classes intended to allow very simple simulation of speech tools facilities in pure Java programs. JAVA_MEDIA is similar but uses the Jva Media Framework to play sound. JAVA_CPP compiles classes which use the Java native interface to provide access to the actual speech tools C++ classes. You may (for instance on Solaris using gcc) need to make shared libraries for some compiler support libraries in order to comple the full JAVA_CPP support. See Appendix A for details. Windows 95/98/NT/XP/Vista/7 Port We have done two ports of this code to Windows machines, one uses the Cygwin package, which provides a Unix like environment under on Win32 systems, the other is a native port using Visual C++. We reccomend using only Windows 7. The port using Visual C++ does not provide all of the features of the Unix and Cygwin versions. You will need access to a Unix or Cygwin system to create the makefiles used for the Visual C++ compilation. Both Cygwin and Visual C++ ports have a number of limitations. Shared library creation is not supported. Creation of Windows DLLs is different enough from creation of Unix shared libraries that the support does not carry directly accross, and we haven't yet had time to work on it. Java not supported Because the Java support is related to the creation of shared libraries, this is also not yet implemented for Windows. Command line editing limited Because of the limits of the Windows DOS console window, the command line editing in siod is less reliable (for instance on very long lines). (Visual C++) Networking not supported Networking under Win32 is different from Unix in a number of fairly fundamental ways, we haven't tackled this at all. There are no doubt other differences we hve not noticed. We don't use Windows for any of our work and so the Windows builds of our systems don't get the extensive use the unix builds do. BUILDING IT Configuration All compile-time configuration for the system is done through GNU configure. On most systems you can configure the system by unix$ ./configure This creates the file config/config which for most machines will be suitble. In some circumstances the default.s generated from this may not be what you want and you may wish to edit this file. For Linux we now fully support shared libraries and even recommend them. However if you are going to do alot of development and don't understand the consequences of shared libraries and getting LD_LIBRARY_PATH correct (or what that is) we recommend you compile unshared, the default. If you are going to simply run the speech tools (and festival) then shared is a reasonable option. Uncomment the line in the config file # SHARED = 1 Shared support under Solaris is complete for all the speech tools. If you need to exec festival scripts using a version of festival built with shared libaries, you must either execute them from a featureful shell (e.g. bash), install the shared libraries in a standard place or explicitly set LD_LIBRARY_PATH. Solaris's standard shell doesn't support script excutaiton of shells within shells. Simple choices for common set ups are given near the top of this file. But for some sub-systems you will also need to change pathnames for external library support. Compilation Once you have configured config/config you can compile the system. unix$ gmake Note this must be GNU make, which may be called make on your system, or gmake or gnumake. This will compile all library functions and all the executables. If you wish to only compile the library itself then use unix$ gmake make_library Note that if you compile with -g (uncommenting DEBUG = 1 is config/config the library and the corresponding binaries will be large. Particulary the executables, you will need in order of 150 megabytes to compile the system, if your C++ libraries are not compiled as shared libraries. If you compile without -g the whole library directory is about 12 megabytes on Linux (which has shared libraries for libstdc++ or about 26 megabytes of Sparc Solaris (which does not have a shared library libstdc++ by default). This is almost entirely due to the size of the executables. C++ does not make small binaries. In general we have made the system compile with no warnings. However for some compilers this has proved to be near impossible. SunOS include files have a number of system declarations missing, so many system functions (e.g. fprintf) will appear to be undeclared. Sun's CC compiler also likes to complain about missing source for some code even though the code exists within our system and is deliberately in separate files ro make it modular. To test the system after compilation unix$ gmake test Installing the system All executables are linked to from speech_tools/bin and you should add that to your PATH in order to use them. Include files are speech_tools/include/ and the three generated libraries are speech_tools/lib/libestools.a, speech_tools/lib/libestbase.a and speech_tools/lib/libestring.a. For most cases a three will be required. If space is a preminium, compiled with the shared option (binaries will be then be substantially smaller) and you can delete all .o files Some aspects of the system have further dependencies which depend of the option selected at compile time. Specifically the readline libraries and Netaudio libraries. These are uptodate instructions for Visual C++ builds. VS2010 was tested but older versions may work Requirements: MS Windows 7 Visual C++ (VS2010) cygwin 1.7 speech_tools-2.1 festival-2.1 Download and install cygwin. Optionally download emacs so you have a decent editor :) Download speech_tools and festival tar.gz files. Download required festival lexicons and voices. Using cygwins bash shell: mkdir C:/festival cd C:/festival Using cygwin's tar command unpack: tar xvfz speech_tools-2.1.tar.gz tar xvfz festival-2.1.tar.gz tar xvfz festlex... festvox... (where festlex... and festvox... are the voice and lexicon files you need. Do not use winzip to unpack the voices it corrupts them!) Create Vsual C++ make files: (this may be slow...) cd speech_tools make VCMakefile cp config/vc_config_make_rules-dist config/vc_config_make_rules cd ../festival make VCMakefile cp config/vc_config_make_rules-dist config/vc_config_make_rules Finally make festival init_modules code. (If you add new modules you either need to edit init_modules.cc by hand or rerun this step.) make -C src/modules init_modules.cc edit config/vc_config_make_rules and change: SYSTEM_LIB=c:\\festival\\lib to: SYSTEM_LIB=c:\\festival\\festival\\lib (or to wherever you unpacked festival) Now switch to a windows command prompt. If necessary execute: VCVARSALL.BAT from the VC++ directory structure to set up VC++ environment. (you may do this automatically at boot or login.) Build speech_tools and festival: cd c:\festival\speech_tools nmake /nologo /FVCMakefile cd ..\festival nmake /nologo /FVCMakefile At this point you should be able to run festival by typing: src\main\festival speech_tools/configure0000755000076400007640000042617611134123320013576 0ustar awbawb#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="include/EST.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB AR CPP GREP EGREP TERMCAPLIB COMPILERTYPE LINUXAUDIO LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { echo "$as_me:$LINENO: checking for tputs in -lncurses" >&5 echo $ECHO_N "checking for tputs in -lncurses... $ECHO_C" >&6; } if test "${ac_cv_lib_ncurses_tputs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ncurses_tputs=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_tputs=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tputs" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_tputs" >&6; } if test $ac_cv_lib_ncurses_tputs = yes; then TERMCAPLIB=-lncurses else TERMCAPLIB=-lcurses fi COMPILERTYPE=gcc cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 95 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then COMPILERTYPE=gcc295 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if __GNUC__ == 3 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then COMPILERTYPE=gcc32 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 96 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then COMPILERTYPE=gcc296 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 91 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then COMPILERTYPE=egcs else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 8 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then COMPILERTYPE=gcc28 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext LINUXAUDIO=none cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int j= #if SND_LIB_SUBMINOR >= 14 3; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then LINUXAUDIO="alsa" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_config_files="$ac_config_files config/config" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config/config") CONFIG_FILES="$CONFIG_FILES config/config" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim RANLIB!$RANLIB$ac_delim AR!$AR$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim TERMCAPLIB!$TERMCAPLIB$ac_delim COMPILERTYPE!$COMPILERTYPE$ac_delim LINUXAUDIO!$LINUXAUDIO$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi speech_tools/configure.in0000644000076400007640000001006311141445247014175 0ustar awbawbdnl######################################################################## dnl ## dnl Centre for Speech Technology Research ## dnl University of Edinburgh, UK ## dnl Copyright (c) 1996-2001 ## dnl All Rights Reserved. ## dnl ## dnl Permission is hereby granted, free of charge, to use and distribute ## dnl this software and its documentation without restriction, including ## dnl without limitation the rights to use, copy, modify, merge, publish, ## dnl distribute, sublicense, and/or sell copies of this work, and to ## dnl permit persons to whom this work is furnished to do so, subject to ## dnl the following conditions: ## dnl 1. The code must retain the above copyright notice, this list of ## dnl conditions and the following disclaimer. ## dnl 2. Any modifications must be clearly marked as such. ## dnl 3. Original authors' names are not deleted. ## dnl 4. The authors' names are not used to endorse or promote products ## dnl derived from this software without specific prior written ## dnl permission. ## dnl ## dnl THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## dnl DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## dnl ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## dnl SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## dnl ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## dnl THIS SOFTWARE. ## dnl ## dnl######################################################################## AC_INIT(include/EST.h) AC_CANONICAL_SYSTEM AC_PROG_CC if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi AC_PROG_RANLIB AC_CHECK_TOOL(AR, ar) AC_C_BIGENDIAN AC_CHECK_LIB(ncurses, tputs, [TERMCAPLIB=-lncurses], [TERMCAPLIB=-lcurses]) dnl if test "$TERMCAPLIB" != "-ltermcap"; then dnl AC_CHECK_LIB(termcap, tputs, [TERMCAPLIB=-ltermcap], [TERMCAPLIB=-lncurses]) dnl AC_SUBST(TERMCAPLIB) dnl Which version of GCC do we have here COMPILERTYPE=gcc AC_TRY_COMPILE([#include ], [int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 95 3; #endif ], [COMPILERTYPE=gcc295]) AC_TRY_COMPILE([#include ], [int j= #if __GNUC__ == 3 3; #endif ], [COMPILERTYPE=gcc32]) AC_TRY_COMPILE([#include ], [ int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 96 3; #endif ], [COMPILERTYPE=gcc296]) AC_TRY_COMPILE([#include ], [int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 91 3; #endif ], [COMPILERTYPE=egcs]) AC_TRY_COMPILE([#include ], [int j= #if __GNUC__ == 2 && __GNUC_MINOR__ == 8 3; #endif ], [COMPILERTYPE=gcc28]) AC_SUBST(COMPILERTYPE) LINUXAUDIO=none AC_TRY_COMPILE([#include ], [int j= #if SND_LIB_SUBMINOR >= 11 3; #endif], [LINUXAUDIO="alsa"]) AC_SUBST(LINUXAUDIO) AC_OUTPUT(config/config) speech_tools/config.sub0000755000076400007640000007070107431110275013651 0ustar awbawb#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-02-01' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ | mipsisa32 \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* | -morphos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: speech_tools/config.guess0000755000076400007640000011321007456666477014232 0ustar awbawb#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-01-30' # This file 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-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p) 2>/dev/null` || \ UNAME_MACHINE_ARCH=unknown case "${UNAME_MACHINE_ARCH}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i386-pc-interix3 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Export LANG=C to prevent ld from outputting information in other # languages. ld_supported_targets=`LANG=C; export LANG; cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc echo i386-${UNAME_MACHINE}-nto-qnx else echo `uname -p`-${UNAME_MACHINE}-nto-qnx fi exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: speech_tools/missing0000755000076400007640000001421307262616577013303 0ustar awbawb#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # 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, 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-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 speech_tools/install-sh0000755000076400007640000001273607262616577013720 0ustar awbawb#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 speech_tools/mkinstalldirs0000755000076400007640000000132107262616577014506 0ustar awbawb#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1 2001/04/04 13:11:27 awb Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here speech_tools/include/Makefile0000644000076400007640000001045610523415477014762 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Include Directory Makefile ## ########################################################################### TOP=.. DIRNAME=include H = EST_common.h EST_TKVL.h EST_Option.h EST_TList.h \ EST_UList.h EST_TSortable.h \ EST_Token.h EST_StringTrie.h \ EST_TMatrix.h EST_TVector.h EST_TSimpleMatrix.h EST_TSimpleVector.h \ EST_FMatrix.h EST_DMatrix.h EST_types.h EST_cmd_line.h EST.h \ EST_IMatrix.h EST_SMatrix.h \ EST_sigpr.h EST_Event.h EST_tilt.h \ EST_Track.h EST_io_aux.h EST_audio.h \ EST_track_aux.h EST_cluster.h EST_multistats.h EST_PST.h\ EST_cutils.h EST_walloc.h EST_math.h EST_Regex.h \ EST_String.h EST_string_aux.h EST_wave_aux.h EST_Chunk.h \ EST_Ngrammar.h EST_sort.h \ EST_rw_status.h EST_Wave.h EST_SingleChannelWave.h EST_TNamedEnum.h EST_grammar.h \ EST_util_class.h EST_speech_class.h EST_ling_class.h EST_stats.h \ EST_simplestats.h EST_Pathname.h EST_viterbi.h \ EST_lattice_io.h EST_lattice.h EST_HMM.h EST_bool.h \ EST_THash.h EST_TrackMap.h EST_ChannelType.h \ EST_cmd_line_options.h EST_strcasecmp.h EST_error.h \ EST_TBuffer.h EST_Wagon.h EST_Val.h EST_Val_defs.h \ EST_system.h EST_unix.h EST_socket.h EST_iostream.h \ siod.h siod_defs.h siod_est.h \ EST_SCFG.h EST_SCFG_Chart.h EST_WFST.h EST_Complex.h \ EST_inline_utils.h EST_Contents.h EST_FileType.h \ EST_Features.h EST_features_aux.h EST_Featured.h EST_TTimeIndex.h \ EST_THandle.h EST_Handleable.h EST_TBox.h \ EST_TIterator.h EST_kalman.h EST_TDeque.h \ EST_model_types.h EST_dynamic_model.h EST_FeatureData.h \ EST_ServiceTable.h EST_Server.h EST_FringeServer.h DEVELOPMENT_DIRS = # development ALL_DIRS = unix win32 sigpr ling_class instantiate rxp $(DEVELOPMENT_DIRS) FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/ cp -p *.h $(INCDIR)/EST/ speech_tools/include/EST_common.h0000644000076400007640000000646110127000720015454 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 1 1997 */ /************************************************************************/ /* */ /* A place for things to be seen by all of the speech tools. */ /* */ /************************************************************************/ #ifndef __EST_COMMON_H__ #define __EST_COMMON_H__ /* all this stuff should be common to C and C++ */ #ifdef __cplusplus extern "C" { #endif /* Nasty, horrible, yeuch, like gag me with an algebra, man! */ #include "EST_bool.h" #ifdef INCLUDE_DMALLOC # ifdef __cplusplus # include # else # include # endif # include #endif #ifdef __cplusplus } #endif #endif speech_tools/include/EST_TKVL.h0000644000076400007640000001767011465017155014770 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : January 1995 */ /*-----------------------------------------------------------------------*/ /* Key/Value list template class */ /* */ /*=======================================================================*/ #ifndef __EST_TKVL_H__ #define __EST_TKVL_H__ #include using namespace std; #include "EST_TList.h" #include "instantiate/EST_TKVLI.h" #include "EST_TIterator.h" class EST_String; /** Templated Key-Value Item. Serves as the items in the list of the EST_TKVL class. */ template class EST_TKVI { public: K k; V v; inline bool operator==(const EST_TKVI &i){ return( (i.k == k) && (i.v == v) ); } friend ostream& operator << (ostream& s, EST_TKVI const &i) { return s << i.k << "\t" << i.v << "\n"; } }; /** Templated Key-Value list. Objects of type EST_TKVL contain lists which are accessed by a key of type {\bf K}, which returns a value of type {\bf V}. */ template class EST_TKVL { private: EST_Litem *find_pair_key(const K &key) const; EST_Litem *find_pair_val(const V &val) const; public: /**@name Constructor functions */ //@{ /// default constructor EST_TKVL() {;} /// copy constructor EST_TKVL(const EST_TKVL &kv); //@} /// default value, returned when there is no such entry. static V *default_val; /// default value, returned when there is no such entry. static K *default_key; /// Linked list of key-val pairs. Don't use /// this as it will be made private in the future EST_TList< EST_TKVI > list; /// number of key value pairs in list const int length() const {return list.length();} /// Return First key value pair in list EST_Litem * head() const {return list.head();}; /// Empty list. void clear(); /**@name Access functions. */ //@{ /// return value according to key (const) const V &val(const K &rkey, bool m=0) const; /// return value according to key (non-const) V &val(const K &rkey, bool m=0); /// return value according to ptr const V &val(EST_Litem *ptr, bool m=0) const; /// return value according to ptr V &val(EST_Litem *ptr, bool m=0); /// value or default const V &val_def(const K &rkey, const V &def) const; /// find key, reference by ptr const K &key(EST_Litem *ptr, int m=1) const; /// find key, reference by ptr K &key(EST_Litem *ptr, int m=1); /// return first matching key, referenced by val const K &key(const V &v, int m=1) const; /** change key-val pair. If no corresponding entry is present, add to end of list. */ int change_val(const K &rkey,const V &rval); /** change key-val pair. If no corresponding entry is present, add to end of list.*/ int change_val(EST_Litem *ptr,const V &rval); // change key-val pair. /// change name of key pair. int change_key(EST_Litem *ptr,const K &rkey); /// add key-val pair to list int add_item(const K &rkey,const V &rval, int no_search = 0); /// remove key and val pair from list int remove_item(const K &rkey, int quiet = 0); //@} /// Returns true if key is present. const int present(const K &rkey) const; /// apply function to each pair void map(void (*func)(K&, V&)); friend ostream& operator << (ostream& s, EST_TKVL const &l) {EST_Litem *p; for (p = l.list.head(); p ; p = p->next()) s << l.list(p).k << "\t" << l.list(p).v << endl; return s; } /// full copy of KV list. EST_TKVL & operator = (const EST_TKVL &kv); /// add kv after existing list. EST_TKVL & operator += (const EST_TKVL &kv); /// make new concatenated list EST_TKVL operator + (const EST_TKVL &kv); // Iteration support protected: struct IPointer { EST_Litem *p; }; void point_to_first(IPointer &ip) const { ip.p = list.head(); } void move_pointer_forwards(IPointer &ip) const { ip.p = ip.p->next(); } bool points_to_something(const IPointer &ip) const { return ip.p != NULL; } EST_TKVI &points_at(const IPointer &ip) { return list(ip.p); } friend class EST_TIterator< EST_TKVL, IPointer, EST_TKVI >; friend class EST_TStructIterator< EST_TKVL, IPointer, EST_TKVI >; friend class EST_TRwIterator< EST_TKVL, IPointer, EST_TKVI >; friend class EST_TRwStructIterator< EST_TKVL, IPointer, EST_TKVI >; public: typedef EST_TKVI Entry; typedef EST_TStructIterator< EST_TKVL, IPointer, Entry> Entries; typedef EST_TRwStructIterator< EST_TKVL, IPointer, Entry> RwEntries; // Iteration support protected: struct IPointer_k { EST_Litem *p; }; void point_to_first(IPointer_k &ip) const { ip.p = list.head(); } void move_pointer_forwards(IPointer_k &ip) const { ip.p = ip.p->next(); } bool points_to_something(const IPointer_k &ip) const { return ip.p != NULL; } K &points_at(const IPointer_k &ip) { return list(ip.p).k; } friend class EST_TIterator< EST_TKVL, IPointer_k, K >; friend class EST_TRwIterator< EST_TKVL, IPointer_k, K >; public: typedef K KeyEntry; typedef EST_TIterator< EST_TKVL, IPointer_k, KeyEntry> KeyEntries; typedef EST_TRwIterator< EST_TKVL, IPointer_k, KeyEntry> KeyRwEntries; }; #endif // __KVL_H__ speech_tools/include/EST_Option.h0000644000076400007640000001303307262605664015455 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : September 1994 */ /*-----------------------------------------------------------------------*/ /* EST_Option Class header file */ /* */ /*=======================================================================*/ #ifndef __EST_OPTION_H__ #define __EST_OPTION_H__ #include "EST_String.h" #include "EST_TKVL.h" #include "EST_rw_status.h" /** Provide a high level interface for String String key value lists. */ class EST_Option: public EST_TKVL { public: /// add prefix to every key void add_prefix(EST_String prefix); /// remove prefix from every key void remove_prefix(EST_String prefix); /** read keyval list from file. The file type is an ascii file with each line representing one key value pair. The first entry in the line defines the key, and the rest, which may contain whitespaces, defins the value. Lines starting with the comment character are ignored. @return returns EST_read_status errors, @see */ EST_read_status load(const EST_String &filename, const EST_String &comment = ";"); /// add to end of list or overwrite. If rval is empty, do nothing int override_val(const EST_String rkey, const EST_String rval); /// add to end of list or overwrite. If rval is empty, do nothing int override_fval(const EST_String rkey, const float rval); /// add to end of list or overwrite. If rval is empty, do nothing int override_ival(const EST_String rkey, const int rval); /** return value of type int relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present */ int ival(const EST_String &rkey, int m=1) const; /** return value of type float relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present */ double dval(const EST_String &rkey, int m=1) const; /** return value of type float relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present */ float fval(const EST_String &rkey, int m=1) const; /** return value of type String relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present */ const EST_String &sval(const EST_String &rkey, int m=1) const; /** return value of type String relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present */ // const EST_String &val(const EST_String &rkey, int m=1) const // { return sval(rkey,m); } int add_iitem(const EST_String &rkey, const int &rval); int add_fitem(const EST_String &rkey, const float &rval); /// print options friend ostream& operator << (ostream& s, const EST_Option &kv); }; #endif // __EST_OPTION_H__ speech_tools/include/EST_TList.h0000644000076400007640000002500111465017155015232 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1995 */ /* --------------------------------------------------------------------- */ /* Double linked list class */ /* */ /* Modified by RJC, 21/7/97. Now much of the working code is in the */ /* UList class, this template class provides a type safe front end to */ /* the untyped list. */ /* */ /*************************************************************************/ #ifndef __Tlist_H__ #define __Tlist_H__ #include using namespace std; #include "EST_common.h" #include "EST_UList.h" #include "EST_TSortable.h" #include "EST_TIterator.h" #include "instantiate/EST_TListI.h" class EST_String; template class EST_TList; template class EST_TItem : public EST_UItem { private: static void *operator new(size_t not_used, void *place) {(void)not_used; return place;} static void *operator new(size_t size) {void *p; p = (void *)walloc(char,size); return p;} static void operator delete(void *p) { wfree(p);} static EST_TItem *s_free; static unsigned int s_nfree; static unsigned int s_maxFree; protected: static EST_TItem *make(const T &val); static void release(EST_TItem *it); friend class EST_TList; public: T val; EST_TItem(const T &v) : val(v) { init(); }; EST_TItem() { init();}; }; // pretty name typedef EST_UItem EST_Litem; /** A Template doubly linked list class. This class contains doubly linked lists of a type denoted by {\tt T}. A pointer of type \Ref{EST_Litem} is used to access items in the list. The class supports a variety of ways of adding, removing and accessing items in the list. For examples of how to operate lists, see \Ref{list_example}. Iteration through the list is performed using a pointer of type \Ref{EST_Litem}. See \Ref{Iteration} for example code. */ template class EST_TList : public EST_UList { private: void copy_items(const EST_TList &l); public: void init() { EST_UList::init(); }; static void free_item(EST_UItem *item); /**@name Constructor functions */ //@{ /// default constructor EST_TList() { }; /// copy constructor EST_TList(const EST_TList &l); ~ EST_TList() { clear_and_free(free_item); } //@} /**@name Access functions for reading and writing items. See \Ref{EST_TList_Accessing} for examples.*/ //@{ /** return the value associated with the EST_Litem pointer. This has the same functionality as the overloaded () operator. */ T &item(const EST_Litem *p) { return ((EST_TItem *)p) -> val; }; /** return a const value associated with the EST_Litem pointer.*/ const T &item(const EST_Litem *p) const { return ((EST_TItem *)p) -> val; }; /// return the Nth value T &nth(int n) { return item(nth_pointer(n)); }; /// return a const Nth value const T &nth(int n) const { return item(nth_pointer(n)); }; /// return const reference to first item in list const T &first() const { return item(head()); }; /// return const reference to last item in list const T &last() const { return item(tail()); }; /** return reference to first item in list * @see last */ T &first() { return item(head()); }; /// return reference to last item in list T &last() { return item(tail()); }; /// return const reference to item in list pointed to by {\tt ptr} const T &operator () (const EST_Litem *ptr) const { return item(ptr); }; /// return non-const reference to item in list pointed to by {\tt ptr} T &operator () (const EST_Litem *ptr) { return item(ptr); }; //@} /**@name Removing items in a list. more. */ //@{ /** remove item pointed to by {\tt ptr}, return pointer to previous item. See \Ref{Removing} for example code.*/ EST_Litem *remove(EST_Litem *ptr) { return EST_UList::remove(ptr, free_item); }; /// remove nth item, return pointer to previous item EST_Litem *remove_nth(int n) { return EST_UList::remove(n, free_item); }; //@} /**@name Adding items to a list. In all cases, a complete copy of the item is made and added to the list. See \Ref{Addition} for examples. */ //@{ /// add item onto end of list void append(const T &item) { EST_UList::append(EST_TItem::make(item)); }; /// add item onto start of list void prepend(const T &item) { EST_UList::prepend(EST_TItem::make(item)); }; /** add {\tt item} after position given by {\tt ptr}, return pointer to added item. */ EST_Litem *insert_after(EST_Litem *ptr, const T &item) { return EST_UList::insert_after(ptr, EST_TItem::make(item)); }; /** add {\tt item} before position given by {\tt ptr}, return pointer to added item. */ EST_Litem *insert_before(EST_Litem *ptr, const T &item) { return EST_UList::insert_before(ptr, EST_TItem::make(item)); }; //@} /**@name Exchange */ //@{ /// exchange 1 void exchange(EST_Litem *a, EST_Litem *b) { EST_UList::exchange(a, b); }; /// exchange 2 void exchange(int i, int j) { EST_UList::exchange(i,j); }; /// exchange 3 static void exchange_contents(EST_Litem *a, EST_Litem *b); //@} /**@name General functions */ //@{ /// make full copy of list EST_TList &operator=(const EST_TList &a); /// Add list onto end of existing list EST_TList &operator +=(const EST_TList &a); /// print list friend ostream& operator << (ostream &st, EST_TList const &list) { EST_Litem *ptr; for (ptr = list.head(); ptr != 0; ptr = ptr->next()) st << list.item(ptr) << " "; return st; } /// remove all items in list void clear(void) { clear_and_free(free_item); }; //@} // Iteration support protected: struct IPointer { EST_Litem *p; }; void point_to_first(IPointer &ip) const { ip.p = head(); } void move_pointer_forwards(IPointer &ip) const { ip.p = ip.p->next(); } bool points_to_something(const IPointer &ip) const { return ip.p != NULL; } T &points_at(const IPointer &ip) { return item(ip.p); } friend class EST_TIterator< EST_TList, IPointer, T >; friend class EST_TRwIterator< EST_TList, IPointer, T >; public: typedef T Entry; typedef EST_TIterator< EST_TList, IPointer, T > Entries; typedef EST_TRwIterator< EST_TList, IPointer, T > RwEntries; }; template bool operator==(const EST_TList &a, const EST_TList &b) { return EST_UList::operator_eq(a, b, EST_TSortable::items_eq); } template int index(EST_TList &l, T& val, bool (*eq)(const EST_UItem *, const EST_UItem *) = NULL) { EST_TItem item(val); return EST_UList::index(l, item, eq?eq:EST_TSortable::items_eq); } template void sort(EST_TList &a, bool (*gt)(const EST_UItem *, const EST_UItem *) = NULL) { EST_UList::sort(a, gt?gt:EST_TSortable::items_gt); } template void ptr_sort(EST_TList &a) { EST_UList::sort(a, EST_TSortable::items_gt); } template void qsort(EST_TList &a, bool (*gt)(const EST_UItem *, const EST_UItem *) = NULL) { EST_UList::qsort(a, gt?gt:EST_TSortable::items_gt, EST_TList::exchange_contents); } template void ptr_qsort(EST_TList &a) { EST_UList::qsort(a, EST_TSortable::items_gt, EST_TList::exchange_contents); } template void sort_unique(EST_TList &l) { EST_UList::sort_unique(l, EST_TSortable::items_eq, EST_TSortable::items_gt, EST_TList::free_item); } template void merge_sort_unique(EST_TList &l, EST_TList &m) { EST_UList::merge_sort_unique(l, m, EST_TSortable::items_eq, EST_TSortable::items_gt, EST_TList::free_item); } template const char *error_name(EST_TList val) { (void)val; return "<>"; } #endif speech_tools/include/EST_UList.h0000644000076400007640000001361411465017155015242 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Mon Jul 21 1997 */ /* -------------------------------------------------------------------- */ /* Untyped list used as the basis of the TList class */ /* */ /*************************************************************************/ #ifndef __EST_ULIST_H__ #define __EST_ULIST_H__ #include using namespace std; #include "EST_common.h" #include "EST_String.h" class EST_UItem { public: void init() { n = NULL; p = NULL;} EST_UItem *n; EST_UItem *p; EST_UItem *next() { return n; } EST_UItem *prev() { return p; } }; class EST_UList { protected: EST_UItem *h; EST_UItem *t; protected: void init() { h = NULL; t = NULL; }; void clear_and_free(void (*item_free)(EST_UItem *item)); public: EST_UList() { init(); }; ~ EST_UList() { clear_and_free(NULL); } EST_UItem *nth_pointer(int n) const; EST_UItem *insert_after(EST_UItem *ptr, EST_UItem *new_item); // returns pointer to inserted item EST_UItem *insert_before(EST_UItem *ptr, EST_UItem *new_item); // returns pointer to item after inserted item // remove single item, return pointer to previous EST_UItem *remove(EST_UItem *ptr, void (*item_free)(EST_UItem *item)); EST_UItem *remove(int n, void (*item_free)(EST_UItem *item)); void exchange(EST_UItem *a, EST_UItem *b); void exchange(int i, int j); void reverse(); // in place int length() const; // number of items in list int index(EST_UItem *item) const; // position from start of list (head = 0) int empty() const // returns true if no items in list {return (h == NULL) ? 1 : 0;}; void clear(void) { clear_and_free(NULL); }; void append(EST_UItem *item); // add item onto end of list void prepend(EST_UItem *item); // add item onto start of list EST_UItem *head() const // return pointer to head of list { return h; }; EST_UItem *tail() const // return pointer to tail of list { return t; }; static bool operator_eq(const EST_UList &a, const EST_UList &b, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2)); static int index(const EST_UList &l, const EST_UItem &b, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2)); static void sort(EST_UList &a, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2)); static void qsort(EST_UList &a, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*exchange)(EST_UItem *item1, EST_UItem *item2)); static void sort_unique(EST_UList &l, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2), bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*item_free)(EST_UItem *item)); static void merge_sort_unique(EST_UList &l, EST_UList &m, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2), bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*item_free)(EST_UItem *item)); }; // inline functions in header file // everything else in EST_UList.C /* Please don't use these - use the member functions instead! inline EST_UItem *next(EST_UItem *ptr) { if (ptr != 0) return ptr->n; return 0; } inline EST_UItem *prev(EST_UItem *ptr) { if (ptr != 0) return ptr->p; return 0; } */ #endif speech_tools/include/EST_TSortable.h0000644000076400007640000000645307262605664016114 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Thu Sep 4 1997 */ /* -------------------------------------------------------------------- */ /* A record which defines a sorting order. */ /* */ /*************************************************************************/ #ifndef __EST_TSORTABLE_H__ #define __EST_TSORTABLE_H__ #include "EST_UList.h" #include "instantiate/EST_TSortableI.h" template class EST_TSortable { public: static bool items_eq(const EST_UItem *item1, const EST_UItem *item2); static bool items_lt(const EST_UItem *item1, const EST_UItem *item2); static bool items_gt(const EST_UItem *item1, const EST_UItem *item2); }; #endif speech_tools/include/EST_Token.h0000644000076400007640000003561010127000720015242 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : April 1996 */ /*-----------------------------------------------------------------------*/ /* Token/Tokenizer class */ /* */ /*=======================================================================*/ #ifndef __EST_TOKEN_H__ #define __EST_TOKEN_H__ #include using namespace std; #include "EST_String.h" #include "EST_common.h" // I can never really remember this so we'll define it here /// The default whitespace characters extern const EST_String EST_Token_Default_WhiteSpaceChars; /// extern const EST_String EST_Token_Default_SingleCharSymbols; /// extern const EST_String EST_Token_Default_PunctuationSymbols; /// extern const EST_String EST_Token_Default_PrePunctuationSymbols; /** This class is similar to \Ref{EST_String} but also maintains the original punctuation and whitespace found around the token. \Ref{EST_Token}'s primary use is with \Ref{EST_TokenStream} class which allows easy tokenizing of ascii files. A token consists of four parts, any of which may be empty: a name, the actual token, preceding whitespace, preceding punctuation, the name and succeeding punctuation. @author Alan W Black (awb@cstr.ed.ac.uk): April 1996 */ class EST_Token { private: EST_String space; EST_String prepunc; EST_String pname; EST_String punc; int linenum; int linepos; int p_filepos; int p_quoted; public: /// EST_Token() {init();} /// EST_Token(const EST_String p) {init(); pname = p; } /// void init() {p_quoted=linenum=linepos=p_filepos=0;} /**@name Basic access to fields */ //@{ /// set token from a string void set_token(const EST_String &p) { pname = p; } /// void set_token(const char *p) { pname = p; } /// set whitespace of token. void set_whitespace(const EST_String &p) { space = p; } /// void set_whitespace(const char *p) { space = p; } /// set (post) punctuation of token. void set_punctuation(const EST_String &p) { punc = p; } /// void set_punctuation(const char *p) { punc = p; } /// set prepunction void set_prepunctuation(const EST_String &p) { prepunc = p; } /// void set_prepunctuation(const char *p) { prepunc = p; } /// const EST_String &whitespace() { return space; } /// const EST_String &punctuation() { return punc; } /// const EST_String &prepunctuation() { return prepunc; } /**@name Access token as a string */ //@{ const EST_String &string() const { return String(); } /// Access token as a string const EST_String &S() const { return S(); } /// Access token as a string const EST_String &String() const { return pname; } /// For automatic coercion to \Ref{EST_String} operator EST_String() const { return String(); } //@} /**@name Access token as a int */ //@{ int Int(bool &valid) const { return String().Int(valid); } int Int() const { return String().Int(); } int I(bool &valid) const { return Int(valid); } int I() const { return Int(); } operator int() const { return Int(); } //@} /**@name Access token as a long */ //@{ long Long(bool &valid) const { return String().Long(valid); } long Long() const { return String().Long(); } long L(bool &valid) const { return Long(valid); } long L() const { return Long(); } operator long() const { return Long(); } //@} /**@name Access token as a float */ //@{ float Float(bool &valid) const { return String().Float(valid); } float Float() const { return String().Float(); } float F(bool &valid) const { return Float(valid); } float F() const { return Float(); } operator float() const { return Float(); } //@} /**@name Access token as a double */ //@{ double Double(bool &valid) const { return String().Double(valid); } double Double() const { return String().Double(); } double D(bool &valid) const { return Double(valid); } double D() const { return Double(); } operator double() const { return Double(); } //@} //@} //@{ /// Note that this token was quoted (or not) void set_quoted(int q) { p_quoted = q; } /// TRUE is token was quoted int quoted() const { return p_quoted; } //@} /// void set_row(int r) { linenum = r; } /// void set_col(int c) { linepos = c; } /// Set file position in original \Ref{EST_TokenStream} void set_filepos(int c) { p_filepos = c; } /// Return lower case version of token name EST_String lstring() { return downcase(pname); } /// Return upper case version of token name EST_String ustring() { return upcase(pname); } /// Line number in original \Ref{EST_TokenStream}. int row(void) const { return linenum; } /// Line position in original \Ref{EST_TokenStream}. int col(void) const { return linepos; } /// file position in original \Ref{EST_TokenStream}. int filepos(void) const { return p_filepos; } /// A string describing current position, suitable for error messages const EST_String pos_description() const; /// friend ostream& operator << (ostream& s, const EST_Token &p); /// EST_Token & operator = (const EST_Token &a); /// EST_Token & operator = (const EST_String &a); /// int operator == (const EST_String &a) { return (pname == a); } /// int operator != (const EST_String &a) { return (pname != a); } /// int operator == (const char *a) { return (strcmp(pname,a)==0); } /// int operator != (const char *a) { return (strcmp(pname,a)!=0); } }; enum EST_tokenstream_type {tst_none, tst_file, tst_pipe, tst_string, tst_istream}; /** A class that allows the reading of \Ref{EST_Token}s from a file stream, pipe or string. It automatically tokenizes a file based on user definable whitespace and punctuation. The definitions of whitespace and punctuation are user definable. Also support for single character symbols is included. Single character symbols {\em always} are treated as individual tokens irrespective of their white space context. Also a quote mode can be used to read uqoted tokens. The setting of whitespace, pre and post punctuation, single character symbols and quote mode must be down (immediately) after opening the stream. There is no unget but peek provides look ahead of one token. Note there is an interesting issue about what to do about the last whitespace in the file. Should it be ignored or should it be attached to a token with a name string of length zero. In unquoted mode the eof() will return TRUE if the next token name is empty (the mythical last token). In quoted mode the last must be returned so eof will not be raised. @author Alan W Black (awb@cstr.ed.ac.uk): April 1996 */ class EST_TokenStream{ private: EST_tokenstream_type type; EST_String WhiteSpaceChars; EST_String SingleCharSymbols; EST_String PunctuationSymbols; EST_String PrePunctuationSymbols; EST_String Origin; FILE *fp; istream *is; int fd; char *buffer; int buffer_length; int pos; int linepos; int p_filepos; int getch(void); EST_TokenStream &getch(char &C); int peeked_charp; int peeked_char; // ungot character int peekch(void); int peeked_tokp; int eof_flag; int quotes; char quote; char escape; EST_Token current_tok; void default_values(void); /* local buffers to save reallocating */ int tok_wspacelen; char *tok_wspace; int tok_stufflen; char *tok_stuff; int tok_prepuncslen; char *tok_prepuncs; int close_at_end; /* character class map */ char p_table[256]; bool p_table_wrong; /** This function is deliberately private so that you'll get a compilation error if you assign a token stream or pass it as an (non-reference) argument. The problem with copying is that you need to copy the filedescriptiors too (which can't be done for pipes). You probably don't really want a copy anyway and meant to pass it as a reference. If you really need this (some sort of clever look ahead) I am not sure what he consequences really are (or how portable they are). Pass the \Ref{EST_TokenStream} by reference instead. */ EST_TokenStream(EST_TokenStream &s); void build_table(); inline int getch_internal(); inline int peekch_internal(); inline int getpeeked_internal(); public: /// EST_TokenStream(); /// will close file if appropriate for type ~EST_TokenStream(); //@{ /// open a \Ref{EST_TokenStream} for a file. int open(const EST_String &filename); /// open a \Ref{EST_TokenStream} for an already opened file int open(FILE *ofp, int close_when_finished); /// open a \Ref{EST_TokenStream} for an already open istream int open(istream &newis); /// open a \Ref{EST_TokenStream} for string rather than a file int open_string(const EST_String &newbuffer); /// Close stream. void close(void); //@} /**@name stream access functions */ //@{ /// get next token in stream EST_TokenStream &get(EST_Token &t); /// get next token in stream EST_Token &get(); /**@name get the next token which must be the argument. */ //@{ EST_Token &must_get(EST_String expected, bool *ok); EST_Token &must_get(EST_String expected, bool &ok) { return must_get(expected, &ok); } EST_Token &must_get(EST_String expected) { return must_get(expected, (bool *)NULL); } //@} /// get up to {\tt s} in stream as a single token. EST_Token get_upto(const EST_String &s); /// get up to {\tt s} in end of line as a single token. EST_Token get_upto_eoln(void); /// peek at next token EST_Token &peek(void) { if (!peeked_tokp) get(); peeked_tokp = TRUE; return current_tok; } /// Reading binary data, (don't use peek() immediately beforehand) int fread(void *buff,int size,int nitems); //@} /**@name stream initialization functions */ //@{ /// set which characters are to be treated as whitespace void set_WhiteSpaceChars(const EST_String &ws) { WhiteSpaceChars = ws; p_table_wrong=1;} /// set which characters are to be treated as single character symbols void set_SingleCharSymbols(const EST_String &sc) { SingleCharSymbols = sc; p_table_wrong=1;} /// set which characters are to be treated as (post) punctuation void set_PunctuationSymbols(const EST_String &ps) { PunctuationSymbols = ps; p_table_wrong=1;} /// set which characters are to be treated as (post) punctuation void set_PrePunctuationSymbols(const EST_String &ps) { PrePunctuationSymbols = ps; p_table_wrong=1;} /// set characters to be used as quotes and escape, and set quote mode void set_quotes(char q, char e) { quotes = TRUE; quote = q; escape = e; p_table_wrong=1;} /// query quote mode int quoted_mode(void) { return quotes; } //@} /**@name miscellaneous */ //@{ /// returns line number of \Ref{EST_TokenStream} int linenum(void) const {return linepos;} /// end of file int eof() { return (eof_flag || ((!quotes) && (peek() == ""))); } /// end of line int eoln(); /// current file position in \Ref{EST_TokenStream} int filepos(void) const { return (type == tst_string) ? pos : p_filepos; } /// tell, synonym for filepos int tell(void) const { return filepos(); } /// seek, reposition file pointer int seek(int position); int seek_end(); /// Reset to start of file/string int restart(void); /// A string describing current position, suitable for error messages const EST_String pos_description(); /// The originating filename (if there is one) const EST_String filename() const { return Origin; } /// For the people who *need* the actual description (if possible) FILE *filedescriptor() { return (type == tst_file) ? fp : 0; } /// EST_TokenStream & operator >>(EST_Token &p); /// EST_TokenStream & operator >>(EST_String &p); /// friend ostream& operator <<(ostream& s, EST_TokenStream &p); //@} }; /** Quote a string with given quotes and escape character */ EST_String quote_string(const EST_String &s, const EST_String "e = "\"", const EST_String &escape = "\\", int force=0); #endif // __EST_TOKEN_H__ speech_tools/include/EST_StringTrie.h0000644000076400007640000001173407262605664016305 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* A class for building EST_String (char-based) tries for indexing */ /* arbitrary objects by Strings */ /* */ /*=======================================================================*/ #ifndef __EST_STRINGTRIE_H__ #define __EST_STRINGTRIE_H__ #include "EST_String.h" class EST_StringTrie; /** An internal class for \Ref{EST_StringTrie} used to hold represent the node in an string index tree. This basically represents a 128-branching node (on for each character) plus a contents field for strings ending at this point. @author Alan W Black (awb@cstr.ed.ac.uk): June 1996 */ class EST_TrieNode { private: int w; EST_TrieNode **d; void *contents; // will use EST_TrieContents when I have a list of contents public: /// EST_TrieNode() {w=0; d=0; contents=0;} /// EST_TrieNode(const int width); /// ~EST_TrieNode(); /// Find the contents for given string, 0 if no current contents void *lookup(const unsigned char *key) const; /// add {\tt item} for {\tt key} overwriting previous contents void add(const unsigned char *key,void *item); /// copy all entries in trie node into trie void copy_into(EST_StringTrie &trie, const EST_String &path) const; }; /** A string tree index class for indexing arbitrary objects by strings of characters. Note this only deals with 7 but characters, and can only hold one item per index key. */ class EST_StringTrie { private: EST_TrieNode *tree; public: /// EST_StringTrie(); /// EST_StringTrie(const EST_StringTrie &trie) { copy(trie); } /// ~EST_StringTrie(); /// void copy(const EST_StringTrie &trie); /// Find contents index by {\tt key}, 0 if there is not contents void *lookup(const EST_String &key) const; /// Add {\tt item} indexed by {\tt key}, overwriting previous contents void add(const EST_String &key,void *item); /// Delete the tree void clear(void); /// Delete the tree, apply {\tt deletenote} function to each {\tt contents} void clear(void (*deletenode)(void *n)); /// EST_StringTrie & operator = (const EST_StringTrie &a) { copy(a); return *this; } }; #endif // __EST_STRINGTRIE_H__ speech_tools/include/EST_TMatrix.h0000644000076400007640000002565510455715721015604 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Rewritten : Richard Caley */ /* --------------------------------------------------------------------- */ /* Matrix class */ /* */ /*************************************************************************/ #ifndef __TMatrix_H__ #define __TMatrix_H__ #include using namespace std; #include "EST_rw_status.h" #include "EST_TVector.h" #include "instantiate/EST_TMatrixI.h" /* When set bounds checks (safe but slow) are done on matrix access */ #ifndef TMATRIX_BOUNDS_CHECKING # define TMATRIX_BOUNDS_CHECKING 0 #endif #if TMATRIX_BOUNDS_CHECKING #define A_CHECK a_check #else #define A_CHECK a_no_check #endif #define INLINE inline /* This doesn't work as I thought so I have disabled it for now. */ #if defined(__GNUC__) && 0 # define mx_move_pointer(P, TY, STEP, N) \ ((TY *)\ ((void *) (((char (*) [sizeof(TY)*STEP])P) + N) ) \ ) # define fast_a_m_gcc(R,C) \ ( * mx_move_pointer(mx_move_pointer(p_memory,T,p_column_step,C),T,p_row_step,R)) # define fast_a_m_x(R,C) (fast_a_m_gcc(R,C)) #else # define fast_a_m_x(R,C) (fast_a_m(R,C)) #endif /** Template Matrix class. * * This is an extension of the EST_TVector class to two dimensions. * * @see matrix_example * @see EST_TVector */ template class EST_TMatrix : public EST_TVector { protected: /// Visible shape unsigned int p_num_rows; /// How to access the memory unsigned int p_row_step; INLINE unsigned int mcell_pos(int r, int c, int rs, int cs) const { return (rs==1?r:(r*rs)) + (cs==1?c:(c*cs));} INLINE unsigned int mcell_pos(int r, int c) const { return mcell_pos(r, c, this->p_row_step, this->p_column_step); } INLINE unsigned int mcell_pos_1(int r, int c) const { (void)r; return c; } /// quick method for returning {\tt x[m][n]} INLINE const T &fast_a_m(int r, int c) const { return this->p_memory[mcell_pos(r,c)]; } INLINE T &fast_a_m(int r, int c) { return this->p_memory[mcell_pos(r,c)]; } INLINE const T &fast_a_1(int r, int c) const { return this->p_memory[mcell_pos_1(r,c)]; } INLINE T &fast_a_1(int r, int c) { return this->p_memory[mcell_pos_1(r,c)]; } /// Get and set values from array void set_values(const T *data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c ); void get_values(T *data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c ) const; /// private resize and copy function. void copy(const EST_TMatrix &a); /// just copy data, no resizing, no size check. void copy_data(const EST_TMatrix &a); /// resize the memory and reset the bounds, but don't set values. void just_resize(int new_rows, int new_cols, T** old_vals); /// sets data and length to default values (0 in both cases). void default_vals(); public: ///default constructor EST_TMatrix(); /// copy constructor EST_TMatrix(const EST_TMatrix &m); /// "size" constructor EST_TMatrix(int rows, int cols); /// construct from memory supplied by caller EST_TMatrix(int rows, int cols, T *memory, int offset=0, int free_when_destroyed=0); /// EST_TMatrix ~EST_TMatrix(); /**@name access * Basic access methods for matrices. */ //@{ /// return number of rows int num_rows() const {return this->p_num_rows;} /// return number of columns int num_columns() const {return this->p_num_columns;} /// const access with no bounds check, care recommend INLINE const T &a_no_check(int row, int col) const { return fast_a_m_x(row,col); } /// access with no bounds check, care recommend INLINE T &a_no_check(int row, int col) { return fast_a_m_x(row,col); } INLINE const T &a_no_check_1(int row, int col) const { return fast_a_1(row,col); } INLINE T &a_no_check_1(int row, int col) { return fast_a_1(row,col); } /// const element access function const T &a_check(int row, int col) const; /// non-const element access function T &a_check(int row, int col); const T &a(int row, int col) const { return A_CHECK(row,col); } T &a(int row, int col) { return A_CHECK(row,col); } /// const element access operator const T &operator () (int row, int col) const { return a(row,col); } /// non-const element access operator T &operator () (int row, int col) { return a(row,col); } //@} bool have_rows_before(int n) const; bool have_columns_before(int n) const; /** resize matrix. If {\tt set=1}, then the current values in the matrix are preserved up to the new size {\tt n}. If the new size exceeds the old size, the rest of the matrix is filled with the {\tt def_val} */ void resize(int rows, int cols, int set=1); /// fill matrix with value v void fill(const T &v); void fill() { fill(*this->def_val); } /// assignment operator EST_TMatrix &operator=(const EST_TMatrix &s); /// The two versions of what might have been operator += EST_TMatrix &add_rows(const EST_TMatrix &s); EST_TMatrix &add_columns(const EST_TMatrix &s); /**@name Sub-Matrix/Vector Extraction * * All of these return matrices and vectors which share * memory with the original, so altering values them alters * the original. */ //@{ /// Make the vector {\tt rv} a window onto row {\tt r} void row(EST_TVector &rv, int r, int start_c=0, int len=-1); /// Make the vector {\tt cv} a window onto column {\tt c} void column(EST_TVector &cv, int c, int start_r=0, int len=-1); /// Make the matrix {\tt sm} a window into this matrix. void sub_matrix(EST_TMatrix &sm, int r=0, int numr=EST_ALL, int c=0, int numc=EST_ALL); //@} /**@name Copy in and out * Copy data between buffers and the matrix. */ //@{ /** Copy row {\tt r} of matrix to {\tt buf}. {\tt buf} should be pre-malloced to the correct size. */ void copy_row(int r, T *buf, int offset=0, int num=-1) const; /** Copy row r of matrix to buf. buf should be pre-malloced to the correct size. */ void copy_row(int r, EST_TVector &t, int offset=0, int num=-1) const; /** Copy column {\tt c} of matrix to {\tt buf}. {\tt buf} should be pre-malloced to the correct size. */ void copy_column(int c, T *buf, int offset=0, int num=-1) const; /** Copy column c of matrix to buf. buf should be pre-malloced to the correct size. */ void copy_column(int c, EST_TVector &t, int offset=0, int num=-1)const; /** Copy buf into row {\tt n} of matrix. */ void set_row(int n, const T *buf, int offset=0, int num=-1); void set_row(int n, const EST_TVector &t, int offset=0, int num=-1) { set_row(n, t.memory(), offset, num); } void set_row(int r, const EST_TMatrix &from, int from_r, int from_offset=0, int offset=0, int num=-1); // set nth row /** Copy buf into column {\tt n} of matrix. */ void set_column(int n, const T *buf, int offset=0, int num=-1); void set_column(int n, const EST_TVector &t, int offset=0, int num=-1) { set_column(n, t.memory(), offset, num); } void set_column(int c, const EST_TMatrix &from, int from_c, int from_offset=0, int offset=0, int num=-1); // set nth column /** For when you absolutely have to have access to the memory. */ void set_memory(T *buffer, int offset, int rows, int columns, int free_when_destroyed=0); //@} /**@name io * Matrix file io. */ //@{ /// load Matrix from file - Not currently implemented. EST_read_status load(const class EST_String &filename); /// save Matrix to file {\tt filename} EST_write_status save(const class EST_String &filename) const; /// print matrix. friend ostream& operator << (ostream &st,const EST_TMatrix &a) {int i, j; for (i = 0; i < a.num_rows(); ++i) { for (j = 0; j < a.num_columns(); ++j) st << a.a_no_check(i, j) << " "; st << endl; } return st; } //@} }; #undef A_CHECK #endif speech_tools/include/EST_TVector.h0000644000076400007640000002712610455716454015601 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1996 */ /*-----------------------------------------------------------------------*/ /* Vector class */ /* */ /*=======================================================================*/ #ifndef __EST_TVector_H__ #define __EST_TVector_H__ #include using namespace std; #include "EST_bool.h" #include "EST_rw_status.h" #include "instantiate/EST_TVectorI.h" template class EST_TMatrix; template class EST_TList; class EST_String; /* A constants to make it clearer what is going on when we pass `-1' * meaning `current size' or `all the rest' */ extern const int EST_CURRENT; extern const int EST_ALL; /* When set bounds checks (safe but slow) are done on vector access */ #ifndef TVECTOR_BOUNDS_CHECKING # define TVECTOR_BOUNDS_CHECKING 0 #endif #if TVECTOR_BOUNDS_CHECKING #define A_CHECK a_check #else #define A_CHECK a_no_check #endif #define INLINE inline /* This doesn't work as I thought so I have disabled it for now. */ #if defined(__GNUC__) && 0 # define fast_a_v_gcc(C) \ ( *((T *)\ (((char (*) [sizeof(T)*p_column_step])p_memory) + (C))\ )) # define fast_a_v_x(C) (fast_a_v_gcc(C)) #else # define fast_a_v_x(C) (fast_a_v(C)) #endif /**@name Template vector This serves as a base class for a vector of type T. This acts as a higher level version of a normal C array as defined as float *x etc. The vector can be resized after declaration, access can be with or without bounds checking. Round brackets denote read-only access (for consts) while square brackets are for read-write access. In both cases references are returned. The standard operators () and [] should be thought of as having no bounds checking, though they may do so optionally as a compile time option. The methods a_check and a_nocheck provide explicit boundary checking/nonchecking, both const and non-const versions are provided. Access through () and [] are guaranteed to be as fast as standard C arrays (assuming a reasonable optimizing compiler). EST_FVector x(10); int i; for (i=0; i < x.length(); ++i) x[i] = sqrt((float)i); x.resize(20); for (i=10; i < x.length(); ++i) x[i] = sqrt((float)i); To instantiate a template for a a vector of type {FooBar} #include "../base_class/EST_TVector.cc" // If you want List to vector conversion (and defined a TList) #include "../base_class/EST_Tvectlist.cc" template class EST_TVector; template ostream& operator << (ostream &st, const EST_TVector &v); The EST library already has template vector instantiations for int, float, double and . Also types are defined for them in as , , and for ints, floats, doubless and s respectively. * @see matrix_example */ //@{ template class EST_TVector { // protected: public: /** Pointer to the start of the vector. * The start of allocated memory is p_memory-p_offset. */ T *p_memory; /// Visible shape unsigned int p_num_columns; /// How to access the memory unsigned int p_offset; unsigned int p_column_step; bool p_sub_matrix; /// The memory access rule, in one place for easy reference INLINE unsigned int vcell_pos(unsigned int c, unsigned int cs) const {return cs==1?c:c*cs;} INLINE unsigned int vcell_pos(unsigned int c) const { return vcell_pos(c, p_column_step); } INLINE unsigned int vcell_pos_1(unsigned int c) const { return c; } /// quick method for returning \(x[n]\) INLINE const T &fast_a_v(int c) const { return p_memory[vcell_pos(c)]; } INLINE T &fast_a_v(int c) { return p_memory[vcell_pos(c)]; } INLINE const T &fast_a_1(int c) const { return p_memory[vcell_pos_1(c)]; } INLINE T &fast_a_1(int c) { return p_memory[vcell_pos_1(c)]; } /// Get and set values from array void set_values(const T *data, int step, int start_c, int num_c); void get_values(T *data, int step, int start_c, int num_c) const; /// private copy function, called from all other copying functions. void copy(const EST_TVector &a); /// just copy data, no resizing, no size check. void copy_data(const EST_TVector &a); /// resize the memory and reset the bounds, but don't set values. void just_resize(int new_cols, T** old_vals); /// sets data and length to default values (0 in both cases). void default_vals(); public: ///default constructor EST_TVector(); /// copy constructor EST_TVector(const EST_TVector &v); /// "size" constructor - make vector of size n. EST_TVector(int n); /// construct from memory supplied by caller EST_TVector(int, T *memory, int offset=0, int free_when_destroyed=0); /// destructor. ~EST_TVector(); /// default value, used for filling matrix after resizing static const T *def_val; /** A reference to this variable is returned if you try and access * beyond the bounds of the matrix. The value is undefined, but you * can check for the reference you get having the same address as * this variable to test for an error. */ static T *error_return; /** resize vector. If set=1, then the current values in the vector are preserved up to the new length n. If the new length exceeds the old length, the rest of the vector is filled with the def_val */ void resize(int n, int set=1); /** For when you absolutely have to have access to the memory. */ const T * memory() const { return p_memory; } T * memory(){ return p_memory; } /**@name access * Basic access methods for vectors. */ //@{ /// number of items in vector. INLINE int num_columns() const {return p_num_columns;} /// number of items in vector. INLINE int length() const {return num_columns();} /// number of items in vector. INLINE int n() const {return num_columns();} /// read-only const access operator: without bounds checking INLINE const T &a_no_check(int n) const { return fast_a_v_x(n); } /// read/write non-const access operator: without bounds checking INLINE T &a_no_check(int n) { return fast_a_v_x(n); } /// read-only const access operator: without bounds checking INLINE const T &a_no_check_1(int n) const { return fast_a_1(n); } /// read/write non-const access operator: without bounds checking INLINE T &a_no_check_1(int n) { return fast_a_1(n); } // #define pp_a_no_check(V,N) (pp_fast_a(V,N)) /// read-only const access operator: with bounds checking const T &a_check(int n) const; /// read/write non-const access operator: with bounds checking T &a_check(int n); const T &a(int n) const { return A_CHECK(n); } T &a(int n) { return A_CHECK(n); } /// read-only const access operator: return reference to nth member const T &operator () (int n) const {return A_CHECK(n);} // PT // /// non const access operator: return reference to nth member // T &operator () (int n) const {return a(n);} /// read/write non const access operator: return reference to nth member T &operator [] (int n) { return A_CHECK(n); } //@} void set_memory(T *buffer, int offset, int columns, int free_when_destroyed=0); /// assignment operator EST_TVector &operator=(const EST_TVector &s); /// Fill entire array will value v. void fill(const T &v); /// Fill vector with default value void empty() { fill(*def_val); } /// is true if vectors are equal size and all elements are equal. int operator == (const EST_TVector &v) const; /// is true if vectors are not equal size or a single elements isn't equal. int operator != (const EST_TVector &v) const { return ! ((*this) == v); } /// Copy data in and out. Subclassed by SimpleVector for speed. void copy_section(T* dest, int offset=0, int num=-1) const; void set_section(const T* src, int offset=0, int num=-1); /// Create a sub vector. void sub_vector(EST_TVector &sv, int start_c=0, int len=-1); /// print out vector. friend ostream& operator << (ostream &st, const EST_TVector &m) { int i; for (i = 0; i < m.n(); ++i) st << m(i) << " "; st << endl; return st; } /// Matrix must be friend to set up subvectors friend class EST_TMatrix; void integrity() const; }; //@} /// assignment operator: fill track with values in list s. template extern EST_TVector &set(EST_TVector &v, const EST_TList &s); #undef A_CHECK #endif speech_tools/include/EST_TSimpleMatrix.h0000644000076400007640000000756210044502521016735 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Oct 10 1997 */ /* -------------------------------------------------------------------- */ /* A subclass of TMatrix which copies using memcopy. This isn't */ /* suitable for matrices of class objects which have to be copied */ /* using a constructor or specialised assignment operator. */ /* */ /*************************************************************************/ #ifndef __EST_TSIMPLEMATRIX_H__ #define __EST_TSIMPLEMATRIX_H__ #include "EST_TMatrix.h" #include "instantiate/EST_TSimpleMatrixI.h" template class EST_TSimpleMatrix : public EST_TMatrix { protected: // just copy data, no resizing. void copy_data(const EST_TSimpleMatrix &a); public: /// default constructor EST_TSimpleMatrix(void) : EST_TMatrix() {}; /// size constructor EST_TSimpleMatrix(int m, int n) : EST_TMatrix(m, n) {}; /// copy constructor EST_TSimpleMatrix(const EST_TSimpleMatrix &m); /// copy one matrix into another void copy(const EST_TSimpleMatrix &a); /// resize matrix void resize(int rows, int cols, int set=1); /// assignment operator EST_TSimpleMatrix &operator=(const EST_TSimpleMatrix &s); }; #endif speech_tools/include/EST_TSimpleVector.h0000644000076400007640000001055510511242143016727 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Oct 10 1997 */ /* -------------------------------------------------------------------- */ /* A subclass of TVector which copies using memcopy. This isn't */ /* suitable for matrices of class objects which have to be copied */ /* using a constructor or specialised assignment operator. */ /* */ /*************************************************************************/ #ifndef __EST_TSimpleVector_H__ #define __EST_TSimpleVector_H__ #include "EST_TVector.h" #include "instantiate/EST_TSimpleVectorI.h" /** A derived class from EST_TVector which is used for containing simple types, such as float or int. */ template class EST_TSimpleVector : public EST_TVector { private: /// private copy function void copy(const EST_TSimpleVector &a); public: ///default constructor EST_TSimpleVector() : EST_TVector() {}; /// copy constructor EST_TSimpleVector(const EST_TSimpleVector &v); /// "size" constructor EST_TSimpleVector(int n): EST_TVector(n) {}; /// memory constructor EST_TSimpleVector(int n, T* memory, int offset=0, int free_when_destroyed=0): EST_TVector(n,memory) {}; /// resize vector void resize(int n, int set=1); /// assignment operator EST_TSimpleVector &operator=(const EST_TSimpleVector &s); void copy_section(T* dest, int offset=0, int num=-1) const; void set_section(const T* src, int offset=0, int num=-1); /// Fill entire array with 0 bits. void zero(void); // /// Fill vector with default value // void empty(void) { if (*this->def_val == 0) zero(); else fill(*this->def_val); } }; #endif speech_tools/include/EST_FMatrix.h0000644000076400007640000002332710056153700015546 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1996 */ /* --------------------------------------------------------------------- */ /* Matrix class */ /* */ /*************************************************************************/ #ifndef __FMatrix_H__ #define __FMatrix_H__ #include "EST_TSimpleMatrix.h" #include "EST_TSimpleVector.h" #include "EST_Val.h" #include "EST_Val_defs.h" class EST_FVector; /** A matrix class for floating point numbers. EST_FMatrix x should be used instead of float **x wherever possible. */ class EST_FMatrix : public EST_TSimpleMatrix { private: public: /// size constructor EST_FMatrix(int m, int n):EST_TSimpleMatrix(m, n) {} /// copy constructor EST_FMatrix(const EST_FMatrix &a):EST_TSimpleMatrix(a) {} static EST_String default_file_type; /// CHECK - what does this do??? EST_FMatrix(const EST_FMatrix &a, int b); /// default constructor EST_FMatrix():EST_TSimpleMatrix() {} /// Save in file (ascii or binary) EST_write_status save(const EST_String &filename, const EST_String &type = EST_FMatrix::default_file_type ); /// Load from file (ascii or binary as defined in file) EST_read_status load(const EST_String &filename); /// Save in file in est format EST_write_status est_save(const EST_String &filename, const EST_String &type); /// Load from file in est format (binary/ascii defined in file itself) EST_read_status est_load(const EST_String &filename); /// Copy 2-d array {\tt x} of size {\tt rows x cols} into matrix. void copyin(float **x, int rows, int cols); /// Add elements of 2 same sized matrices. EST_FMatrix &operator+=(const EST_FMatrix &a); /// Subtract elements of 2 same sized matrices. EST_FMatrix &operator-=(const EST_FMatrix &a); /// elementwise multiply by scalar EST_FMatrix &operator*=(const float f); /// elementwise divide by scalar EST_FMatrix &operator/=(const float f); /// Multiply all elements of matrix by {\tt x}. friend EST_FMatrix operator*(const EST_FMatrix &a, const float x); /// Multiply matrix by vector. friend EST_FVector operator*(const EST_FMatrix &a, const EST_FVector &v); /// Multiply vector by matrix friend EST_FVector operator*(const EST_FVector &v,const EST_FMatrix &a); /// Multiply matrix by matrix. friend EST_FMatrix operator*(const EST_FMatrix &a, const EST_FMatrix &b); }; /** A vector class for floating point numbers. {\tt EST_FVector x} should be used instead of {\tt float *x} wherever possible. */ class EST_FVector: public EST_TSimpleVector { public: /// Size constructor. EST_FVector(int n): EST_TSimpleVector(n) {} /// Copy constructor. EST_FVector(const EST_FVector &a): EST_TSimpleVector(a) {} /// Default constructor. EST_FVector(): EST_TSimpleVector() {} /// elementwise multiply EST_FVector &operator*=(const EST_FVector &s); /// elementwise add EST_FVector &operator+=(const EST_FVector &s); /// elementwise multiply by scalar EST_FVector &operator*=(const float f); /// elementwise divide by scalar EST_FVector &operator/=(const float f); EST_write_status est_save(const EST_String &filename, const EST_String &type); /// save vector to file filename. EST_write_status save(const EST_String &filename, const EST_String &type); /// load vector from file filename. EST_read_status load(const EST_String &filename); /// Load from file in est format (binary/ascii defined in file itself) EST_read_status est_load(const EST_String &filename); }; /// find largest element float matrix_max(const EST_FMatrix &a); /// find largest element float vector_max(const EST_FVector &a); int square(const EST_FMatrix &a); /// inverse int inverse(const EST_FMatrix &a, EST_FMatrix &inv); int inverse(const EST_FMatrix &a, EST_FMatrix &inv, int &singularity); /// pseudo inverse (for non-square matrices) int pseudo_inverse(const EST_FMatrix &a, EST_FMatrix &inv); int pseudo_inverse(const EST_FMatrix &a, EST_FMatrix &inv,int &singularity); /// some useful matrix creators /// make an identity matrix of dimension n void eye(EST_FMatrix &a, const int n); /// make already square matrix into I without resizing void eye(EST_FMatrix &a); /// the user should use est_seed to seed the random number generator void est_seed(); void est_seed48(); /// all elements are randomised void make_random_vector(EST_FVector &M, const float scale); /// all elements are randomised void make_random_matrix(EST_FMatrix &M, const float scale); /// used for variance void make_random_diagonal_matrix(EST_FMatrix &M, const float scale); /// used for covariance void make_random_symmetric_matrix(EST_FMatrix &M, const float scale); void make_poly_basis_function(EST_FMatrix &T, EST_FVector t); /// elementwise add EST_FVector add(const EST_FVector &a,const EST_FVector &b); /// elementwise subtract EST_FVector subtract(const EST_FVector &a,const EST_FVector &b); /// enforce symmetry void symmetrize(EST_FMatrix &a); /// stack columns on top of each other to make a vector void stack_matrix(const EST_FMatrix &M, EST_FVector &v); /// inplace diagonalise void inplace_diagonalise(EST_FMatrix &a); float determinant(const EST_FMatrix &a); /// not implemented ?? int singular(EST_FMatrix &a); /// exchange rows and columns void transpose(const EST_FMatrix &a,EST_FMatrix &b); EST_FMatrix triangulate(const EST_FMatrix &a); /// extract leading diagonal as a matrix EST_FMatrix diagonalise(const EST_FMatrix &a); /// extract leading diagonal as a vector EST_FVector diagonal(const EST_FMatrix &a); /// sum of elements float sum(const EST_FMatrix &a); void multiply(const EST_FMatrix &a, const EST_FMatrix &b, EST_FMatrix &c); int floor_matrix(EST_FMatrix &M, const float floor); /// matrix product of two vectors (#rows = length of first vector, #cols = length of second vector) EST_FMatrix cov_prod(const EST_FVector &v1,const EST_FVector &v2); EST_FMatrix operator*(const EST_FMatrix &a, const EST_FMatrix &b); EST_FMatrix operator-(const EST_FMatrix &a, const EST_FMatrix &b); EST_FMatrix operator+(const EST_FMatrix &a, const EST_FMatrix &b); EST_FVector operator-(const EST_FVector &a, const EST_FVector &b); EST_FVector operator+(const EST_FVector &a, const EST_FVector &b); EST_FMatrix sub(const EST_FMatrix &a, int row, int col); EST_FMatrix fmatrix_abs(const EST_FMatrix &a); EST_FMatrix row(const EST_FMatrix &a, int row); EST_FMatrix column(const EST_FMatrix &a, int col); /// least squares fit bool polynomial_fit(EST_FVector &x, EST_FVector &y, EST_FVector &co_effs, int order); /// weighted least squares fit bool polynomial_fit(EST_FVector &x, EST_FVector &y, EST_FVector &co_effs, EST_FVector &weights, int order); float polynomial_value(const EST_FVector &coeffs, const float x); /// vector dot product float operator*(const EST_FVector &v1, const EST_FVector &v2); VAL_REGISTER_CLASS_DCLS(fmatrix,EST_FMatrix) VAL_REGISTER_CLASS_DCLS(fvector,EST_FVector) #endif speech_tools/include/EST_DMatrix.h0000644000076400007640000002276310044502521015543 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Simon King */ /* Date : February 1999 */ /* --------------------------------------------------------------------- */ /* Double matrix class - copied from FMatrix ! */ /* */ /*************************************************************************/ #ifndef __DMatrix_H__ #define __DMatrix_H__ #include "EST_TSimpleMatrix.h" #include "EST_TSimpleVector.h" #include "EST_FMatrix.h" class EST_DVector; /** A matrix class for double precision floating point numbers. EST_DMatrix x should be used instead of double **x wherever possible.*/ class EST_DMatrix : public EST_TSimpleMatrix { private: public: /// size constructor EST_DMatrix(int m, int n):EST_TSimpleMatrix(m, n) {} /// copy constructor EST_DMatrix(const EST_DMatrix &a):EST_TSimpleMatrix(a) {} static EST_String default_file_type; /// CHECK - what does this do??? EST_DMatrix(const EST_DMatrix &a, int b); /// default constructor EST_DMatrix():EST_TSimpleMatrix() {} /// Save in file (ascii or binary) EST_write_status save(const EST_String &filename, const EST_String &type = EST_DMatrix::default_file_type); /// Load from file (ascii or binary as defined in file) EST_read_status load(const EST_String &filename); /// Save in file in est format EST_write_status est_save(const EST_String &filename, const EST_String &type); /// Load from file in est format (binary/ascii defined in file itself) EST_read_status est_load(const EST_String &filename); /// Copy 2-d array {\tt x} of size {\tt rows x cols} into matrix. void copyin(double **x, int rows, int cols); /// Add elements of 2 same sized matrices. EST_DMatrix &operator+=(const EST_DMatrix &a); /// Subtract elements of 2 same sized matrices. EST_DMatrix &operator-=(const EST_DMatrix &a); /// elementwise multiply by scalar EST_DMatrix &operator*=(const double f); /// elementwise divide by scalar EST_DMatrix &operator/=(const double f); /// Multiply all elements of matrix by {\tt x}. friend EST_DMatrix operator*(const EST_DMatrix &a, const double x); /// Multiply matrix by vector. friend EST_DVector operator*(const EST_DMatrix &a, const EST_DVector &v); /// Multiply vector by matrix friend EST_DVector operator*(const EST_DVector &v,const EST_DMatrix &a); /// Multiply matrix by matrix. friend EST_DMatrix operator*(const EST_DMatrix &a, const EST_DMatrix &b); }; /** A vector class for double precision floating point numbers. {\tt EST_DVector x} should be used instead of {\tt float *x} wherever possible. */ class EST_DVector: public EST_TSimpleVector { public: /// Size constructor. EST_DVector(int n): EST_TSimpleVector(n) {} /// Copy constructor. EST_DVector(const EST_DVector &a): EST_TSimpleVector(a) {} /// Default constructor. EST_DVector(): EST_TSimpleVector() {} /// elementwise multiply EST_DVector &operator*=(const EST_DVector &s); /// elementwise add EST_DVector &operator+=(const EST_DVector &s); /// elementwise multiply by scalar EST_DVector &operator*=(const double d); /// elementwise divide by scalar EST_DVector &operator/=(const double d); EST_write_status est_save(const EST_String &filename, const EST_String &type); /// save vector to file filename. EST_write_status save(const EST_String &filename, const EST_String &type); /// load vector from file filename. EST_read_status load(const EST_String &filename); /// Load from file in est format (binary/ascii defined in file itself) EST_read_status est_load(const EST_String &filename); }; int square(const EST_DMatrix &a); /// inverse int inverse(const EST_DMatrix &a, EST_DMatrix &inv); int inverse(const EST_DMatrix &a, EST_DMatrix &inv, int &singularity); /// pseudo inverse (for non-square matrices) int pseudo_inverse(const EST_DMatrix &a, EST_DMatrix &inv); int pseudo_inverse(const EST_DMatrix &a, EST_DMatrix &inv,int &singularity); /// some useful matrix creators /// make an identity matrix of dimension n void eye(EST_DMatrix &a, const int n); /// make already square matrix into I without resizing void eye(EST_DMatrix &a); /// the user should use est_seed to seed the random number generator void est_seed(); void est_seed48(); /// all elements are randomised void make_random_vector(EST_DVector &M, const double scale); /// all elements are randomised void make_random_matrix(EST_DMatrix &M, const double scale); /// used for variance void make_random_diagonal_matrix(EST_DMatrix &M, const double scale); /// used for covariance void make_random_symmetric_matrix(EST_DMatrix &M, const double scale); void make_poly_basis_function(EST_DMatrix &T, EST_DVector t); /// elementwise add EST_DVector add(const EST_DVector &a,const EST_DVector &b); /// elementwise subtract EST_DVector subtract(const EST_DVector &a,const EST_DVector &b); /// enforce symmetry void symmetrize(EST_DMatrix &a); /// stack columns on top of each other to make a vector void stack_matrix(const EST_DMatrix &M, EST_DVector &v); /// inplace diagonalise void inplace_diagonalise(EST_DMatrix &a); double determinant(const EST_DMatrix &a); /// not implemented ?? int singular(EST_DMatrix &a); /// exchange rows and columns void transpose(const EST_DMatrix &a,EST_DMatrix &b); EST_DMatrix triangulate(const EST_DMatrix &a); /// extract leading diagonal as a matrix EST_DMatrix diagonalise(const EST_DMatrix &a); /// extract leading diagonal as a vector EST_DVector diagonal(const EST_DMatrix &a); /// sum of elements double sum(const EST_DMatrix &a); void multiply(const EST_DMatrix &a, const EST_DMatrix &b, EST_DMatrix &c); int floor_matrix(EST_DMatrix &M, const double floor); /// matrix product of two vectors (#rows = length of first vector, #cols = length of second vector) EST_DMatrix cov_prod(const EST_DVector &v1,const EST_DVector &v2); EST_DMatrix operator*(const EST_DMatrix &a, const EST_DMatrix &b); EST_DMatrix operator-(const EST_DMatrix &a, const EST_DMatrix &b); EST_DMatrix operator+(const EST_DMatrix &a, const EST_DMatrix &b); EST_DVector operator-(const EST_DVector &a, const EST_DVector &b); EST_DVector operator+(const EST_DVector &a, const EST_DVector &b); EST_DMatrix sub(const EST_DMatrix &a, int row, int col); EST_DMatrix DMatrix_abs(const EST_DMatrix &a); EST_DMatrix row(const EST_DMatrix &a, int row); EST_DMatrix column(const EST_DMatrix &a, int col); /// least squares fit bool polynomial_fit(EST_DVector &x, EST_DVector &y, EST_DVector &co_effs, int order); /// weighted least squares fit bool polynomial_fit(EST_DVector &x, EST_DVector &y, EST_DVector &co_effs, EST_DVector &weights, int order); double polynomial_value(const EST_DVector &coeffs, const double x); /// vector dot product double operator*(const EST_DVector &v1, const EST_DVector &v2); #endif speech_tools/include/EST_types.h0000644000076400007640000001006307262605664015351 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* Type defines for Common Types */ /* */ /*=======================================================================*/ #ifndef __EST_TYPES_H__ #define __EST_TYPES_H__ #include "EST_TList.h" #include "EST_TVector.h" #include "EST_String.h" #include "EST_TKVL.h" #include "EST_FMatrix.h" #include "EST_DMatrix.h" #include "EST_IMatrix.h" #include "EST_SMatrix.h" typedef EST_TVector EST_StrVector; typedef EST_TSimpleVector EST_IVector; typedef EST_TSimpleVector EST_SVector; typedef EST_TSimpleVector EST_CVector; // DVector is an inherited TSimpleVector in EST_DMatrix.h // FVector is an inherited TSimpleVector in EST_FMatrix.h typedef EST_TList EST_IList; typedef EST_TList EST_FList; typedef EST_TList EST_DList; typedef EST_TKVL EST_II_KVL; typedef EST_TList > EST_IListList; typedef EST_TList EST_StrList; typedef EST_TList EST_IList; typedef EST_TList EST_FList; typedef EST_TList > EST_StrListList; typedef EST_TVector EST_StrListVector; typedef EST_TKVL EST_StrStr_KVL; typedef EST_TKVL EST_StrI_KVL; typedef EST_TKVL EST_StrF_KVL; typedef EST_TKVL EST_StrD_KVL; //typedef EST_TKVL EST_StrVal_KVL; #endif // __EST_TYPES_H__ speech_tools/include/EST_cmd_line.h0000644000076400007640000000636407262605664015770 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1994 */ /*-----------------------------------------------------------------------*/ /* Command line options */ /* */ /*=======================================================================*/ #ifndef __cmd_line_H__ #define __cmd_line_H__ #include "EST_String.h" #include "EST_Option.h" #include "EST_types.h" int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1); int init_lib_ops(EST_Option &al, EST_Option &options); void override_lib_ops(EST_Option &a_list, EST_Option &al); #endif /* __cmd_line_H__ */ speech_tools/include/EST.h0000644000076400007640000000660410127000720014103 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Paul Taylor, Simon King, Alan Black, Richard Caley */ /* Date : June 1994-March 1997 */ /*-----------------------------------------------------------------------*/ /* Edinburgh Speech Tools General Header File */ /* */ /*=======================================================================*/ #ifndef __EST_H__ #define __EST_H__ // Standard include files. #include "EST_system.h" #include using namespace std; #include "EST_String.h" #include "EST_string_aux.h" #include "EST_types.h" // Utilities #include "EST_util_class.h" #include "EST_cutils.h" #include "EST_io_aux.h" // Audio I/O #include "EST_audio.h" // Speech Classes #include "EST_speech_class.h" // Linguistic Classes #include "EST_ling_class.h" // Signal Processing #include "EST_sigpr.h" // Grammar #include "EST_grammar.h" // Stats #include "EST_stats.h" #endif /* __EST_H__ */ speech_tools/include/EST_IMatrix.h0000644000076400007640000000716307262605664015571 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1996 */ /* --------------------------------------------------------------------- */ /* Matrix class */ /* */ /*************************************************************************/ #ifndef __IMatrix_H__ #define __IMatrix_H__ #include "EST_TSimpleMatrix.h" #include "EST_TSimpleVector.h" /** A matrix class for integers. {\tt EST_IMatrix x} should be used instead of {\tt int **x} wherever possible. */ class EST_IMatrix: public EST_TSimpleMatrix { private: public: /// size constructor EST_IMatrix(int m, int n):EST_TSimpleMatrix(m, n) {} /// copy constructor EST_IMatrix(EST_IMatrix &a):EST_TSimpleMatrix(a) {} /// CHECK - what does this do??? EST_IMatrix(EST_IMatrix &a, int b); /// default constructor EST_IMatrix():EST_TSimpleMatrix() {} }; /// find largest element int matrix_max(const EST_IMatrix &a); #endif speech_tools/include/EST_SMatrix.h0000644000076400007640000000675507262605664015611 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1996 */ /* --------------------------------------------------------------------- */ /* Matrix class */ /* */ /*************************************************************************/ #ifndef __SMatrix_H__ #define __SMatrix_H__ #include "EST_TSimpleMatrix.h" #include "EST_TSimpleVector.h" class EST_SMatrix: public EST_TSimpleMatrix { private: public: /// size constructor EST_SMatrix(int m, int n):EST_TSimpleMatrix(m, n) {} /// copy constructor EST_SMatrix(EST_SMatrix &a):EST_TSimpleMatrix(a) {} /// CHECK - what does this do??? EST_SMatrix(EST_SMatrix &a, int b); /// default constructor EST_SMatrix():EST_TSimpleMatrix() {} int rateconv(int old_sr, int new_sr); }; #endif speech_tools/include/EST_sigpr.h0000644000076400007640000000545107262605664015336 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SIGPR_H__ #define __EST_SIGPR_H__ #include "EST_Wave.h" #include "EST_Track.h" #include "EST_FMatrix.h" #include "EST_Option.h" #include "EST_TNamedEnum.h" #include "EST_TBuffer.h" #include "sigpr/EST_filter.h" #include "sigpr/EST_pitchmark.h" #include "sigpr/EST_fft.h" #include "sigpr/EST_sigpr_utt.h" #include "sigpr/EST_sigpr_frame.h" #include "sigpr/EST_misc_sigpr.h" #endif /* __EST_SIGPR_H__ */ //@} speech_tools/include/EST_Event.h0000644000076400007640000001367607262605664015303 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Event class header file */ /* */ /*=======================================================================*/ // Warning: These event classes can be used as items in the EST_Stream // int he normal way. However, the EventSI class has internal pointers to // adjacent events which it uses to work out various parameters. Thus, // when making a EST_Stream of events, it is important to link the events // pointers as well. #ifndef __Event_H__ #define __Event_H__ #include #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (1) #endif class RFCelement{ float amp; float dur; float start_amp; float start_pos; EST_String type; }; class EventBase{ private: public: EST_String type; int save(EST_String filename, EST_String type = ""); }; class EventRFC: public EventBase{ public: void init() {rise_amp = 0.0; rise_dur = 0.0; start_amp =0.0; fall_amp = 0.0; fall_dur = 0.0; start_pos = 0.0; peak_pos = 0.0; type = ""; } float rise_amp; float rise_dur; float fall_amp; float fall_dur; float peak_pos; float start_amp; float start_pos; friend ostream& operator << (ostream& s, EventRFC &e) { s << e.type << " " << e.rise_amp << " " << e.rise_dur << " " << e.fall_amp << " " << e.fall_dur << " " << e.start_amp << " " << e.start_pos << endl; return s; } }; class EventSI: public EventBase { private: float s_f0; float s_pos; float p_f0; float p_pos; float e_pos; float e_f0; public: void init(); float amp(); float dur(); float rise_amp(); float rise_dur(); float fall_amp(); float fall_dur(); float start_f0(); float start_pos(); float peak_f0(); float peak_pos(); float end_f0(); float end_pos(); void set_start_f0(float a); void set_start_pos(float a); void set_peak_f0(float a); void set_peak_pos(float a); void set_end_f0(float a); void set_end_pos(float a); EventSI *sn; EventSI *sp; friend ostream& operator << (ostream& s, EventSI &e) { s << e.type << " ra:" << e.rise_amp() << " rd:" << e.rise_dur() << "fa: " << e.fall_amp() << " fd:" << e.fall_dur() << " sf0:" << e.start_f0() << " spos:" << e.start_pos() << " pf0:" << e.peak_f0() << " ppos:" << e.peak_pos() << " ef0:" << e.end_f0() << " epos:" << e.end_pos() << endl; return s; } }; class EventTilt: public EventBase{ private: float samp; float sdur; float stilt; float spos; float s_f0; float s_pos; public: void init(); float amp(); float dur(); float tilt(); float pos(); void set_amp(float a); void set_dur(float a); void set_tilt(float a); void set_pos(float a); float start_f0(); float start_pos(); void set_start_f0(float a); void set_start_pos(float a); friend ostream& operator << (ostream& s, EventTilt &e) { s << e.type << " " << e.amp() << " " << e.dur() << " " << e.tilt() << " " << e.pos() << " sf0 " << e.start_f0() << " " << e.start_pos() << endl; return s; } }; void gc_eventsi(void *w); void gc_eventtilt(void *w); void gc_eventrfc(void *w); #endif // __Event_H__ speech_tools/include/EST_tilt.h0000644000076400007640000001702610044502521015143 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1996 */ /*-----------------------------------------------------------------------*/ /* Intonational Event Include file */ /* */ /*=======================================================================*/ #ifndef __RFC_H__ #define __RFC_H__ #include "ling_class/EST_Relation.h" #include "EST_util_class.h" #include "EST_speech_class.h" #include "EST_Event.h" /**@name Tilt functions Functions for: Generating RFC and Tilt parameters from F0 contours Converting RFC to Tilt parameters and vice-versa Synthesizing F0 contours from RFC and Tilt events */ //@{ /** Fill op with sensible default parameters for RFC analysis. */ void default_rfc_params(EST_Features &op); /** Produce a set of RFC parameterized events given approximate event boundaries and a smoothed F0 contour. See for a description of this process. @param f0: Smoothed continuous F0 contour. An error will occur if any unvoiced regions are detected in the contour. Use the function smooth_pda to smooth and interpolate a normal contour. @param ev_list: list of events, each containing approximate start and end times of the events. On completion each event in this list will have a set of RFC parameters. @param op: parameters used to control analysis process. */ void rfc_analysis(EST_Track &fz, EST_Relation &event_list, EST_Features &op); /** Fill op with sensible default parameters for RFC analysis */ void tilt_analysis(EST_Track &fz, EST_Relation &event_list, EST_Features &op); /** Fill op with sensible default parameters for RFC analysis */ void fill_rise_fall_values(EST_Track &fz, float amp, float start_f0); /** Generate an F0 contour given a list RFC events. @param f0: Generated F0 contour @param ev_list: list of events, each containing a set of RFC parameters @param f_shift: frame shift in seconds of the generated contour @param no_conn: Do not join events with straight lines if set to 1 */ void rfc_synthesis(EST_Track &f0, EST_Relation &ev_list, float f_shift, int no_conn); /** Generate an F0 contour given a list Tilt events. This function simply calls \Ref{tilt_to_rfc} followed by \Ref{rfc_synthesis}. @param f0: Generated F0 contour @param ev_list: list of events, each containing a set of Tilt parameters @param f_shift: frame shift in seconds of the generated contour @param no_conn: Do not join events with straight lines if set to 1 */ void tilt_synthesis(EST_Track &track, EST_Relation &ev_list, float f_shift, int no_conn); /** Convert a single set of local tilt parameters to local RFC parameters. amp @param tilt: input tilt parameters, named amp, dur and tilt @param rfc: output RFC parameters, name rise_amp, fall_amp, rise_dur and fall_dur */ void tilt_to_rfc(EST_Features &tilt, EST_Features &rfc); /** Convert a single set of local RFC parameters to local tilt parameters. See for a description of how this is performed. @param rfc: input RFC parameters, named rise_amp, fall_amp, rise_dur and fall_dur @param tilt: output tilt parameters, named amp, dur and tilt */ void rfc_to_tilt(EST_Features &rfc, EST_Features &tilt); /** For each tilt events in ev_tilt, produce a set of RFC parameters. The tilt parameters are stored as the following features in the event: tilt.amp tilt.dur tilt.tilt A set of features with the following names are created: rfc.rise_amp rfc.rise_dur rfc.fall_amp rfc.fall_dur The original tilt features are not deleted. */ void tilt_to_rfc(EST_Relation &ev_tilt); /** For each tilt events in ev_rfc, produce a set of Tiltparameters. The RFC parameters are stored as the following features in the event: rfc.rise_amp rfc.rise_dur rfc.fall_amp rfc.fall_dur A set of features with the following names are created: tilt.amp tilt.dur tilt.tilt The original RFC features are not deleted. */ void rfc_to_tilt(EST_Relation &ev_rfc); int validate_rfc_stream(EST_Relation &ev); void fill_rfc_types(EST_Relation &ev); //@} #endif /* RFC */ speech_tools/include/EST_Track.h0000644000076400007640000006744310570320133015244 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Rewritten : Richard Caley */ /* ------------------------------------------------------------------- */ /* EST_Track Class header file */ /* */ /*************************************************************************/ class EST_Track; #ifndef __Track_H__ #define __Track_H__ #include "EST_FMatrix.h" #include "EST_types.h" #include "EST_TrackMap.h" #include "EST_ChannelType.h" #include "EST_Featured.h" typedef EST_TMatrix EST_ValMatrix; class EST_TokenStream; class EST_String; typedef enum EST_TrackFileType { tff_none=0, tff_ascii, tff_esps, tff_htk, tff_htk_fbank, tff_htk_mfcc, tff_htk_mfcc_e, tff_htk_user, tff_htk_discrete, tff_xmg, tff_xgraph, tff_ema, tff_ema_swapped, tff_NIST, tff_est_ascii, tff_est_binary, tff_snns, tff_ssff } EST_TrackFileType; typedef enum EST_InterpType { it_nearest, // nearest time point it_linear, // linerar interpolation it_linear_nz // .. unless one end near zero } EST_InterpType; /** A class for storing time aligned coefficients. some stuff. */ class EST_Track : public EST_Featured { protected: EST_FMatrix p_values; // float x array EST_FVector p_times; // float y array EST_CVector p_is_val; // for breaks and non-breaks EST_ValMatrix p_aux; // Auxiliary channels EST_StrVector p_aux_names; // Names of auxiliary channels float p_t_offset; // time shift. EST_TrackMap::P p_map; EST_StrVector p_channel_names; // name of each track bool p_equal_space; // fixed or variable frame rate bool p_single_break; // single break lots between data void default_vals(); void default_channel_names(); void clear_arrays(); void pad_breaks(); // put in extra breaks int interp_value(float x, float f); float interp_amp(float x, int c, float f); float estimate_shift(float x); void copy(const EST_Track& a); public: static const float default_frame_shift; static const int default_sample_rate; /**@name Constructor and Destructor functions */ //@{ /// Default constructor EST_Track(); /// Copy constructor EST_Track(const EST_Track &a); /// resizing constructor EST_Track(int num_frames, int num_channels); /// resizing constructor EST_Track(int num_frames, EST_StrList &map); /// default destructor ~EST_Track(); //@} /** @name Configuring Tracks */ //@{ /** resize the track to have {\tt num_frames} and {\tt num_channels}. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0 */ void resize(int num_frames, int num_channels, bool preserve = 1); /** resize the track to have {\tt num_frames} and {\tt num_channels}. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0 */ void resize(int num_frames, EST_StrList &map, bool preserve = 1); /** resize the track's auxiliary channels. */ void resize_aux(EST_StrList &map, bool preserve = 1); /** Change the number of channels while keeping the number of frames the same. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0 */ void set_num_channels(int n, bool preserve = 1) { resize(EST_CURRENT, n, preserve); } /** Change the number of frames while keeping the number of channels the same. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0 */ void set_num_frames(int n, bool preserve = 1) { resize(n, EST_CURRENT, preserve); } /// set the name of the channel. void set_channel_name(const EST_String &name, int channel); /// set the name of the auxiliary channel. void set_aux_channel_name(const EST_String &name, int channel); /// copy everything but data void copy_setup(const EST_Track& a); //@} /**@name Global track information */ //@{ /// name of track - redundant use access to features EST_String name() const { return f_String("name");} /// set name of track - redundant use access to features void set_name(const EST_String &n) {f_set("name",n);} //@} /**@name Functions for sub tracks, channels and frames. */ //@{ /** make {\tt fv} a window to frame {\tt n} in the track. */ void frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL) { p_values.row(fv, n, startf, nf); } /** make {\tt fv} a window to channel {\tt n} in the track. */ void channel(EST_FVector &cv, int n, int startf=0, int nf=EST_ALL) { p_values.column(cv, n, startf, nf); } /** make {\tt fv} a window to the named channel in the track. */ void channel(EST_FVector &cv, const char * name, int startf=0, int nf=EST_ALL); /** make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized. @param start_frame first frame at which sub-track starts @param nframes number of frames to be included in total @param start_channel first channel at which sub-track starts @param nframes number of channels to be included in total */ void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL); /** make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized. @param start_frame first frame at which sub-track starts @param nframes number of frames to be included in total @param start_channel_name name of channel at which sub-track starts @param end_channel_name name of channel at which sub-track stops */ void sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, int nchans=EST_ALL); /** make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized. @param start_frame first frame at which sub-track starts @param nframes number of frames to be included in total @param start_channel_name name of channel at which sub-track starts @param end_channel_name name of channel at which sub-track stops */ void sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, const EST_String &end_chan_name); /** make {\tt st} refer to a portion of the track. (const version) No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized. @param start_frame first frame at which sub-track starts @param nframes number of frames to be included in total @param start_channel first channel at which sub-track starts @param nframes number of channels to be included in total */ void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const { ((EST_Track *)this)->sub_track(st, start_frame, nframes, start_chan, nchans); } /** Copy contiguous portion of track into {\tt st}. Unlike the normal sub_track functions, this makes a completely new track. values written into this will not affect the main track and it can be resized. @param start_frame first frame at which sub-track starts @param nframes number of frames to be included in total @param start_channel first channel at which sub-track starts @param nframes number of channels to be included in total */ void copy_sub_track( EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const; void copy_sub_track_out( EST_Track &st, const EST_FVector& frame_times ) const; void copy_sub_track_out( EST_Track &st, const EST_IVector& frame_indices ) const; /** copy channel {\tt n} into pre-allocated buffer buf */ void copy_channel_out(int n, float *buf, int offset=0, int num=EST_ALL) const { p_values.copy_column(n, buf, offset, num); } /** copy channel {\tt n} into EST_FVector */ void copy_channel_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const { p_values.copy_column(n, f, offset, num); } /** copy frame {\tt n} into pre-allocated buffer buf */ void copy_frame_out(int n, float *buf, int offset=0, int num=EST_ALL) const {p_values.copy_row(n, buf, offset, num); } /** copy frame {\tt n} into EST_FVector */ void copy_frame_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const {p_values.copy_row(n, f, offset, num); } /** copy buf into pre-allocated channel n of track */ void copy_channel_in(int n, const float *buf, int offset=0, int num=EST_ALL) { p_values.set_column(n, buf, offset, num); } /** copy f into pre-allocated channel n of track */ void copy_channel_in(int n, const EST_FVector &f, int offset=0, int num=EST_ALL) { p_values.set_column(n, f, offset, num); } /** copy channel buf into pre-allocated channel n of track */ void copy_channel_in(int c, const EST_Track &from, int from_c, int from_offset=0, int offset=0, int num=EST_ALL) { p_values.set_column(c, from.p_values, from_c, from_offset, offset, num); } /** copy buf into frame n of track */ void copy_frame_in(int n, const float *buf, int offset=0, int num=EST_ALL) { p_values.set_row(n, buf, offset, num); } /** copy t into frame n of track */ void copy_frame_in(int n, const EST_FVector &t, int offset=0, int num=EST_ALL) { p_values.set_row(n, t, offset, num); } /** copy from into frame n of track */ void copy_frame_in(int i, const EST_Track &from, int from_f, int from_offset=0, int offset=0, int num=EST_ALL) { p_values.set_row(i, from.p_values, from_f, from_offset, offset, num); } //@} /**@name Channel information */ //@{ /** Return the position of channel {\tt name} if it exists, otherwise return -1. */ int channel_position(const char *name, int offset=0) const; /** Return the position of channel {\tt name} if it exists, otherwise return -1. */ int channel_position(EST_String name, int offset=0) const { return channel_position((const char *)name, offset); } /** Returns true if the track has a channel named {\tt name}, otherwise false. */ bool has_channel(const char *name) const { return channel_position(name) >=0; } /** Returns true if the track has a channel named {\tt name}, otherwise false. */ bool has_channel(EST_String name) const { return has_channel((const char *)name); } //@} /** @name Accessing amplitudes The following functions can be used to access to amplitude of the track at certain points. Most of these functions can be used for reading or writing to this point, thus tr.a(10, 5) = 10.3; can be used to set the 10th frame of the 5th channel and cout << tr.a(10, 5); can be used to print the same information. Most of these functions have a const equivalent for helping the compiler in read only operations. */ //@{ /** return amplitude of frame i, channel c.*/ float &a(int i, int c=0); float a(int i, int c=0) const; /** return amplitude of frame i, channel c with no bounds checking. */ float &a_no_check(int i, int c=0) { return p_values.a_no_check(i,c); } float a_no_check(int i, int c=0) const {return p_values.a_no_check(i,c);} /** return amplitude of point i, in the channel named name plus offset. If you have a track with say channels called F0 and voicing, you can access the 45th frame's F0 as t.a(45, "F0"); If there are 20 cepstral coefficients for each frame, the 5th can be accessed as t.a(45, "cepstrum", 5); */ float &a(int i, const char *name, int offset=0); float a(int i, const char *name, int offset=0) const { return ((EST_Track *)this)->a(i, name, offset); } float &a(int i, EST_String name, int offset=0) { return a(i, (const char *)name, offset); } float a(int i, EST_String name, int offset=0) const { return ((EST_Track *)this)->a(i, (const char *)name, offset); } /** return amplitude of time t, channel c. This can be used for reading or writing to this point. By default the nearest frame to this time is used. If {\tt interp} is set to {\tt it_linear}, linear interpolation is performed between the two amplitudes of the two frames either side of the time point to give an estimation of what the amplitude would have been at time {\tt t}. If {\tt interp} is set to {\tt it_linear_nz}, interpolation is as above, unless the time requested is off the end of a portion of track in which case the nearest amplitude is returned. */ float &a(float t, int c=0, EST_InterpType interp=it_nearest); float a(float t, int c=0, EST_InterpType interp=it_nearest) const { return ((EST_Track *)this)->a(t, c, interp); } /** return amplitude of frame i, channel c. */ float &operator() (int i, int c) { return a(i,c); } /** return amplitude of frame i, channel 0. */ float &operator() (int i) { return a(i,0); } float operator() (int i, int c) const { return a(i,c); } float operator() (int i) const { return a(i,0); } /** return amplitude of frame nearest time t, channel c. */ float &operator() (float t, int c) {return a(t,c); } /** return amplitude of frame nearest time t, channel 0. */ float &operator() (float t) {return a(t,0); } float operator() (float t, int c) const {return a(t,c); } float operator() (float t) const {return a(t,0); } //@} /** @name Timing */ //@{ /// return time position of frame i float &t(int i=0) { return p_times[i]; } float t(int i=0) const { return p_times(i); } /// return time of frame i in milli-seconds. float ms_t(int i) const { return p_times(i) * 1000.0; } /** set frame times to regular intervals of time {\tt t}. The {\tt start} parameter specifies the integer multiple of {\tt t} at which to start. For example, setting this to 0 will start at time 0.0 (The default means the first time value = {\tt t} */ void fill_time( float t, int start=1 ); /** set frame times to regular intervals of time {\tt t}. The {\tt start} parameter specifies the first time value. */ void fill_time( float t, float start ); /** fill time channel with times from another track */ void fill_time( const EST_Track &t ); /** fill all amplitudes with value {\tt v} */ void fill(float v) { p_values.fill(v); } /** resample track at this frame shift, specified in seconds. This can be used to change a variable frame spaced track into a fixed frame track, or to change the spacing of an existing evenly spaced track. */ void sample(float shift); /// REDO void change_type(float nshift, bool single_break); /** return an estimation of the frame spacing in seconds. This returns -1 if the track is not a fixed shift track */ float shift() const; /// return time of first value in track float start() const; /// return time of last value in track float end() const; //@} /** @name Auxiliary channels Auxiliary information is used to store information that goes along with frames, but which are not amplitudes and hence not appropriate for operations such as interpolation, smoothing etc. The aux() array is an array of EST_Vals which allows points to be int, float or a string. The following functions can be used to access to auxiliary track information. Most of these functions can be used for reading or writing to this point, thus tr.aux(10, "voicing") = 1; can be used to set the 10th frame of the "voicing" channel and cout << tr.a(10, "voicing"); can be used to print the same information. Most of these functions have a const equivalent for helping the compiler in read only operations. Auxiliary channels are usually accessed by name rather than numerical index. The names are set using the set_aux_channel_names() function. */ //@{ EST_Val &aux(int i, int c); EST_Val &aux(int i, int c) const; EST_Val &aux(int i, const char *name); EST_Val aux(int i, const char *name) const { return ((EST_Track *)this)->aux(i, name); } EST_Val &aux(int i, EST_String name) { return aux(i, (const char *)name); } EST_Val aux(int i, EST_String name) const { return ((EST_Track *)this)->aux(i, (const char *)name); } //@} /** @name File i/o functions */ //@{ /** Load a file called {\tt name} into the track. The load function attempts to automatically determine which file type is being loaded from the file's header. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function. For those file formats which don't contain provision for specifying an initial time (e.g. HTK, or ascii...), the {\tt startt} parameter may be specified. */ EST_read_status load(const EST_String name, float ishift = 0.0, float startt = 0.0); /** Load character data from an already opened tokenstream {\tt ts} into the track. The load function attempts to automatically determine which file type is being loaded from the file's header. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function For those file formats which don't contain provision for specifying an initial time (e.g. HTK, or ascii...), the {\tt startt} parameter may be specified. */ EST_read_status load(EST_TokenStream &ts, float ishift = 0.0, float startt = 0.0); /** Load a file called {\tt name} of format {\tt type} into the track. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function For those file formats which don't contain provision for specifying an initial time (e.g. HTK, or ascii...), the {\tt startt} parameter may be specified. */ EST_read_status load(const EST_String name, const EST_String type, float ishift = 0.0, float startt = 0.0 ); /** Save the track to a file {\tt name} of format {\tt type}. */ EST_write_status save(const EST_String name, const EST_String EST_filetype = ""); /** Save the track to a already opened file pointer{\tt FP} and write a file of format {\tt type}. */ EST_write_status save(FILE *fp, const EST_String EST_filetype = ""); //@} /** @name Utility functions */ //@{ /// returns true if no values are set in the frame int empty() const; /// set frame i to be a break void set_break(int i); /// set frame i to be a value void set_value(int i); /// return true if frame i is a value int val(int i) const; /// return true if frame i is a break int track_break(int i) const { return (p_is_val(i)); } /** starting at frame i, return the frame index of the first value frame before i. If frame i is a value, return i */ int prev_non_break(int i) const; /** starting at frame i, return the frame index of the first value frame after i. If frame i is a value, return i */ int next_non_break(int i) const; /// return the frame index nearest time t int index(float t) const; /// return the frame index before time t int index_below(float x) const; /// return number of frames in track int num_frames() const {return p_values.num_rows();} /// return number of frames in track int length() const { return num_frames(); } /// return number of channels in track int num_channels() const {return p_values.num_columns();} /// return number of auxiliary channels in track int num_aux_channels() const {return p_aux.num_columns();} void add_trailing_breaks(); void rm_trailing_breaks(); /** If the contour has multiple break values between sections containing values, reduce the break sections so that each has a single break only. */ void rm_excess_breaks(); /// return true if track has equal (i.e. fixed) frame spacing */ bool equal_space() const {return p_equal_space;} /**return true if track has only single breaks between value sections */ bool single_break() const {return p_single_break;} void set_equal_space(bool t) {p_equal_space = t;} void set_single_break(bool t) {p_single_break = t;} //@} EST_Track& operator = (const EST_Track& a); EST_Track& operator+=(const EST_Track &a); // add to existing track EST_Track& operator|=(const EST_Track &a); // add to existing track in parallel friend ostream& operator << (ostream& s, const EST_Track &tr); // Default constructor EST_Track(int num_frames, EST_TrackMap &map); // assign a known description to a track void assign_map(EST_TrackMap::P map); void assign_map(EST_TrackMap &map) { assign_map(&map); } // create a description for an unknown track void create_map(EST_ChannelNameMap &names); void create_map(void) { create_map(EST_default_channel_names); } EST_TrackMap::P map() const { return p_map; } int channel_position(EST_ChannelType type, int offset=0) const; // return amplitude of point i, channel type c (plus offset) float &a(int i, EST_ChannelType c, int offset=0); float a(int i, EST_ChannelType c, int offset=0) const { return ((EST_Track *)this)->a(i,c, offset); } // return amplitude at time t, channel type c float &a(float t, EST_ChannelType c, EST_InterpType interp=it_nearest); float a(float t, EST_ChannelType c, EST_InterpType interp=it_nearest) const { return ((EST_Track *)this)->a(t, c, interp); } float &operator() (int i, EST_ChannelType c) { return a(i,c); } float operator() (int i, EST_ChannelType c) const { return a(i,c); } float &t_offset() { return p_t_offset; } float t_offset() const { return p_t_offset; } EST_read_status load_channel_names(const EST_String name); EST_write_status save_channel_names(const EST_String name); const EST_String channel_name(int channel, const EST_ChannelNameMap &map, int strings_override=1) const; const EST_String channel_name(int channel, int strings_override=1) const { return channel_name(channel, EST_default_channel_names, strings_override); } const EST_String aux_channel_name(int channel) const { return p_aux_names(channel);} void resize(int num_frames, EST_TrackMap &map); EST_TrackFileType file_type() const {return (EST_TrackFileType)f_Int("file_type",0);} void set_file_type(EST_TrackFileType t) {f_set("file_type", (int)t);} bool has_channel(EST_ChannelType type) const { int cp = channel_position(type); return cp>=0; } // Frame iteration support protected: class IPointer_f { public: EST_Track *frame; int i; IPointer_f(); IPointer_f(const IPointer_f &p); ~IPointer_f(); }; void point_to_first(IPointer_f &ip) const { ip.i = 0; } void move_pointer_forwards(IPointer_f &ip) const { ip.i++; } bool points_to_something(const IPointer_f &ip) const { return ip.i ; friend class EST_TRwIterator< EST_Track, IPointer_f, EST_Track >; public: typedef EST_Track Entry; typedef EST_TIterator< EST_Track, IPointer_f, EST_Track > Entries; typedef EST_TRwIterator< EST_Track, IPointer_f, EST_Track > RwEntries; }; // list of tracks in serial typedef EST_TList EST_TrackList; #endif /* __Track_H__ */ speech_tools/include/EST_io_aux.h0000644000076400007640000000773307610565045015476 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* Utility IO Function header file */ /* */ /*=======================================================================*/ #ifndef __EST_IO_AUX_H__ #define __EST_IO_AUX_H__ #include "EST_unix.h" #include "EST_common.h" #include "EST_String.h" #include "EST_types.h" EST_String make_tmp_filename(); EST_String stdin_to_file(); int writable_file(char *filename); int readable_file(char *filename); inline int delete_file(const EST_String &filename) { // a little unnecessary to wrap this up like this -- except // if you want to be portable to weird OSs return (unlink(filename) == 0); // could do more with return codes from unlink ... } EST_String uncompress_file_to_temporary(const EST_String &filename,const EST_String &prog_name); int compress_file_in_place(const EST_String &filename, const EST_String &prog_name); int compress_file(const EST_String &filename, const EST_String &new_filename, const EST_String &prog_name); #define numeric_char(in) (((in < '9' ) && (in > '0')) ? TRUE : FALSE) #ifdef WIN32 #include "Winsock2.h" typedef SOCKET SOCKET_FD; #else typedef int SOCKET_FD; #endif int socket_receive_file(SOCKET_FD fd, const EST_String &filename); int socket_send_file(SOCKET_FD fd, const EST_String &filename); #endif /*__EST_IO_AUX_H__ */ speech_tools/include/EST_audio.h0000644000076400007640000000656210075606451015306 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1995 */ /*-----------------------------------------------------------------------*/ /* Audio i/o public interface functions */ /* */ /*=======================================================================*/ #ifndef __EST_AUDIO_H__ #define __EST_AUDIO_H__ #include "EST_Wave.h" #include "EST_Option.h" extern int nas_supported; extern int esd_supported; extern int sun16_supported; extern int freebsd16_supported; extern int linux16_supported; extern int mplayer_supported; extern int win32audio_supported; extern int os2audio_supported; extern int irix_supported; extern int macosx_supported; int play_wave(EST_Wave &wave, EST_Option &al); int record_wave(EST_Wave &wave, EST_Option &al); EST_String options_supported_audio(); #endif /* __EST_AUDIO_H__ */ speech_tools/include/EST_track_aux.h0000644000076400007640000002462510056153700016157 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name EST_track_aux.h * EST_Track Auxiliary functions * @author Paul Taylor * @version $Id: EST_track_aux.h,v 1.4 2004/05/24 11:15:51 korin Exp $ */ //@{ #ifndef __EST_TRACK_AUX_H__ #define __EST_TRACK_AUX_H__ #include "EST_FMatrix.h" #include "EST_TList.h" #include "ling_class/EST_Relation.h" #include "EST_Option.h" #include "EST_Track.h" #include "EST_TBuffer.h" void track_smooth(EST_Track &c, float x, EST_String stype = ""); void time_med_smooth(EST_Track &c, float x); void time_mean_smooth(EST_Track &c, float x); void simple_med_smooth(EST_Track &c, int n, int channel=0); void simple_mean_smooth(EST_Track &c, int n, int channel=0); /** Calculate the mean absolute error between the same channel in * two tracks. This is given by \[\frac{1}{n}\sum_{i=1}^{n}|a_{i} - b_{i}|\] * @see abs_error, rms_error(EST_Track &a, EST_Track &b) */ float abs_error(EST_Track &a, EST_Track &b, int channel); void absolute(EST_Track &tr); void normalise(EST_Track &tr); void normalise(EST_Track &tr, float mean, float sd, int channel, float upper, float lower); void normalise(EST_Track &tr, EST_FVector &mean, EST_FVector &sd, float upper, float lower); void normalise(EST_TrackList &trlist, EST_FVector &mean, EST_FVector &sd, float upper, float lower); /** Calculate the simple derivative of a track. This is given by * \[a_{i+1} - a_{i}\] The values in the resultant track are spaced * midway between the values in the input track, resulting in 1 fewer * frames in the track. This is a very local estimation of the derivative * of the track at a point in time. A smoother value can be obtained * using the delta function. * @see delta */ EST_Track differentiate(EST_Track &c, float samp_int=0.0); EST_Track difference(EST_Track &a, EST_Track &b); float mean( const EST_Track &a, int channel ); void mean( const EST_Track &a, EST_FVector &m ); void meansd(EST_Track &a, float &m, float &sd, int channel); /** Calculate the root mean square error between the same channel in * two tracks. The channel is identified by its index. * @see abs_error, float rms_error(EST_Track &a, EST_Track &b) */ float rms_error(EST_Track &a, EST_Track &b, int channel); float correlation(EST_Track &a, EST_Track &b, int channel); void meansd(EST_Track &a, EST_FVector &m, EST_FVector &sd); /** Calculate the root mean square error between each channels in two * tracks. For two tracks of M channels, the result is returned as an * EST_FVector of size M, with element {\it i} representing the * rms error for channel {\it i}. * @see abs_error, rms_error */ EST_FVector rms_error(EST_Track &a, EST_Track &b); EST_FVector abs_error(EST_Track &a, EST_Track &b); EST_FVector correlation(EST_Track &a, EST_Track &b); /// Move the start and end variables to the nearest frame. void align_to_track(EST_Track &tr, float &start, float &end); /// Move the start and end variables to the nearest frame. void align_to_track(EST_Track &tr, int &start, int &end, int sample_rate); /// Move the start and end variables to the start and end of the nearest frame. void move_to_frame_ends(EST_Track &tr, int &start, int &end, int sample_rate, float offset=0.0); /// Index of the frame whose start boundary int nearest_boundary(EST_Track &tr, float time, int sample_rate, float offset=0); /// Move the track so that it starts at the indicated time. void set_start(EST_Track &tr, float start); /// Move the track by {\it shift} seconds void move_start(EST_Track &tr, float shift); EST_Track error(EST_Track &ref, EST_Track &test, int relax= 0); void extract(EST_Track &orig, float start, float end, EST_Track &res); int track_divide(EST_TrackList &mtfr, EST_Track &fv, EST_Relation &key); void ParallelTracks(EST_Track &a, EST_TrackList &list,const EST_String &style); void track_info(EST_Track &track); EST_String options_track_filetypes(void); EST_String options_track_filetypes_long(void); EST_String options_subtrack(void); int read_track(EST_Track &tr, const EST_String &in_file, EST_Option &al); /** Return the frame size in {\bf seconds} based on analysis of current time points. This function basically determines the local frame size (shift) by subtracting the current time point from the next time point. If the {\tt prefer_prev} flag is set to {\tt true}, or the index is the last in the track, the size is determined by subtracting the previous time point from the current one. This is most commonly used in pitch synchronous analysis to determine the local pitch period. @see get_frame_size */ float get_time_frame_size(EST_Track &pms, int i, int prefer_prev = 0); /** Return the frame size in {\bf samples} based on analysis of current time points. This function basically determines the local frame size (shift) by subtracting the current time point from the next time point. If the {\tt prefer_prev} flag is set to {\tt true}, or the index is the last in the track, the size is determined by subtracting the previous time point from the current one. This is most commonly used in pitch synchronous analysis to determine the local pitch period. @see get_time_frame_size */ int get_frame_size(EST_Track &pms, int current_pos, int sample_rate, int prefer_prev=0); /// How many coefficients in track (looks for Coef0 and coefN channels) int get_order(const EST_Track &t, EST_CoefficientType type, int d=0); int get_order(const EST_Track &t); /// Total the length channel values. int sum_lengths(const EST_Track &t, int sample_rate, int start_frame=0, int end_frame=-1); /// Find the start point in the signal of the sections of speech related to each frame. void get_start_positions(const EST_Track &t, int sample_rate, EST_TBuffer &pos); /**@name Analysis frame position * Functions which define which part of a single is associated with a * given frame in a track. *

* This is defined here in one place for consistency. They are inline since * they tend to be used in inner loops. There are two versions, * the second for when there are offsets in the track. */ //@{ /// Get the start and end of a given frame (in samples) static inline void get_frame(const EST_Track &tr, int sample_rate, int f, int &start, int ¢er, int &end) { center = (int)(tr.t(f)*sample_rate + 0.5); start = center - (int)(tr.a(f, channel_length)/2.0); end = start + (int)(tr.a(f, channel_length)); } /// Get the start and end of a given frame (in seconds) static inline void get_frame(const EST_Track &tr, int sample_rate, int f, float &start, float ¢er, float &end) { center = tr.t(f); start = center - tr.a(f, channel_length)/(float)sample_rate/2.0; end = start + tr.a(f, channel_length)/(float)sample_rate; } /// Get the start and end of a given frame (in samples) static inline void get_frame_o(const EST_Track &tr, int sample_rate, int f, int &start, int ¢er, int &end) { center = (int)(tr.t(f)*sample_rate + tr.a(f,channel_offset) + 0.5); start = center - (int)(tr.a(f, channel_length)/2.0); end = start + (int)(tr.a(f, channel_length)); } /// Get the start and end of a given frame (in seconds) static inline void get_frame_o(const EST_Track &tr, int sample_rate, int f, float &start, float ¢er, float &end) { center = tr.t(f) + tr.a(f,channel_offset)/(float)sample_rate; start = center - tr.a(f, channel_length)/(float)sample_rate/2.0; end = start + tr.a(f, channel_length)/(float)sample_rate; } //@} // take one of the channels as the timeline void channel_to_time(EST_Track &tr, int channel, float scale=1.0); void channel_to_time(EST_Track &tr, EST_ChannelType c,float scale=1.0); void channel_to_time(EST_Track &tr, const EST_String c_name, float scale=1.0); void channel_to_time_lengths(EST_Track &tr, int channel, float scale=1.0); void channel_to_time_lengths(EST_Track &tr, EST_ChannelType c,float scale=1.0); void channel_to_time_lengths(EST_Track &tr, const EST_String c_name, float scale=1.0); /* Allow EST_Track to be used in an EST_Val */ VAL_REGISTER_CLASS_DCLS(track,EST_Track) #endif /* __EST_TRACK_AUX_H__ */ //@} speech_tools/include/EST_cluster.h0000644000076400007640000000737107262605664015676 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Clustering routines header file */ /* */ /*=======================================================================*/ #ifndef __Cluster_H__ #define __Cluster_H__ #include "EST_util_class.h" int load_names(EST_String file, EST_TList &names); float lowestval(EST_FMatrix &m, EST_TList &a, EST_TList &b); float highestval(EST_FMatrix &m, EST_TList &a, EST_TList &b); int fn_cluster(EST_FMatrix &m, float d); int nn_cluster(EST_FMatrix &m, float d); float nearest(EST_TList &cbk); void merge(EST_TList cbk[], int i, int j); typedef EST_TList > EST_CBK; EST_String print_codebook(EST_CBK &cbk, float d, EST_TList &names); EST_String print_codebook(EST_CBK &cbk, float d); int cluster(EST_FMatrix &m, EST_CBK &cbk, float d); void init_cluster(EST_CBK &cbk, int n); //EST_FVector sortvals(EST_FMatrix &m); int cluster(EST_FMatrix &m, EST_CBK &cbk, EST_TList &ans, EST_String method, EST_TList &x); EST_FVector sort_matrix(EST_FMatrix &m); #endif /* Cluster_h */ speech_tools/include/EST_multistats.h0000644000076400007640000001101711141751621016400 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Basic Multivariate Statistical Function Prototypes */ /* */ /*=======================================================================*/ #ifndef __Multistats_H__ #define __Multistats_H__ #include "EST_FMatrix.h" #include "EST_types.h" float mean(EST_FVector &m); EST_FVector mean(EST_FMatrix &m); EST_FVector sample_variance(EST_FMatrix &m); EST_FVector sample_stdev(EST_FMatrix &m); EST_FMatrix sample_covariance(EST_FMatrix &m); EST_FMatrix sample_correlation(EST_FMatrix &m); EST_FMatrix euclidean_distance(EST_FMatrix &m); EST_FMatrix penrose_distance(EST_FMatrix &m); EST_FMatrix normalise(EST_FMatrix &m, EST_FVector &sub, EST_FVector &div); EST_FMatrix penrose_distance(EST_FMatrix &gu, EST_FVector &gv); EST_FMatrix mahalanobis_distance(EST_FMatrix &gu, EST_FMatrix &v); EST_FMatrix population_mean(EST_FMatrix *in, int num_pop); EST_FMatrix add_populations(EST_FMatrix *in, int num_pop); EST_FMatrix confusion(EST_StrStr_KVL &list, EST_StrList &lex); void print_confusion(const EST_FMatrix &a, EST_StrStr_KVL &list, EST_StrList &lex); #define OLS_IGNORE 100 int ols(const EST_FMatrix &X,const EST_FMatrix &Y, EST_FMatrix &coeffs); int robust_ols(const EST_FMatrix &X, const EST_FMatrix &Y, EST_FMatrix &coeffs); int robust_ols(const EST_FMatrix &X, const EST_FMatrix &Y, EST_IVector &included, EST_FMatrix &coeffs); int stepwise_ols(const EST_FMatrix &X, const EST_FMatrix &Y, const EST_StrList &feat_names, float limit, EST_FMatrix &coeffs, const EST_FMatrix &Xtest, const EST_FMatrix &Ytest, EST_IVector &included); int ols_apply(const EST_FMatrix &samples, const EST_FMatrix &coeffs, EST_FMatrix &res); int ols_test(const EST_FMatrix &real, const EST_FMatrix &predicted, float &correlation, float &rmse); #endif // __Multistats_H__ speech_tools/include/EST_PST.h0000644000076400007640000001553507262605664014664 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* A general class for PredictionSuffixTrees */ /* */ /*=======================================================================*/ #ifndef __PredictionSuffixTree_H__ #define __PredictionSuffixTree_H__ #include "EST_simplestats.h" #include "EST_types.h" #include "EST_Features.h" class EST_PredictionSuffixTree_tree_node { private: protected: int p_level; int state; EST_DiscreteProbDistribution pd; EST_String path; /* context */ void delete_node(void *n) { if (n != 0) delete (EST_PredictionSuffixTree_tree_node *)n;} public: // EST_StringTrie nodes; // EST_TKVL nodes; EST_Features nodes; EST_PredictionSuffixTree_tree_node() {p_level=0;} ~EST_PredictionSuffixTree_tree_node(); void clear(void); const EST_String &get_path(void) const {return path;} void set_path(const EST_String &s) {path=s;} void set_level(int l) {p_level=l;} void set_state(int s) {state=s;} int get_state(void) const {return state;} int get_level(void) const {return p_level;} void cumulate(const EST_String &s,double count=1) {pd.cumulate(s,count);} void cumulate(const int i,double count=1) {pd.cumulate(i,count);} const EST_String &most_probable(double *p) const; const EST_DiscreteProbDistribution &prob_dist() const {return pd;} void print_freqs(ostream &os); void print_probs(ostream &os); }; VAL_REGISTER_CLASS_DCLS(pstnode,EST_PredictionSuffixTree_tree_node) class EST_PredictionSuffixTree { private: enum EST_filetype {PredictionSuffixTree_ascii, PredictionSuffixTree_binary}; protected: int p_order; int num_states; EST_PredictionSuffixTree_tree_node *nodes; EST_DiscreteProbDistribution *pd; // distribution of predictees const EST_String &ppredict(EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, double *prob, int *state, const int index=0) const; void p_accumulate(EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, double count, const int index=0); const EST_DiscreteProbDistribution &p_prob_dist( EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, const int index=0) const; public: EST_PredictionSuffixTree(); EST_PredictionSuffixTree(const int order) {init(order);} EST_PredictionSuffixTree(const EST_String filename); EST_PredictionSuffixTree(const EST_TList &vocab,int order=2); ~EST_PredictionSuffixTree(); void clear(void); void init(const int order); double samples() const { return pd->samples(); } int states() const { return num_states; } int order(void) const {return p_order;} void accumulate(const EST_StrVector &words,const double count=1,const int index=0); int load(const EST_String filename); int save(const EST_String filename,const EST_PredictionSuffixTree::EST_filetype type=PredictionSuffixTree_ascii); // build EST_PredictionSuffixTree from train data void build(const EST_String filename, const EST_String prev, const EST_String prev_prev, const EST_String last); void build(const EST_StrList &input); // to go void test(const EST_String filename); // test EST_PredictionSuffixTree against test data void print_freqs(ostream &os); void print_probs(ostream &os); const EST_String &predict(const EST_StrVector &words) const; const EST_String &predict(const EST_StrVector &words,double *prob) const; const EST_String &predict(const EST_StrVector &words,double *prob,int *state) const; const EST_DiscreteProbDistribution &prob_dist(const EST_StrVector &words) const {return p_prob_dist(nodes,words);} /* Reverse probability, given X what is prob of EST_PredictionSuffixTree Y */ double rev_prob(const EST_StrVector &words) const; double rev_prob(const EST_StrVector &words, const EST_DiscreteProbDistribution &pd) const; /* print frequency or probability models */ /* build model from file */ /* predict and measure success */ }; #endif // __PredictionSuffixTree_H__ speech_tools/include/EST_cutils.h0000644000076400007640000001143207262605664015511 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* Various C utility functions */ /* */ /*=======================================================================*/ #ifndef __EST_CUTILS_H__ #define __EST_CUTILS_H__ #include "EST_common.h" #ifdef __cplusplus extern "C" { #endif extern const char * const est_tools_version; extern const char * const est_name; extern const char * const est_libdir; extern const char * const est_ostype; #include "EST_walloc.h" #include "EST_system.h" #ifndef streq #define streq(X,Y) (strcmp(X,Y)==0) #endif char *cmake_tmp_filename(); /* NOTE perqs (from Three Rivers) have the third byte order, are not */ /* supported, if you find a working one let me know and I'll add */ /* support -- awb (hoping no one responds :-) */ enum EST_bo_t {bo_big, bo_little, bo_perq}; extern int est_endian_loc; /* Sun, HP, SGI Mips, M68000 */ #define EST_BIG_ENDIAN (((char *)&est_endian_loc)[0] == 0) /* Intel, Alpha, DEC Mips, Vax */ #define EST_LITTLE_ENDIAN (((char *)&est_endian_loc)[0] != 0) #define EST_NATIVE_BO (EST_BIG_ENDIAN ? bo_big : bo_little) #define EST_SWAPPED_BO (EST_BIG_ENDIAN ? bo_little : bo_big) #define SWAPINT(x) ((((unsigned)x) & 0xff) << 24 | \ (((unsigned)x) & 0xff00) << 8 | \ (((unsigned)x) & 0xff0000) >> 8 | \ (((unsigned)x) & 0xff000000) >> 24) #define SWAPSHORT(x) ((((unsigned)x) & 0xff) << 8 | \ (((unsigned)x) & 0xff00) >> 8) void swapdouble(double *d); void swapfloat(float *f); void swap_bytes_ushort(unsigned short *data, int length); void swap_bytes_short(short *data, int length); void swap_bytes_uint(unsigned int *data, int length); void swap_bytes_int(int *data, int length); void swap_bytes_float(float *data, int length); void swap_bytes_double(double *data, int length); enum EST_bo_t str_to_bo(const char *boname); const char *bo_to_str(enum EST_bo_t bo); /* return the greater of the two values */ #define Gof(a, b) (((a) > (b)) ? (a) : (b)) /* return the lesser of the two values */ #define Lof(a, b) (((a) < (b)) ? (a) : (b)) #ifdef __cplusplus } #endif #endif /*__EST_CUTILS_H__ */ speech_tools/include/EST_walloc.h0000644000076400007640000000654010272177324015463 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* Safe(-er) allocation functions. */ /* */ /*=======================================================================*/ #if !defined(__EST_WALLOC_H__) #if defined(__cplusplus) extern "C" { #endif void *safe_walloc(int size); void *safe_wcalloc(int size); void *safe_wrealloc(void *ptr, int size); #define walloc(TYPE,SIZE) ((TYPE *)safe_walloc(sizeof(TYPE)*(SIZE))) #define wcalloc(TYPE,SIZE) ((TYPE *)safe_wcalloc(sizeof(TYPE)*(SIZE))) #define wrealloc(PTR,TYPE,SIZE) ((TYPE *)safe_wrealloc((void *)(PTR), sizeof(TYPE)*(SIZE))) char *wstrdup(const char *s); void wfree(void *p); void debug_memory_summary(); #if defined(__cplusplus) } #endif #endif speech_tools/include/EST_math.h0000644000076400007640000001447411461104305015126 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : August 1996 */ /*-----------------------------------------------------------------------*/ /* OS system dependent math routines */ /* You may use this instead of math.h to get a system independent */ /* interface to the math functions (or include in addition, it's up to */ /* you) */ /*=======================================================================*/ #ifndef __EST_MATH_H__ #define __EST_MATH_H__ #if defined(__APPLE__) /* Not sure why I need this here, but I do */ extern "C" int isnan(double); #endif /* this isn't included from c, but just to be safe... */ #ifdef __cplusplus #include #include #include #else #include #include #include #endif using namespace std; #ifdef __cplusplus extern "C" { #endif /* Although isnan(double) exists on all machine isnanf(float) does not */ /* Automatic conversion between floats to doubles for out of range */ /* values in ANSI is undefined so we can't depend on that, but I */ /* Solaris 2.X and SGIs IRIX*/ #if defined(__svr4__) || defined(__SYSTYPE_SVR4__) #include #endif /* SunOS 4.1.X */ /* It doesn't exist on SunOS. One could use the macro that Solaris uses */ /* but I can't including it here, besides the follow will almost definitely */ /* have the same effect */ /* The defines are of course heuristics, this fails for NetBSD */ #if defined(__sun__) && defined(__sparc__) && !defined(__svr4__) #define isnanf(X) isnan(X) #endif /* Linux (and presumably Hurd too as Linux is GNU libc based) */ /* Sorry I haven't confirmed this cpp symbol yet */ #if defined(linux) #define isnanf(X) __isnanf(X) #endif /* OS/2 with gcc EMX */ #if defined(__EMX__) #define isnanf(X) isnan(X) #define finite(X) isfinite(X) #endif /* AIX */ #if defined(_AIX) #define isnanf(X) isnan(X) #endif /* Apple OSX */ #if defined(__APPLE__) #define isnanf(X) isnan((double)(X)) /* on some previous versions of OSX we seemed to need the following */ /* but not on 10.4 */ /* #define isnan(X) __isnan(X) */ #endif /* FreeBSD *and other 4.4 based systems require anything, isnanf is defined */ #if defined(__FreeBSD__) #endif /* Cygwin (at least cygwin 1.7 with gcc 4.3.4) */ #if defined(__CYGWIN__) #if __GNUG__ > 3 #define isnanf(X) isnan(X) #endif #endif /* WIN32 has stupid names for things */ #if defined(SYSTEM_IS_WIN32) #define finite(X) _finite(X) #define round(X) win32_round(X) inline double win32_round(double d) { return (d>0.0)?floor(d+0.5):ceil(d-0.5);} #endif /* These are making assumptions about the under lying architecture */ /* that could be wrong (though most probably in a conservative way) */ #ifndef MAXFLOAT #define MAXFLOAT ((float)3.0e+37) #endif #ifndef FLT_MAX #define FLT_MAX ((float)3.0e+37) #endif #ifndef MINFLOAT #define MINFLOAT ((float)1e-37) #endif #ifndef FLT_MAX #define FLT_MIN ((float)1e-37) #endif #ifndef PI #define PI 3.14159265358979323846 #endif #ifndef M_PI #define M_PI PI #endif #ifndef RAND_MAX #define RAND_MAX 32767 #endif #define SAFE_LOG_ZERO -9538 #define EST_NINT(X) ((int)((X)+0.5)) inline double safe_log(const double x) { double l; if (x == 0) return SAFE_LOG_ZERO; l=log(x); if (l * @author (regular expression library by Henry Spencer, University of Toronto) * @version $Id: EST_Regex.h,v 1.3 2004/05/04 00:00:16 awb Exp $ */ class EST_Regex : protected EST_String { private: /// The compiled form. void *compiled; /// Compiled form for whole string match. void *compiled_match; protected: /// Compile expression. void compile(); /// Compile expression in a form which only matches whole string. void compile_match(); /// Translate the expression into the internally used syntax. char *regularize(int match) const; public: /// Empty constructor, just for form. EST_Regex(void); /// Construct from EST_String. EST_Regex(EST_String s); /// Construct from C string. EST_Regex(const char *ex); /// Copy constructor. EST_Regex(const EST_Regex &ex); /// Destructor. ~EST_Regex(); /// Size of the expression. int size() const { return EST_String::size; }; /// Run to find a matching substring int run(const char *on, int from, int &start, int &end, int *starts=NULL, int *ends=NULL); /// Run to see if it matches the entire string. int run_match(const char *on, int from=0, int *starts=NULL, int *ends=NULL); /// Get the expression as a string. EST_String tostring(void) const {return (*this);}; /// Cast operator, disambiguates it for some compilers operator const char *() const { return (const char *)tostring(); } int operator == (const EST_Regex ex) const { return (const EST_String)*this == (const EST_String)ex; } int operator != (const EST_Regex ex) const { return (const EST_String)*this != (const EST_String)ex; } /**@name Assignment */ //@{ /// EST_Regex &operator = (const EST_Regex ex); /// EST_Regex &operator = (const EST_String s); /// EST_Regex &operator = (const char *s); //@} /// Stream output of regular expression. friend ostream &operator << (ostream &s, const EST_Regex &str); }; ostream &operator << (ostream &s, const EST_Regex &str); /**@name Predefined_regular_expressions * Some regular expressions matching common things are predefined */ //@{ /// White space extern EST_Regex RXwhite; // "[ \n\t\r]+" /// Sequence of alphabetic characters. extern EST_Regex RXalpha; // "[A-Za-z]+" /// Sequence of lower case alphabetic characters. extern EST_Regex RXlowercase; // "[a-z]+" /// Sequence of upper case alphabetic characters. extern EST_Regex RXuppercase; // "[A-Z]+" /// Sequence of letters and/or digits. extern EST_Regex RXalphanum; // "[0-9A-Za-z]+" /// Initial letter or underscore followed by letters underscores or digits. extern EST_Regex RXidentifier; // "[A-Za-z_][0-9A-Za-z_]+" /// Integer. extern EST_Regex RXint; // "-?[0-9]+" /// Floating point number. extern EST_Regex RXdouble; // "-?\\(\\([0-9]+\\.[0-9]*\\)\\|\\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)\\([eE][---+]?[0-9]+\\)?" //@} // GCC lets us use the static constant to declare arrays, Sun CC // doesn't, so for a quiet, if ugly, life we declare it here with a suitable // value and check in EST_Regex.cc to make sure it`s OK #define EST_Regex_max_subexpressions 10 #endif speech_tools/include/EST_String.h0000644000076400007640000005553511223436124015451 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_STRING_H__ #define __EST_STRING_H__ class EST_String; class EST_Regex; #define EST_Regex_max_subexpressions 10 #include #include #include using namespace std; #include "EST_Chunk.h" #include "EST_strcasecmp.h" #include "EST_bool.h" extern "C" void abort(void); /** A non-copyleft implementation of a string class to use with * compilers that aren't GNU C++. * * Strings are reference-counted and reasonably efficient (eg you * can pass them around, into and out of functions and so on * without worrying too much about the cost). * * The associated class EST_Regex can be used to represent regular * expressions. * * @see EST_Chunk * @see EST_Regex * @see string_example * @author Alan W Black * @author Richard Caley * @version $Id: EST_String.h,v 1.7 2009/07/03 17:13:56 awb Exp $ */ class EST_String { /** For better libg++ compatibility. * * Includes String from char constructor which * tends to mask errors in use. Also reverses the () and [] operators. */ # define __FSF_COMPATIBILITY__ (0) /** Allow gsub() to be used in multi-threaded applications * This will cause gsub to use a local table of substitution points * walloced for each gsub. Otherwise one global one is used which * should be faster, but non reentrant. */ # define __GSUB_REENTRANT__ (1) /// Gripe about weird arguments like Nulls #define __STRING_ARG_GRIPE__ (1) /// When we find something to gripe about we die then and there. #define __GRIPE_FATAL__ (1) #if __GRIPE_FATAL__ # define gripe(WHAT) (cerr<< ("oops! " WHAT "\n"),abort()) #else # define gripe(WHAT) (cerr<< ("oops! " WHAT "\n")) #endif #if __STRING_ARG_GRIPE__ # define safe_strlen(S) ((S)?strlen(S):(gripe("null strlen"),0)) # define CHECK_STRING_ARG(S) if (!(S)) gripe("null string arg") #else # define safe_strlen(S) ((S)?strlen(S):0) # define CHECK_STRING_ARG(S) /* empty */ #endif public: /// Global version string. static const char *version; /// Constant empty string static const EST_String Empty; /// Type of string size field. typedef int EST_string_size; /// Maximum string size. # define MAX_STRING_SIZE (INT_MAX) private: /// Smart pointer to actual memory. EST_ChunkPtr memory; /// Size of string. EST_string_size size; // Make sure this is exactly the same as an EST_String. This is being too // clever by half. struct EST_dumb_string { EST_ChunkPtr memory; EST_string_size size; } ; /// Flags indicating which bit of a string to extract. enum EST_chop_direction { Chop_Before = -1, Chop_At = 0, Chop_After = 1 }; /// Simple utility which removes const-ness from memory static inline EST_ChunkPtr &NON_CONST_CHUNKPTR(const EST_ChunkPtr &ecp) { return *((EST_ChunkPtr *)&ecp);} /// private constructor which uses the buffer given. EST_String(int len, EST_ChunkPtr cp) { size=len; memory = cp; } /// Is more than one String represented by the same memory? int shareing (void) { return memory.shareing();} /**@name Finding substrings */ //@{ /// Find substring int locate(const char *it, int len, int from, int &start, int &end) const; /// Find substring int locate(const EST_String &s, int from, int &start, int &end) const { return locate((const char *)s.memory, s.size, from, start, end); } /// Find match for regexp. int locate(EST_Regex &ex, int from, int &start, int &end, int *starts=NULL, int *ends=NULL) const; //@} /**@name Extract Substrings */ //@{ int extract(const char *it, int len, int from, int &start, int &end) const; int extract(const EST_String &s, int from, int &start, int &end) const { return extract((const char *)s.memory, s.size, from, start, end); } int extract(EST_Regex &ex, int from, int &start, int &end) const; //@} /**@name Chop out part of string */ //@{ /// Locate subsring and chop. EST_String chop_internal(const char *s, int length, int pos, EST_chop_direction directionult) const; /// Chop at given position. EST_String chop_internal(int pos, int length, EST_chop_direction directionult) const; /// Locate match for expression and chop. EST_String chop_internal(EST_Regex &ex, int pos, EST_chop_direction directionult) const; //@} /**@name Global search and replace */ //@{ /// Substitute for string int gsub_internal(const char *os, int olength, const char *s, int length); /// Substitute for matches of regexp. int gsub_internal(EST_Regex &ex, const char *s, int length); //@} /// Split the string down into parts. int split_internal(EST_String result[], int max, const char* s_seperator, int slen, EST_Regex *re_separator, char quote) const; int Int(bool *ok_p) const; long Long(bool *ok_p) const; float Float(bool *ok_p) const; double Double(bool *ok_p) const; public: /// Construct an empty string. EST_String(void) :memory() {size=0;} /// Construct from char * EST_String(const char *s); /// Construct from part of char * or fill with given character. EST_String(const char *s, int start_or_fill, int len); /// Construct from C string. EST_String(const char *s, int s_size, int start, int len); // Create from EST_String EST_String(const EST_String &s, int start, int len); /** Copy constructor * We have to declare our own copy constructor to lie to the * compiler about the constness of the RHS. */ EST_String(const EST_String &s) { memory = NON_CONST_CHUNKPTR(s.memory); size = s.size; } #if __FSF_COMPATIBILITY__ /** Construct from single char. * This constructor is not usually included as it can mask errors. * @see __FSF_COMPATIBILITY__ */ EST_String(const char c); #endif /// Destructor. ~EST_String() { size=0; memory=NULL; } /// Length of string ({\em not} length of underlying chunk) int length(void) const { return size; } /// Size of underlying chunk. int space (void) const { return memory.size(); } /// Get a const-pointer to the actual memory. const char *str(void) const { return size==0?"":(const char *)memory; } /// Get a writable pointer to the actual memory. char *updatable_str(void) { return size==0?(char *)"":(char *)memory; } void make_updatable(void) { cp_make_updatable(memory, size+1);} /// Build string from a single character. static EST_String FromChar(const char c) { const char s[2] = { c, 0 }; return EST_String(s); } /// Build string from an integer. static EST_String Number(int i, int base=10); /// Build string from a long integer. static EST_String Number(long i, int base=10); /// Build string from a double. static EST_String Number(double d); /// Build string from a float static EST_String Number(float f); /// Convert to an integer int Int(bool &ok) const { return Int(&ok); } int Int(void) const { return Int((bool *)NULL); } /// Convert to a long long Long(bool &ok) const { return Long(&ok); } long Long(void) const { return Long((bool *)NULL); } /// Convert to a float float Float(bool &ok) const { return Float(&ok); } float Float(void) const { return Float((bool *)NULL); } /// Convert to a double double Double(bool &ok) const { return Double(&ok); } double Double(void) const { return Double((bool *)NULL); } /**@name Before */ //@{ /// Part before position EST_String before(int pos, int len=0) const { return chop_internal(pos, len, Chop_Before); } /// Part before first matching substring after pos. EST_String before(const char *s, int pos=0) const { return chop_internal(s, safe_strlen(s), pos, Chop_Before); } /// Part before first matching substring after pos. EST_String before(const EST_String &s, int pos=0) const { return chop_internal(s.str(), s.size, pos, Chop_Before); } /// Part before first match of regexp after pos. EST_String before(EST_Regex &e, int pos=0) const { return chop_internal(e, pos, Chop_Before); } //@} /**@name At */ //@{ /// Return part at position EST_String at(int from, int len=0) const { return EST_String(str(),size,from<0?(size+from):from,len); } /// Return part where substring found (not useful, included for completeness) EST_String at(const char *s, int pos=0) const { return chop_internal(s, safe_strlen(s), pos, Chop_At); } /// Return part where substring found (not useful, included for completeness) EST_String at(const EST_String &s, int pos=0) const { return chop_internal(s.str(), s.size, pos, Chop_At); } /// Return part matching regexp. EST_String at(EST_Regex &e, int pos=0) const { return chop_internal(e, pos, Chop_At); } //@} /**@name After */ //@{ /// Part after pos+len EST_String after(int pos, int len=1) const { return chop_internal(pos, len, Chop_After); } /// Part after substring. EST_String after(const char *s, int pos=0) const { return chop_internal(s, safe_strlen(s), pos, Chop_After); } /// Part after substring. EST_String after(const EST_String &s, int pos=0) const { return chop_internal(s.str(), s.size, pos, Chop_After); } /// Part after match of regular expression. EST_String after(EST_Regex &e, int pos=0) const { return chop_internal(e, pos, Chop_After); } //@} /**@name Search for something */ //@{ /// Find a substring. int search(const char *s, int len, int &mlen, int pos=0) const { int start, end; if (locate(s, len, pos, start, end)) { mlen=end-start; return start; } return -1; } /// Find a substring. int search(const EST_String s, int &mlen, int pos=0) const { int start, end; if (locate(s, pos, start, end)) { mlen=end-start; return start; } return -1; } /// Find a match of the regular expression. int search(EST_Regex &re, int &mlen, int pos=0, int *starts=NULL, int *ends=NULL) const { int start=0, end=0; if (locate(re, pos, start, end, starts, ends)) { mlen=end-start; return start; } return -1; } //@} /**@name Get position of something */ //@{ /// Position of substring (starting at pos) int index(const char *s, int pos=0) const { int start, end; return locate(s, safe_strlen(s), pos, start, end)?start:-1; } /// Position of substring (starting at pos) int index(const EST_String &s, int pos=0) const { int start, end; return locate(s, pos, start, end)?start:-1; } /// Position of match of regexp (starting at pos) int index(EST_Regex &ex, int pos=0) const { int start, end; return locate(ex, pos, start, end)?start:-1; } //@} /**@name Does string contain something? */ //@{ /// Does it contain this substring? int contains(const char *s, int pos=-1) const { int start, end; return extract(s, safe_strlen(s), pos, start, end); } /// Does it contain this substring? int contains(const EST_String &s, int pos=-1) const { int start, end; return extract(s, pos, start, end); } /// Does it contain this character? int contains(const char c, int pos=-1) const { int start, end; char s[2] = {c,0}; return extract(s, 1, pos, start, end); } /// Does it contain a match for this regular expression? int contains(EST_Regex &ex, int pos=-1) const { int start, end; return extract(ex, pos, start, end); } //@} /**@name Does string exactly match? */ //@{ /// Exactly match this string? int matches(const char *e, int pos=0) const; /// Exactly match this string? int matches(const EST_String &e, int pos=0) const; /// Exactly matches this regular expression, can return ends of sub-expressions. int matches(EST_Regex &e, int pos=0, int *starts=NULL, int *ends=NULL) const; //@} /**@name Global replacement */ //@{ /// Substitute one string for another. int gsub(const char *os, const EST_String &s) { return gsub_internal(os, safe_strlen(os), s, s.size); } /// Substitute one string for another. int gsub(const char *os, const char *s) { return gsub_internal(os, safe_strlen(os), s, safe_strlen(s)); } /// Substitute one string for another. int gsub(const EST_String &os, const EST_String &s) { return gsub_internal(os, os.size, s, s.size); } /// Substitute one string for another. int gsub(const EST_String &os, const char *s) { return gsub_internal(os, os.size, s, safe_strlen(s)); } /// Substitute string for matches of regular expression. int gsub(EST_Regex &ex, const EST_String &s) { return gsub_internal(ex, s, s.size); } /// Substitute string for matches of regular expression. int gsub(EST_Regex &ex, const char *s) { return gsub_internal(ex, s, safe_strlen(s)); } /// Substitute string for matches of regular expression. int gsub(EST_Regex &ex, int bracket_num) { return gsub_internal(ex, NULL, bracket_num); } /// Substitute the result of a match into a string. int subst(EST_String source, int (&starts)[EST_Regex_max_subexpressions], int (&ends)[EST_Regex_max_subexpressions]); //@} /**@name Frequency counts */ //@{ /// Number of occurrences of substring int freq(const char *s) const; /// Number of occurrences of substring int freq(const EST_String &s) const; /// Number of matches of regular expression. int freq(EST_Regex &s) const; //@} /**@name Quoting */ //@{ /// Return the string in quotes with internal quotes protected. EST_String quote(const char quotec) const; /// Return in quotes if there is something to protect (e.g. spaces) EST_String quote_if_needed(const char quotec) const; /// Remove quotes and unprotect internal quotes. EST_String unquote(const char quotec) const; /// Remove quotes if any. EST_String unquote_if_needed(const char quotec) const; //@} #if __FSF_COMPATIBILITY__ const char operator [] (int i) const { return memory[i]; } char &operator () (int i) { return memory(i); } #else /**@name Operators */ //@{ /// Function style access to constant strings. const char operator () (int i) const { return memory[i]; } /// Array style access to writable strings. char &operator [] (int i) { return memory(i); } #endif /// Cast to const char * by simply giving access to pointer. operator const char*() const {return str(); } operator const char*() {return str(); } /// Cast to char *, may involve copying. operator char*() { return updatable_str(); } /**@name Add to end of string. */ //@{ /// Add C string to end of EST_String EST_String &operator += (const char *b); /// Add EST_String to end of EST_String EST_String &operator += (const EST_String b); //@} /**@name Assignment */ //@{ /// Assign C string to EST_String EST_String &operator = (const char *str); /// Assign single character to EST_String EST_String &operator = (const char c); /// Assign EST_String to EST_String. EST_String &operator = (const EST_String &s); //@} /**@name Concatenation */ //@{ /// Concatenate two EST_Strings friend EST_String operator + (const EST_String &a, const EST_String &b); /// Concatenate C String with EST_String friend EST_String operator + (const char *a, const EST_String &b); /// Concatenate EST_String with C String friend EST_String operator + (const EST_String &a, const char *b); //@} /// Repeat string N times friend EST_String operator * (const EST_String &s, int n); /**@name relational operators */ //@{ /// friend int operator == (const char *a, const EST_String &b); /// friend int operator == (const EST_String &a, const char *b) { return b == a; } /// friend int operator == (const EST_String &a, const EST_String &b); /// friend int operator != (const char *a, const EST_String &b) { return !(a==b); } /// friend int operator != (const EST_String &a, const char *b) { return !(a==b); } /// friend int operator != (const EST_String &a, const EST_String &b) { return !(a==b); } /// friend inline int operator < (const char *a, const EST_String &b) { return compare(a,b) < 0; } /// friend inline int operator < (const EST_String &a, const char *b) { return compare(a,b) < 0; } /// friend inline int operator < (const EST_String &a, const EST_String &b) { return compare(a,b) < 0; } /// friend inline int operator > (const char *a, const EST_String &b) { return compare(a,b) > 0; } /// friend inline int operator > (const EST_String &a, const char *b) { return compare(a,b) > 0; } /// friend inline int operator > (const EST_String &a, const EST_String &b) { return compare(a,b) > 0; } /// friend inline int operator <= (const char *a, const EST_String &b) { return compare(a,b) <= 0; } /// friend inline int operator <= (const EST_String &a, const char *b) { return compare(a,b) <= 0; } /// friend inline int operator <= (const EST_String &a, const EST_String &b) { return compare(a,b) <= 0; } /// friend inline int operator >= (const char *a, const EST_String &b) { return compare(a,b) >= 0; } /// friend inline int operator >= (const EST_String &a, const char *b) { return compare(a,b) >= 0; } /// friend inline int operator >= (const EST_String &a, const EST_String &b) { return compare(a,b) >= 0; } //@} //@} /**@name String comparison. * All these operators return -1, 0 or 1 to indicate the sort * order of the strings. */ //@{ /// friend int compare(const EST_String &a, const EST_String &b); /// friend int compare(const EST_String &a, const char *b); /// friend inline int compare(const char *a, const EST_String &b) { return -compare(b,a); } /** Case folded comparison. * * The table argument can defined how upper and lower * case characters correspond. The default works for * ASCII. */ //@{ friend int fcompare(const EST_String &a, const EST_String &b, const unsigned char *table=NULL); friend int fcompare(const EST_String &a, const char *b, const unsigned char *table=NULL); /// friend inline int fcompare(const EST_String &a, const EST_String &b, const EST_String &table) { return fcompare(a, b, (const unsigned char *)(const char *)table); } //@} //@} //@} /**@name Split a string into parts. * * These functions divide up a string producing an array of * substrings. */ //@{ /// Split at a given separator. friend int split(const EST_String & s, EST_String result[], int max, const EST_String& seperator, char quote=0) { return s.split_internal(result, max, (const char *)seperator, seperator.length(), NULL, quote); } /// Split at a given separator. friend int split(const EST_String &s, EST_String result[], int max, const char *seperator, char quote=0) { return s.split_internal(result, max, seperator, strlen(seperator), NULL, quote); } /// Split at each match of the regular expression. friend int split(const EST_String & s, EST_String result[], int max, EST_Regex& seperator, char quote=0) { return s.split_internal(result, max, NULL, 0, &seperator, quote); } //@} /// Convert to upper case. friend EST_String upcase(const EST_String &s); /// Convert to lower case. friend EST_String downcase(const EST_String &s); /** Concatenate a number of strings. * This is more efficient than multiple uses of + or += */ static EST_String cat(const EST_String s1, const EST_String s2 = Empty, const EST_String s3 = Empty, const EST_String s4 = Empty, const EST_String s5 = Empty, const EST_String s6 = Empty, const EST_String s7 = Empty, const EST_String s8 = Empty, const EST_String s9 = Empty ); /* Hacky way to ignore volatile */ EST_String & ignore_volatile(void) volatile { return *((EST_String *)(void *)this); } /// Stream output for EST_String. friend ostream &operator << (ostream &s, const EST_String &str); friend class EST_Regex; }; EST_ChunkPtr chunk_allocate(int bytes); EST_ChunkPtr chunk_allocate(int bytes, const char *initial, int initial_len); EST_ChunkPtr chunk_allocate(int bytes, const EST_ChunkPtr &initial, int initial_start, int initial_len); int operator == (const char *a, const EST_String &b); int operator == (const EST_String &a, const EST_String &b); ostream &operator << (ostream &s, const EST_String &str); #include "EST_Regex.h" #endif speech_tools/include/EST_string_aux.h0000644000076400007640000001060507262605664016372 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor, Simon King */ /* Date : 1994-99 */ /*-----------------------------------------------------------------------*/ /* Utility EST_String Functions header file */ /* */ /*=======================================================================*/ #ifndef __EST_STRING_AUX_H__ #define __EST_STRING_AUX_H__ #include "EST_TList.h" #include "EST_String.h" #include "EST_types.h" #include "EST_rw_status.h" void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep=""); void BracketStringtoStrList(EST_String s, EST_StrList &l, EST_String sep=""); EST_read_status load_StrList(EST_String filename, EST_StrList &l); EST_write_status save_StrList(EST_String filename, EST_StrList &l, EST_String style="words"); void strip_quotes(EST_String &s, const EST_String quote_char="\""); // makes EST_String from integer. EST_String itoString(int n); // makes EST_String from float, with variable precision EST_String ftoString(float n, int pres=3, int width=0, int l=0); int Stringtoi(EST_String s); int StrListtoIList(EST_StrList &s, EST_IList &il); int StrListtoFList(EST_StrList &s, EST_FList &il); void StrList_to_StrVector(EST_StrList &l, EST_StrVector &v); void StrVector_to_StrList(EST_StrVector &v,EST_StrList &l); int StrVector_index(const EST_StrVector &v,const EST_String &s); int strlist_member(const EST_StrList &l,const EST_String &s); int strlist_index(const EST_StrList &l,const EST_String &s); // strips path off front of filename EST_String basename(EST_String full, EST_String ext=""); // this is not the right place for these void IList_to_IVector(EST_IList &l, EST_IVector &v); void IVector_to_IList(EST_IVector &v,EST_IList &l); int IVector_index(const EST_IVector &v,const int s); int ilist_member(const EST_IList &l,int i); int ilist_index(const EST_IList &l,int i); #endif // __EST_STRING_AUX_H__ speech_tools/include/EST_wave_aux.h0000644000076400007640000001202111146557371016015 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* EST_Wave class auxiliary functions */ /* */ /*=======================================================================*/ /**@name EST_wave_aux Auxiliary functions for processing waveforms. */ //@{ #ifndef __EST_WAVE_AUX_H__ #define __EST_WAVE_AUX_H__ #include "EST_String.h" #include "EST_Wave.h" #include "ling_class/EST_Relation.h" #include "EST_Option.h" #include "EST_FMatrix.h" #include "EST_TNamedEnum.h" int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel); void wave_combine_channels(EST_Wave &combined, const EST_Wave &multi); int wave_subwave(EST_Wave &subsig,EST_Wave &sig,int offset,int length); int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab, const EST_String &ext); int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab, const EST_String &file); void add_waves(EST_Wave &s, const EST_Wave &m); EST_Wave difference(EST_Wave &a, EST_Wave &b); float rms_error(EST_Wave &a, EST_Wave &b, int channel); float abs_error(EST_Wave &a, EST_Wave &b, int channel); float correlation(EST_Wave &a, EST_Wave &b, int channel); EST_FVector rms_error(EST_Wave &a, EST_Wave &b); EST_FVector abs_error(EST_Wave &a, EST_Wave &b); EST_FVector correlation(EST_Wave &a, EST_Wave &b); EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax); void absolute(EST_Wave &a); EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al); EST_write_status write_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al); void wave_info(EST_Wave &w); void invert(EST_Wave &sig); void differentiate(EST_Wave &sig); void reverse(EST_Wave &sig); void ulaw_to_short(const unsigned char *ulaw,short *data,int length); void alaw_to_short(const unsigned char *alaw,short *data,int length); void uchar_to_short(const unsigned char *chars,short *data,int length); void short_to_char(const short *data,unsigned char *chars,int length); void short_to_ulaw(const short *data,unsigned char *ulaw,int length); // Used when setting Waves in Features VAL_REGISTER_CLASS_DCLS(wave,EST_Wave) enum EST_sample_type_t { st_unknown, st_schar, st_uchar, st_short, st_shorten, st_int, st_float, st_double, st_mulaw, st_adpcm, st_alaw, st_ascii}; extern EST_TNamedEnum EST_sample_type_map; #endif /* __EST_WAVE_AUX_H__ */ //@} speech_tools/include/EST_Chunk.h0000644000076400007640000002306710452516771015260 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: February 1997 */ /* -------------------------------------------------------------------- */ /* */ /* Use counted memory chunks and smart pointers to them. */ /* */ /************************************************************************/ #if ! defined(__EST_CHUNK_H__) #define __EST_CHUNK_H__ #define HAVE_WALLOC_H (1) #include using namespace std; #include #include // Warn when getting a writable version of a shared chunk -- // useful for minimising copies. /* #define __INCLUDE_CHUNK_WARNINGS__ (1) */ #if defined(__INCULDE_CHUNK_WARNINGS__) # define CHUNK_WARN(WHAT) do { cerr << "chunk: " <size:0; }; int shareing(void) const { return ptr?(ptr->count >1):0; }; int count(void) const { return ptr?(ptr->count):-1; }; EST_ChunkPtr &operator = (EST_ChunkPtr cp) CII({ // doing it in this order means self assignment is safe. if (cp.ptr) ++ *(cp.ptr); if (ptr) -- *ptr; ptr=cp.ptr; return *this; }); // If they manage to get hold of one... // Actually usually used to assign NULL and so (possibly) deallocate // the chunk currently pointed to. EST_ChunkPtr &operator = (EST_Chunk *chp) CII({ // doing it in this order means self assignment is safe. if (chp) ++ *chp; if (ptr) -- *ptr; ptr=chp; return *this; }); // Casting to a non-const pointer causes a // warning to stderr if the chunk is shared. operator char*() CII({ if (ptr && ptr->count > 1) { CHUNK_WARN("getting writable version of shared chunk\n"); cp_make_updatable(*this); } return ptr?&(ptr->memory[0]):(char *)NULL; }); operator const char*() const CII({ return ptr?&(ptr->memory[0]):(const char *)NULL; }); operator const char*() CII({ return ptr?&(ptr->memory[0]):(const char *)NULL; }); const char operator [] (int i) const { return ptr->memory[i]; }; char &operator () (int i) CII({ if (ptr->count>1) { CHUNK_WARN("getting writable version of shared chunk\n"); cp_make_updatable(*this); } return ptr->memory[i]; }); // Creating a new one friend EST_ChunkPtr chunk_allocate(int size); friend EST_ChunkPtr chunk_allocate(int bytes, const char *initial, int initial_len); friend EST_ChunkPtr chunk_allocate(int bytes, const EST_ChunkPtr &initial, int initial_start, int initial_len); // Make sure the memory isn`t shared. friend void cp_make_updatable(EST_ChunkPtr &shared, EST_Chunk::EST_chunk_size inuse); friend void cp_make_updatable(EST_ChunkPtr &shared); // Make sure there is enough room (also makes updatable) friend void grow_chunk(EST_ChunkPtr &shared, EST_Chunk::EST_chunk_size inuse, EST_Chunk::EST_chunk_size newsize); friend void grow_chunk(EST_ChunkPtr &shared, EST_Chunk::EST_chunk_size newsize); // we print it by just printing the chunk friend ostream &operator << (ostream &s, const EST_ChunkPtr &cp) { return (s<< *cp.ptr); }; friend void tester(void); }; #endif speech_tools/include/EST_Ngrammar.h0000644000076400007640000005536710127000720015741 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King & Alan W Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A general class for ngrams (bi-gram, tri-gram etc) */ /* */ /*=======================================================================*/ #ifndef __EST_NGRAMMAR_H__ #define __EST_NGRAMMAR_H__ #include #include using namespace std; #include "EST_String.h" #include "EST_Val.h" #include "EST_rw_status.h" #include "EST_types.h" #include "EST_FMatrix.h" #include "EST_TList.h" #include "EST_StringTrie.h" #include "EST_simplestats.h" #include "EST_PST.h" #include "EST_string_aux.h" #include "EST_math.h" // HTK style #define SENTENCE_START_MARKER "!ENTER" #define SENTENCE_END_MARKER "!EXIT" #define OOV_MARKER "!OOV" #define EST_NGRAMBIN_MAGIC 1315402337 // for compressed save/load #define GZIP_FILENAME_EXTENSION "gz" #define COMPRESS_FILENAME_EXTENSION "Z" // Ultimate floor #define TINY_FREQ 1.0e-10 // ngram state - represents the N-1 word history and contains // the pdf of the next word class EST_NgrammarState { private: protected: EST_DiscreteProbDistribution p_pdf; int p_id; // a 'name' public: EST_NgrammarState() : p_pdf() { init(); }; EST_NgrammarState(int id,EST_Discrete *d){clear();init(id,d);}; EST_NgrammarState(int id,const EST_DiscreteProbDistribution &pdf) {clear();init(id,pdf);}; EST_NgrammarState(const EST_NgrammarState &s); EST_NgrammarState(const EST_NgrammarState *const s); ~EST_NgrammarState(); EST_IVector path; // how we got here // initialise void clear(); void init(); void init(int id, EST_Discrete *d); void init(int id, const EST_DiscreteProbDistribution &pdf); // build void cumulate(const int index, const double count=1) {p_pdf.cumulate(index,count);}; void cumulate(const EST_String &word, const double count=1) {p_pdf.cumulate(word,count);}; // access int id() const {return p_id; }; const EST_DiscreteProbDistribution &pdf_const() const {return p_pdf; }; EST_DiscreteProbDistribution &pdf() {return p_pdf; }; double probability(const EST_String &w) const {return p_pdf.probability(w);} double probability(int w) const {return p_pdf.probability(w);} double frequency(const EST_String &w) const {return p_pdf.frequency(w);} double frequency(int w) const {return p_pdf.frequency(w);} const EST_String &most_probable(double *prob = NULL) const {return p_pdf.most_probable(prob);} friend ostream& operator<<(ostream& s, const EST_NgrammarState &a); }; class EST_BackoffNgrammarState { private: protected: int p_level; // = 0 for root node double backoff_weight; EST_DiscreteProbDistribution p_pdf; EST_StringTrie children; EST_BackoffNgrammarState* add_child(const EST_Discrete *d, const EST_StrVector &words); EST_BackoffNgrammarState* add_child(const EST_Discrete *d, const EST_IVector &words); public: EST_BackoffNgrammarState() { init(); }; EST_BackoffNgrammarState(const EST_Discrete *d,int level) {clear();init(d,level);}; EST_BackoffNgrammarState(const EST_DiscreteProbDistribution &pdf,int level) {clear();init(pdf,level);}; EST_BackoffNgrammarState(const EST_BackoffNgrammarState &s); EST_BackoffNgrammarState(const EST_BackoffNgrammarState *const s); ~EST_BackoffNgrammarState(); // initialise void clear(); void init(); void init(const EST_Discrete *d, int level); void init(const EST_DiscreteProbDistribution &pdf, int level); // build bool accumulate(const EST_StrVector &words, const double count=1); bool accumulate(const EST_IVector &words, const double count=1); // access const EST_DiscreteProbDistribution &pdf_const() const {return p_pdf; }; EST_DiscreteProbDistribution &pdf() {return p_pdf; }; double probability(const EST_String &w) const {return p_pdf.probability(w);} double frequency(const EST_String &w) const {return p_pdf.frequency(w);} const EST_String &most_probable(double *prob = NULL) const {return p_pdf.most_probable(prob);} const int level() const {return p_level;} EST_BackoffNgrammarState* get_child(const EST_String &word) const { return (EST_BackoffNgrammarState*)children.lookup(word); } EST_BackoffNgrammarState* get_child(const int word) const { return (EST_BackoffNgrammarState*)children.lookup(p_pdf.get_discrete()->name(word)); } void remove_child(EST_BackoffNgrammarState *child, const EST_String &name); // recursive delete of contents and children void zap(); const EST_BackoffNgrammarState *const get_state(const EST_StrVector &words) const; bool ngram_exists(const EST_StrVector &words, const double threshold) const; const double get_backoff_weight() const {return backoff_weight; } const double get_backoff_weight(const EST_StrVector &words) const; bool set_backoff_weight(const EST_StrVector &words, const double w); void frequency_of_frequencies(EST_DVector &ff); void print_freqs(ostream &os,const int order,EST_String followers=""); friend ostream& operator<<(ostream& s, const EST_BackoffNgrammarState &a); }; class EST_Ngrammar { public: // 3 representations : sparse, dense and backed off. User specifies which. enum representation_t {sparse, dense, backoff}; // now only keep frequencies (or log frequencies) // probabilities (or log probabilities) can be done // on the fly quickly enough enum entry_t {frequencies, log_frequencies}; protected: // each instance of an EST_Ngrammar is a grammar of fixed order // e.g. a bigram (order = 2) int p_order; int p_num_samples; double p_number_of_sentences; // which were used to build this grammar EST_String p_sentence_start_marker; EST_String p_sentence_end_marker; // only one representation in use at a time representation_t p_representation; entry_t p_entry_type; // sparse representation is a tree structure // holding only those N-grams which were seen EST_PredictionSuffixTree sparse_representation; bool init_sparse_representation(); // dense representation is just an array of all states bool init_dense_representation(); // backoff representation is also a tree structure // but the root state pdf is the most recent word in the // ngram and going down the tree is going back in time.... // here is the root node : EST_BackoffNgrammarState *backoff_representation; double backoff_threshold; // need a non-zero unigram floor to enable backing off double backoff_unigram_floor_freq; // instead of simple discounting, we have a (possibly) different // discount per order and per frequency // e.g. backoff_discount[2](4) contains the discount to be // applied to a trigram frequency of 4 // backoff_discount[0] is unused (we don't discount unigrams) EST_DVector *backoff_discount; const double get_backoff_discount(const int order, const double freq) const; bool init_backoff_representation(); void prune_backoff_representation(EST_BackoffNgrammarState *start_state=NULL); // remove any zero frequency branches void backoff_restore_unigram_states(); int p_num_states; // == p_vocab_size ^ (p_ord-1) if fully dense EST_NgrammarState *p_states; // state id is index into this array int find_dense_state_index(const EST_IVector &words, int index=0) const; // and the reverse const EST_StrVector &make_ngram_from_index(const int i) const; // vocabulary EST_Discrete *vocab; EST_Discrete *pred_vocab; // may be different from state vocab bool init_vocab(const EST_StrList &wordlist); bool init_vocab(const EST_StrList &word_list, const EST_StrList &pred_list); // make sure vocab matches a given wordlist bool check_vocab(const EST_StrList &wordlist); EST_DiscreteProbDistribution vocab_pdf; // overall pdf const EST_String &lastword(const EST_StrVector &words) const { return words(p_order-1); } const int lastword(const EST_IVector &words) const { return words(p_order-1); } // are we allowing out-of-vocabulary words, or is the vocabulary closed? bool allow_oov; bool sparse_to_dense(); bool dense_to_sparse(); // these aren't sorted yet ... void take_logs(); void take_exps(); void freqs_to_probs(); // just calls normalise bool build_sparse(const EST_String &filename, const EST_String &prev, const EST_String &prev_prev, const EST_String &last); // for dense and backoff bool build_ngram(const EST_String &filename, const EST_String &prev, const EST_String &prev_prev, const EST_String &last, const EST_String &input_format); // go through all matching ngrams ( *(ngram[i])="" matches anything ) void iterate(EST_StrVector &words, void (*function)(EST_Ngrammar *n, EST_StrVector &words, void *params), void *params); // same, but with a constant Ngrammar void const_iterate(EST_StrVector &words, void (*function)(const EST_Ngrammar *const n, EST_StrVector &words, void *params), void *params) const; bool p_init(int o, representation_t r); // new filename returned of we had to copy stdin to a // temporary file - must delete it later ! bool oov_preprocess(const EST_String &filename, EST_String &new_filename, const EST_String &what); const EST_NgrammarState &find_state_const(const EST_StrVector &words)const; EST_NgrammarState &find_state(const EST_StrVector &words); const EST_NgrammarState &find_state_const(const EST_IVector &words) const; EST_NgrammarState &find_state(const EST_IVector &words); // special versions for backoff grammars const EST_DiscreteProbDistribution &backoff_prob_dist(const EST_StrVector &words) const; const double backoff_reverse_probability_sub(const EST_StrVector &words, const EST_BackoffNgrammarState *root) const; const double backoff_probability(const EST_StrVector &words, const bool trace=false) const; const double backoff_reverse_probability(const EST_StrVector &words) const; const EST_String & backoff_most_probable(const EST_StrVector &words, double *prob = NULL) const; // backoff representation isn't a nice array of states // so use this to visit every node in the tree // and apply the function to that node void backoff_traverse(EST_BackoffNgrammarState *start_state, void (*function)(EST_BackoffNgrammarState *s, void *params), void *params); // visit every node at a given level void backoff_traverse(EST_BackoffNgrammarState *start_state, void (*function)(EST_BackoffNgrammarState *s, void *params), void *params, const int level); public: EST_Ngrammar() {default_values();} EST_Ngrammar(int o, representation_t r, const EST_StrList &wordlist) { default_values(); init(o,r,wordlist); } // When state trans vocab differs from prediction vocab EST_Ngrammar(int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist) { default_values(); init(o,r,wordlist,predlist); } EST_Ngrammar(int o, representation_t r, EST_Discrete &v) { default_values(); init(o,r,v); } ~EST_Ngrammar(); void default_values(); void clear(); bool init(int o, representation_t r, const EST_StrList &wordlist); bool init(int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist); bool init(int o, representation_t r, EST_Discrete &v); bool init(int o, representation_t r, EST_Discrete &v,EST_Discrete &pv); // access int num_states(void) const { return p_num_states;} double samples(void) const { return p_num_samples;} int order() const { return p_order; } int get_vocab_length() const { return vocab?vocab->length():0; } EST_String get_vocab_word(int i) const; int get_vocab_word(const EST_String &s) const; int get_pred_vocab_length() const { return pred_vocab->length(); } EST_String get_pred_vocab_word(int i) const { return pred_vocab->name(i); } int get_pred_vocab_word(const EST_String &s) const { return pred_vocab->name(s); } int closed_vocab() const {return !allow_oov; } entry_t entry_type() const {return p_entry_type;} representation_t representation() const { return p_representation;} // build bool build(const EST_StrList &filenames, const EST_String &prev = SENTENCE_START_MARKER, const EST_String &prev_prev = SENTENCE_END_MARKER, const EST_String &last = SENTENCE_END_MARKER, const EST_String &input_format = "", const EST_String &oov_mode = "", const int mincount=1, const int maxcount=10); // Accumulate ngrams void accumulate(const EST_StrVector &words, const double count=1); //const int index=0); void accumulate(const EST_IVector &words, const double count=1); //const int index=0); // hack - fix enter/exit probs s.t. P(...,!ENTER)=P(!EXIT,...)=0, for all x void make_htk_compatible(); // I/O functions EST_read_status load(const EST_String &filename); EST_read_status load(const EST_String &filename, const EST_StrList &wordlist); EST_write_status save(const EST_String &filename, const EST_String type="cstr_ascii", const bool trace=false, double floor=0.0); int wordlist_index(const EST_String &word, const bool report=true) const; const EST_String &wordlist_index(int i) const; int predlist_index(const EST_String &word) const; const EST_String &predlist_index(int i) const; // set bool set_entry_type(entry_t new_type); bool set_representation(representation_t new_representation); // probability distributions // ------------------------- // flag 'force' forces computation of probs on-the-fly if necessary double probability(const EST_StrVector &words, bool force=false, const bool trace=false) const; double frequency(const EST_StrVector &words, bool force=false, const bool trace=false) const; const EST_String &predict(const EST_StrVector &words, double *prob,int *state) const; const EST_String &predict(const EST_StrVector &words) const {double p; int state; return predict(words,&p,&state); } const EST_String &predict(const EST_StrVector &words,double *prob) const {int state; return predict(words,prob,&state); } const EST_String &predict(const EST_IVector &words,double *prob,int *state) const; const EST_String &predict(const EST_IVector &words) const {double p; int state; return predict(words,&p,&state); } const EST_String &predict(const EST_IVector &words,double *prob) const {int state; return predict(words,prob,&state); } int find_state_id(const EST_StrVector &words) const; int find_state_id(const EST_IVector &words) const; int find_next_state_id(int state, int word) const; // fast versions for common N //const double probability(const EST_String w1); //const double probability(const EST_String w1,const EST_String w2); //const double probability(const EST_String w1,const EST_String w2, //const EST_String w2); // reverse - probability of words[0..order-2] given word[order-1] double reverse_probability(const EST_StrVector &words, bool force=false) const; double reverse_probability(const EST_IVector &words, bool force=false) const; // predict, where words has 'order' elements and the last one is "" or NULL const EST_DiscreteProbDistribution &prob_dist(const EST_StrVector &words) const; const EST_DiscreteProbDistribution &prob_dist(const EST_IVector &words) const; const EST_DiscreteProbDistribution &prob_dist(int state) const; // bool stats(const EST_String filename, // double &raw_entropy, double &count, // double &entropy, double &perplexity, // const EST_String &prev = SENTENCE_START_MARKER, // const EST_String &prev_prev = SENTENCE_END_MARKER, // const EST_String &last = SENTENCE_END_MARKER, // const EST_String &input_format = "") const; void fill_window_start(EST_IVector &window, const EST_String &prev, const EST_String &prev_prev) const; void fill_window_start(EST_StrVector &window, const EST_String &prev, const EST_String &prev_prev) const; // why anybody would want to do this .... //EST_Ngrammar &operator =(const EST_Ngrammar &a); bool ngram_exists(const EST_StrVector &words) const; bool ngram_exists(const EST_StrVector &words, const double threshold) const; const double get_backoff_weight(const EST_StrVector &words) const; bool set_backoff_weight(const EST_StrVector &words, const double w); void print_freqs(ostream &os,double floor=0.0); // i/o functions // ------------- friend ostream& operator<<(ostream& s, EST_Ngrammar &n); friend EST_read_status load_ngram_htk_ascii(const EST_String filename, EST_Ngrammar &n); friend EST_read_status load_ngram_htk_binary(const EST_String filename, EST_Ngrammar &n); friend EST_read_status load_ngram_arpa(const EST_String filename, EST_Ngrammar &n, const EST_StrList &vocab); friend EST_read_status load_ngram_cstr_ascii(const EST_String filename, EST_Ngrammar &n); friend EST_read_status load_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n); friend EST_write_status save_ngram_htk_ascii_sub(const EST_String &word, ostream *ost, EST_Ngrammar &n, double floor); friend EST_write_status save_ngram_htk_ascii(const EST_String filename, EST_Ngrammar &n, double floor=0.0); //friend EST_write_status save_ngram_htk_binary(const EST_String filename, // EST_Ngrammar &n); friend EST_write_status save_ngram_cstr_ascii(const EST_String filename, EST_Ngrammar &n, const bool trace=false, double floor=0.0); friend EST_write_status save_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n, const bool trace=false, double floor=0.0); friend EST_write_status save_ngram_arpa(const EST_String filename, EST_Ngrammar &n); friend EST_write_status save_ngram_arpa_sub(ostream *ost, EST_Ngrammar &n, const EST_StrVector &words); friend EST_write_status save_ngram_wfst(const EST_String filename, EST_Ngrammar &n); // Auxiliary functions // smoothing friend void frequency_of_frequencies(EST_DVector &ff, EST_Ngrammar &n,int this_order=0); friend void map_frequencies(EST_Ngrammar &n, const EST_DVector &map, const int this_order=0); friend bool Good_Turing_smooth(EST_Ngrammar &n, int maxcount, int mincount=0); friend void Good_Turing_discount(EST_Ngrammar &ngrammar, const int maxcount, const double default_discount=0.5); friend void fs_build_backoff_ngrams(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram); friend int fs_backoff_smooth(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram, int smooth_thresh); // frequencies below mincount get backed off // frequencies above maxcount are not smoothed(discounted) bool compute_backoff_weights(const int mincount=1, const int maxcount=10); bool merge(EST_Ngrammar &n,float weight); friend class EST_BackoffNgrammar; }; void Ngram_freqsmooth(EST_Ngrammar &ngram, int smooth_thresh1, int smooth_thresh2); // utils void slide(EST_IVector &i, const int l); void slide(EST_StrVector &i, const int l); bool test_stats(EST_Ngrammar &ngram, const EST_String &filename, double &raw_entropy, double &count, double &entropy, double &perplexity, const EST_String &input_format, const EST_String &prev = SENTENCE_START_MARKER, const EST_String &prev_prev = SENTENCE_END_MARKER, const EST_String &last = SENTENCE_END_MARKER); VAL_REGISTER_CLASS_DCLS(ngrammar,EST_Ngrammar) #endif // __EST_NGRAMMAR_H__ speech_tools/include/EST_sort.h0000644000076400007640000000653107262605664015201 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : January 1997 */ /*-----------------------------------------------------------------------*/ /* Sorting Functions */ /* */ /*=======================================================================*/ #ifndef __EST_SORT_H__ #define __EST_SORT_H__ #include "EST_TList.h" // functions in Tlist_aux.C template bool operator==(const EST_TList &a,const EST_TList &b); template void sort(EST_TList &a); template void ptr_sort(EST_TList &a); template void qsort(EST_TList &a); template void ptr_qsort(EST_TList &a); template void sort_unique(EST_TList &l); template void merge_sort_unique(EST_TList &l, EST_TList &m); #endif // __EST_SORT_H__ speech_tools/include/EST_rw_status.h0000644000076400007640000001375410127000720016222 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1994 */ /*-----------------------------------------------------------------------*/ /* Utility Function header file for C and C++ */ /* */ /*=======================================================================*/ #ifndef __RW_STATUS_H__ #define __RW_STATUS_H__ #ifdef __cplusplus #include #include #else #include #include #endif #ifdef __cplusplus extern "C" { #endif /* * make_status_int builds the status as an integer * make_X_status casts it to the required type. */ #define make_status_int(STATE, REASON, ERRNO) \ ( ((((unsigned int)(STATE)) & 0xff) <<24) \ | ((((unsigned int)(REASON)) & 0xff) <<16) \ | ((((unsigned int)(ERRNO)) & 0xffff) <<00) \ ) #define make_read_status(STATE, REASON, ERRNO)\ ((EST_read_status)(make_status_int(STATE, REASON, ERRNO))) #define make_write_status(STATE, REASON, ERRNO) \ ((EST_write_status)(make_status_int(REASON, STATE, ERRNO))) /* * Extract the bits. */ #define get_rw_state(STATUS) \ ((EST_rw_state)((((unsigned int)(STATUS)) >> 24) & 0xff)) #define get_rw_reason(STATUS) \ ((EST_rw_reason)((((unsigned int)(STATUS)) >> 16) & 0xff)) #define get_rw_errno(STATUS) \ ((int)((((unsigned int)(STATUS)) >> 0) & 0xff)) /* * Why we failed. */ enum EST_rw_reason { rwr_none=0, rwr_format=1, rwr_existance=2, rwr_permission=3, rwr_system=4, rwr_unknown=0xff }; /** State of rw */ enum EST_rw_state { /// ok rws_ok=0, /// partial rws_partial=1, /// failed rws_failed=0xff }; /** Possible outcomes of a file reading operation. More stuff*/ enum EST_read_status { /// The file was read in successfully read_ok = make_status_int(rws_ok, rwr_none, 0), /// The file exists but is not in the format specified read_format_error = make_status_int(rws_failed, rwr_format, 0), /// The file does not exist. read_not_found_error = make_status_int(rws_failed, rwr_existance, 0), /// An error occurred while reading read_error = make_status_int(rws_failed, rwr_unknown, 0) }; /** Possible outcomes of a file writing operation */ enum EST_write_status { /// The file was written successfully write_ok = make_status_int(rws_ok, rwr_none, 0), /// The file was not written successfully write_fail = make_status_int(rws_failed, rwr_unknown, 0), /// The file was not written successfully write_error = make_status_int(rws_failed, rwr_unknown, 0), /// A valid file was created, but only some of the requested data is in there write_partial = make_status_int(rws_partial, rwr_unknown, 0) }; /** Possible outcomes of a network connection operation */ enum EST_connect_status { /// Connection made. connect_ok = make_status_int(rws_ok, rwr_none, 0), /// Connection failed. connect_not_found_error = make_status_int(rws_failed, rwr_existance, 0), /// Connection failed. connect_not_allowed_error = make_status_int(rws_failed, rwr_permission, 0), /// System failure of some kind connect_system_error = make_status_int(rws_failed, rwr_system, 0), /// The file was not written successfully connect_error = make_status_int(rws_failed, rwr_unknown, 0) }; #ifdef __cplusplus } #endif /* * Temporary redefinitions of the old values. */ #define format_ok read_ok #define wrong_format read_format_error #define misc_read_error read_error #define misc_write_error write_error #endif /*__RW_STATUS_H__ */ speech_tools/include/EST_Wave.h0000644000076400007640000003016310435307504015076 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor and Alan W Black */ /* Rewritten : Richard Caley */ /* ------------------------------------------------------------------- */ /* EST_Wave Class header file */ /* */ /*************************************************************************/ #ifndef __Wave_H__ #define __Wave_H__ #include #include "EST_Featured.h" #include "EST_rw_status.h" #include "EST_types.h" class EST_Track; class EST_String; class EST_TokenStream; /** A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts. Multiple channels are supported, but if no channel information is given the 0th channel is accessed.

The waveforms can be of any sample rate, and can be changed to another sampling rate using the resample function. */ class EST_Wave : public EST_Featured { protected: EST_SMatrix p_values; int p_sample_rate; void default_vals(int n=0, int c=1); void free_wave(); void copy_data(const EST_Wave &w); void copy_setup(const EST_Wave &w); public: static const int default_sample_rate; static const int default_num_channels; /// default constructor EST_Wave(); /// copy constructor EST_Wave(const EST_Wave &a); EST_Wave(int n, int c, int sr); /// Construct from memory supplied by caller EST_Wave(int samps, int chans, short *memory, int offset=0, int sample_rate=default_sample_rate, int free_when_destroyed=0); ~EST_Wave(); /**@name Access functions for finding amplitudes of samples */ //@{ /** return amplitude of sample i from channel channel. By default the 0th channel is selected. This function can be used for assignment. */ short &a(int i, int channel = 0); short a(int i, int channel = 0) const; INLINE short &a_no_check(int i, int channel = 0) { return p_values.a_no_check(i,channel); } INLINE short a_no_check(int i, int channel = 0) const { return p_values.a_no_check(i,channel); } INLINE short &a_no_check_1(int i, int channel = 0) { return p_values.a_no_check_1(i,channel); } INLINE short a_no_check_1(int i, int channel = 0) const { return p_values.a_no_check_1(i,channel); } /** explicit set_a, easier to wrap than assignment */ INLINE short set_a(int i, int channel = 0, short val = 0) { return a(i,channel) = val; } /** return amplitude of sample i from channel channel. By default the 0th channel is selected. */ short operator()(int i, int channel) const { return a(i,channel); } /** return amplitude of sample i from channel 0. */ short operator()(int i) const { return a(i,0); } /** Version of a() that returns zero if index is out of array bounds. This is particularly useful in signal processing when you want to have windows going off the end of the waveform. */ short &a_safe(int i, int channel = 0); /// return the time position in seconds of the ith sample float t(int i) const { return (float)i/(float)p_sample_rate; } //@} /**@name Information functions */ //@{ /// return the number of samples in the waveform int num_samples() const { return p_values.num_rows();} /// return the number of channels in the waveform int num_channels() const { return p_values.num_columns(); } /// return the sampling rate (frequency) int sample_rate() const { return p_sample_rate; } /// Set sampling rate to n void set_sample_rate(const int n){p_sample_rate = n;} /// return the size of the waveform, i.e. the number of samples. int length() const { return num_samples();} /// return the time position of the last sample. float end(){ return t(num_samples()-1); } /// Can we look N samples to the left? bool have_left_context(unsigned int n) const { return p_values.have_rows_before(n); } /** returns the file format of the file from which the waveform was read. If the waveform has not been read from a file, this is set to the default type */ EST_String sample_type() const { return f_String("sample_type","short"); } void set_sample_type(const EST_String t) { f_set("sample_type", t); } EST_String file_type() const { return f_String("file_type","riff"); } void set_file_type(const EST_String t) { f_set("file_type", t); } /// A string identifying the waveform, commonly used to store the filename EST_String name() const { return f_String("name"); } /// Sets name. void set_name(const EST_String n){ f_set("name", n); } //@} const EST_SMatrix &values() const { return p_values; } EST_SMatrix &values() { return p_values; } /**@name Waveform manipulation functions */ //@{ /// resize the waveform void resize(int num_samples, int num_channels = EST_ALL, int set=1) { p_values.resize(num_samples, num_channels, set); } /// Resample waveform to rate void resample(int rate); /** multiply all samples by a factor gain. This checks for overflows and puts them to the maximum positive or negative value as appropriate. */ void rescale(float gain,int normalize=0); // multiply samples by a factor contour. The factor_contour track // should contains factor targets at time points throughout the wave, // between which linear interpolation is used to calculate the factor // for each sample. void rescale( const EST_Track &factor_contour ); /// clear waveform and set size to 0. void clear() {resize(0,EST_ALL);} void copy(const EST_Wave &from); void fill(short v=0, int channel=EST_ALL); void empty(int channel=EST_ALL) { fill(0,channel); } void sample(EST_TVector &sv, int n) { p_values.row(sv, n); } void channel(EST_TVector &cv, int n) { p_values.column(cv, n); } void copy_channel(int n, short *buf, int offset=0, int num=EST_ALL) const { p_values.copy_column(n, buf, offset, num); } void copy_sample(int n, short *buf, int offset=0, int num=EST_ALL) const { p_values.copy_row(n, buf, offset, num); } void set_channel(int n, const short *buf, int offset=0, int num=EST_ALL) { p_values.set_column(n, buf, offset, num); } void set_sample(int n, const short *buf, int offset=0, int num=EST_ALL) { p_values.set_row(n, buf, offset, num); } void sub_wave(EST_Wave &sw, int offset=0, int num=EST_ALL, int start_c=0, int nchan=EST_ALL); void sub_wave(EST_Wave &sw, int offset=0, int num=EST_ALL, int start_c=0, int nchan=EST_ALL) const { ((EST_Wave *)this)->sub_wave(sw, offset, num, start_c, nchan); } //@} /**@name File i/o functions */ //@{ /** Load a file into the waveform. The load routine attempts to automatically determine which file type is being loaded. A portion of the waveform can be loaded by setting offset to the sample position from the beginning and to the number of required samples after this. */ EST_read_status load(const EST_String filename, int offset=0, int length = 0, int rate = default_sample_rate); EST_read_status load(EST_TokenStream &ts, int offset=0, int length = 0, int rate = default_sample_rate); EST_read_status load(const EST_String filename, const EST_String filetype, int offset=0, int length = 0, int rate = default_sample_rate); EST_read_status load(EST_TokenStream &ts, const EST_String filetype, int offset=0, int length = 0, int rate = default_sample_rate); /** Load a file of type filetype into the waveform. This can be used to load unheadered files, in which case the fields sample_rate, sample_type, bo and nc are used to specify the sample rate, type, byte order and number of channels. A portion of the waveform can be loaded by setting offset to the sample position from the beginning and to the number of required samples after this. */ EST_read_status load_file(const EST_String filename, const EST_String filetype, int sample_rate, const EST_String sample_type, int bo, int nc, int offset = 0, int length = 0); EST_read_status load_file(EST_TokenStream &ts, const EST_String filetype, int sample_rate, const EST_String sample_type, int bo, int nc, int offset = 0, int length = 0); /* Save waveform to a file called filename of file format EST_filetype. */ EST_write_status save(const EST_String filename, const EST_String EST_filetype = ""); EST_write_status save(FILE *fp, const EST_String EST_filetype = ""); EST_write_status save_file(const EST_String filename, EST_String filetype, EST_String sample_type, int bo); EST_write_status save_file(FILE *fp, EST_String filetype, EST_String sample_type, int bo); //@} /// Assignment operator EST_Wave& operator = (const EST_Wave& w); /** Add to existing wave in serial. Waveforms must have the same number of channels. */ EST_Wave& operator +=(const EST_Wave &a); /** Add wave in parallel, i.e. make wave a become new channels in existing waveform. */ EST_Wave& operator |=(const EST_Wave &a); /// print waveform friend ostream& operator << (ostream& p_values, const EST_Wave &sig); // integrity check *** debug void integrity() const { p_values.integrity() ; } }; typedef EST_TList EST_WaveList; int operator != (EST_Wave a, EST_Wave b); int operator == (EST_Wave a, EST_Wave b); #endif /* __Wave_H__ */ speech_tools/include/EST_SingleChannelWave.h0000644000076400007640000000633407262616577017555 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SINGECHANNELWAVE_H__ #define __EST_SINGECHANNELWAVE_H__ /** An alias for wave which can be used to tell the compiler you know it * is a simple one channel wave. This can speed up access. * * @author Richard Caley * @version $Id: EST_SingleChannelWave.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #include "EST_Wave.h" class EST_SingleChannelWave : public EST_Wave { public: /// default constructor EST_SingleChannelWave() : EST_Wave() { }; EST_SingleChannelWave(const EST_SingleChannelWave &w) : EST_Wave(w) { }; EST_SingleChannelWave(int n, int sr) : EST_Wave(n, 1, sr) { }; INLINE short &a_no_check(int i, int channel = 0) { return p_values.a_no_check_1(i,channel); } INLINE short a_no_check(int i, int channel = 0) const { return p_values.a_no_check_1(i,channel); } }; #endif speech_tools/include/EST_TNamedEnum.h0000644000076400007640000001764310127000720016165 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Feb 28 1997 */ /************************************************************************/ /* */ /* A template class which allows names (const char *s) to be */ /* associated with enums, providing conversion. */ /* */ /* EST_TValuesEnum is the obvious generalisation to associating */ /* things other than const char * with each value. */ /* */ /* EST_T{Named/Valued}EnumI can include extra information for each */ /* enum element. */ /* */ /* This should be rewritten as something other than linear search. At */ /* least sort them. */ /* */ /************************************************************************/ #ifndef __EST_TNAMEDENUM_H__ #define __EST_TNAMEDENUM_H__ #include using namespace std; #include "EST_String.h" #include "EST_rw_status.h" #define NAMED_ENUM_MAX_SYNONYMS (10) // Used in the type of tables with no info field. typedef char NO_INFO; // struct used to define the mapping. template struct EST_TValuedEnumDefinition { public: ENUM token; VAL values[NAMED_ENUM_MAX_SYNONYMS]; INFO info; } ; // This is the most general case, a mapping from enum to some other type // with extra info. template class EST_TValuedEnumI { protected: int ndefinitions; ENUM p_unknown_enum; VAL p_unknown_value; EST_TValuedEnumDefinition *definitions; virtual int eq_vals(VAL v1, VAL v2) const {return v1 == v2; }; // This is only a void * because INFO can`t manage to get the // parameter declaration in the definition past gcc with the actual type. void initialise(const void *defs); void initialise(const void *defs, ENUM (*conv)(const char *)); void initialise(void) {ndefinitions=0; definitions=NULL;}; void initialise(ENUM unknown_e, VAL unknown_v) {initialise(); p_unknown_enum=unknown_e; p_unknown_value = unknown_v;}; protected: EST_TValuedEnumI(void) {initialise();}; public: EST_TValuedEnumI(EST_TValuedEnumDefinition defs[]) {initialise((const void *)defs); }; EST_TValuedEnumI(EST_TValuedEnumDefinition defs[], ENUM (*conv)(const char *)) {initialise((const void *)defs, conv); }; virtual ~EST_TValuedEnumI(void); int n(void) const; ENUM token(VAL value) const; ENUM token(int n) const { return nth_token(n); } ENUM nth_token(int n) const; VAL value(ENUM token, int n=0) const; INFO &info(ENUM token) const; ENUM unknown_enum(void) const {return p_unknown_enum;}; VAL unknown_value(void) const {return p_unknown_value;}; int valid(ENUM token) const { return !eq_vals(value(token),p_unknown_value); }; }; // This is a special case for names. This saves typing and also // takes care of the fact that strings need their own compare function. template class EST_TNamedEnumI : public EST_TValuedEnumI { protected: EST_TNamedEnumI(void) : EST_TValuedEnumI() {}; int eq_vals(const char *v1, const char *v2) const {return strcmp(v1,v2) ==0; }; public: EST_TNamedEnumI(EST_TValuedEnumDefinition defs[]) {this->initialise((const void *)defs); }; EST_TNamedEnumI(EST_TValuedEnumDefinition defs[], ENUM (*conv)(const char *)) {this->initialise((const void *)defs, conv); }; const char *name(ENUM tok, int n=0) const {return value(tok,n); }; }; // Now the simple cases with no extra information template class EST_TValuedEnum : public EST_TValuedEnumI { public: EST_TValuedEnum(EST_TValuedEnumDefinition defs[]) {this->initialise((const void *)defs);}; EST_TValuedEnum(EST_TValuedEnumDefinition defs[], ENUM (*conv)(const char *)) {this->initialise((const void *)defs, conv);}; }; template class EST_TNamedEnum : public EST_TNamedEnumI { private: EST_read_status priv_load(EST_String name, EST_TNamedEnum *definitive); EST_write_status priv_save(EST_String name, EST_TNamedEnum *definitive, char quote) const; public: EST_TNamedEnum(ENUM undef_e, const char *undef_n = NULL) {this->initialise(undef_e, undef_n);}; EST_TNamedEnum(EST_TValuedEnumDefinition defs[]) {this->initialise((const void *)defs);}; EST_TNamedEnum(EST_TValuedEnumDefinition defs[], ENUM (*conv)(const char *)) {this->initialise((const void *)defs, conv);}; EST_read_status load(EST_String name) { return priv_load(name, NULL); }; EST_read_status load(EST_String name, EST_TNamedEnum &definitive) { return priv_load(name, &definitive); }; EST_write_status save(EST_String name, char quote='"') const { return priv_save(name, NULL, quote); }; EST_write_status save(EST_String name, EST_TNamedEnum &definitive, char quote='"') const { return priv_save(name, &definitive, quote); }; }; #include "instantiate/EST_TNamedEnumI.h" #endif speech_tools/include/EST_grammar.h0000644000076400007640000000611607262605664015637 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black and Simon King */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* EST Grammar Classes Header */ /* */ /*=======================================================================*/ #ifndef __GRAMMAR_CLASS_H__ #define __GRAMMAR_CLASS_H__ // Generalised N-grammars #include "EST_Ngrammar.h" // Stochastic Context-free Grammars #include "EST_SCFG.h" // Weighted Finite-state Transducers #include "EST_WFST.h" #endif /* __GRAMMAR_CLASS_H__ */ speech_tools/include/EST_util_class.h0000644000076400007640000000626707262605664016362 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* EST Util Class Header */ /* */ /*=======================================================================*/ #ifndef __UTIL_CLASS_H__ #define __UTIL_CLASS_H__ #include "EST_TKVL.h" #include "EST_Option.h" #include "EST_TList.h" #include "EST_TMatrix.h" #include "EST_TVector.h" #include "EST_Token.h" #include "EST_FMatrix.h" #include "EST_DMatrix.h" #include "EST_StringTrie.h" #include "EST_cmd_line.h" // EST_io_aux.h ??? // EST_sort.h ??? #endif /* __UTIL_CLASS_H__ */ speech_tools/include/EST_speech_class.h0000644000076400007640000000600307262605664016640 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* EST Speech Class Header */ /* */ /*=======================================================================*/ #ifndef __SPEECH_CLASS_H__ #define __SPEECH_CLASS_H__ #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_Track.h" #include "EST_track_aux.h" #endif /* __SPEECH_CLASS_H__ */ speech_tools/include/EST_ling_class.h0000644000076400007640000000625507262605664016333 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* EST Ling Class Header */ /* */ /*=======================================================================*/ #ifndef __LING_CLASS_H__ #define __LING_CLASS_H__ #include "ling_class/EST_Utterance.h" #include "ling_class/EST_utterance_aux.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_relation_aux.h" #include "ling_class/EST_relation_compare.h" #include "ling_class/EST_Item.h" #include "ling_class/EST_item_aux.h" #endif /* __LING_CLASS_H__ */ speech_tools/include/EST_stats.h0000644000076400007640000000603307262605664015345 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* EST Stats Header */ /* */ /*=======================================================================*/ #ifndef __EST_STATS__H__ #define __EST_STATS_H__ #include "EST_PST.h" #include "EST_cluster.h" #include "EST_simplestats.h" #include "EST_multistats.h" #include "EST_viterbi.h" #endif /* __EST_STATS__H__ */ speech_tools/include/EST_simplestats.h0000644000076400007640000003127410511242333016541 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* Simple statistics (for discrete probability distributions */ /* */ /*=======================================================================*/ #ifndef __EST_SIMPLESTATS_H__ #define __EST_SIMPLESTATS_H__ #include "EST_String.h" #include "EST_Token.h" #include "EST_StringTrie.h" #include "EST_TList.h" #include "EST_TKVL.h" #include "EST_types.h" typedef size_t int_iter; /** A class for managing mapping string names to integers and back again, mainly used for representing alphabets in n-grams and grammars etc. This offers an efficient way of mapping a known set of string names to integers. It is initialised from a list of names and builds a index of those names to a set of integers. @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_Discrete { private: // for fast index->name EST_StrVector namevector; int p_def_val; // for fast name->index EST_StringTrie nametrie; public: /// EST_Discrete() {nametrie.clear(); p_def_val = -1;} /// EST_Discrete(const EST_Discrete &d) { copy(d); } /// Initialise discrete class from given list of strings EST_Discrete(const EST_StrList &vocab); /// ~EST_Discrete(); /// void copy(const EST_Discrete &d); /// (re-)initialise bool init(const EST_StrList &vocab); /// The number of members in the discrete const int length(void) const { return namevector.length(); } /** The int assigned to the given name, if it doesn't exists p\_def\_val is returned (which is -1 by default) */ const int index(const EST_String &n) const { int *i; return (((i=(int*)nametrie.lookup(n)) != NULL) ? *i : p_def_val); }; /// The name given the index const EST_String &name(const int n) const { return namevector(n); } /// set the default value when a name isn't found (-1 by default) void def_val(const EST_String &v) { p_def_val = index(v); } /// An alternative method for getting the int form the name int name(const EST_String &n) const { return index(n); }; bool operator == (const EST_Discrete &d); bool operator != (const EST_Discrete &d); EST_String print_to_string(int quote=0); friend ostream& operator <<(ostream& s, const EST_Discrete &d); /// EST_Discrete & operator = (const EST_Discrete &a) { copy(a); return *this; } }; class Discretes { private: int max; int next_free; EST_Discrete **discretes; public: Discretes() {max=50;next_free=0;discretes=new EST_Discrete*[max];} ~Discretes(); const int def(const EST_StrList &members); EST_Discrete &discrete(const int t) const {return *discretes[t-10];} EST_Discrete &operator [] (const int t) const {return *discretes[t-10];} }; /** A class for cummulating ``sufficient statistics'' for a set of numbers: sum, count, sum squared. This collects the number, sum and sum squared for a set of number. Offering mean, variance and standard deviation derived from the cummulated values. @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_SuffStats { private: double n; // allows frequencies to be non-integers double p_sum; double p_sumx; public: /// EST_SuffStats() {n = p_sum = p_sumx = 0.0;} /// EST_SuffStats(double in, double isum, double isumx) {n = in; p_sum = isum; p_sumx = isumx;} /// EST_SuffStats(const EST_SuffStats &s) { copy(s); } /// void copy(const EST_SuffStats &s) {n=s.n; p_sum = s.p_sum; p_sumx = s.p_sumx;} /// reset internal values void reset(void) {n = p_sum = p_sumx = 0.0;} void set(double in, double isum, double isumx) {n = in; p_sum = isum; p_sumx = isumx;} /// number of samples in set double samples(void) {return n;} /// sum of values double sum() { return p_sum; } /// sum of squared values double sumx() { return p_sumx; } /// mean of currently cummulated values double mean(void) const { return (n==0)?0.0:(p_sum / n); } /// variance of currently cummulated values double variance(void) const { return ((n*p_sumx)-(p_sum*p_sum))/((double)n*(n-1)); } /// standard deviation of currently cummulated values double stddev(void) const { return sqrt(variance()); } void cumulate(double a,double count=1.0) { n+=count; p_sum+=a*count; p_sumx+=count*(a*a); } /// Used to cummulate new values EST_SuffStats &operator +=(double a) { cumulate(a,1.0); return *this;} /// Used to cummulate new values EST_SuffStats &operator + (double a) { cumulate(a,1.0); return *this;} /// EST_SuffStats &operator = (const EST_SuffStats &a) { copy(a); return *this;} }; enum EST_tprob_type {tprob_string, tprob_int, tprob_discrete}; /** A class for representing probability distributions for a set of discrete values. This may be used to cummulate the probability distribution of a class of values. Values are actually help as frequencies so both frequency and probability information may be available. Note that frequencies are not integers because using smoothing and backoff integers are too restrictive so they are actually represented as doubles. Methods are provided to iterate over the values in a distribution, for example \begin{verbatim} EST_DiscreteProbistribution pdf; for (int i=pdf.item_start(); i < pdf.item_end(); i=pdf.item_next(i)) { EST_String name; double prob; item_prob(i,name,prob); cout << name << ": prob " << prob << endl; } \end{verbatim} @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_DiscreteProbDistribution { private: double num_samples; // because frequencies don't have to be integers EST_tprob_type type; /* For known vocabularies: tprob_discrete */ const EST_Discrete *discrete; // was int, but frequencies don't have to be integers EST_DVector icounts; /* For unknown vocabularies: tprob_string */ EST_StrD_KVL scounts; public: EST_DiscreteProbDistribution() : type(tprob_string), discrete(NULL), icounts(0), scounts() {init();} /// Create with copying from an existing distribution. EST_DiscreteProbDistribution(const EST_DiscreteProbDistribution &b); /// Create with given vocabulary EST_DiscreteProbDistribution(const EST_TList &vocab) {init(); (void)init(vocab);} /// Create using given \Ref{EST_Discrete} class as the vocabulary EST_DiscreteProbDistribution(const EST_Discrete *d) {init(); init(d);} /** Create using given \Ref{EST_Discrete} class as vocabulary plus given counts */ EST_DiscreteProbDistribution(const EST_Discrete *d, const double n_samples, const EST_DVector &counts); /// Destructor function ~EST_DiscreteProbDistribution() {clear();} /// Copy all data from another DPD to this void copy(const EST_DiscreteProbDistribution &b); /// Reset, clearing all counts and vocabulary void clear(void); /// Initialise using given vocabulary bool init(const EST_StrList &vocab); /// Initialise using given \Ref{EST_Discrete} as vocabulary void init(const EST_Discrete *d); /// Initialise void init(); /// Total number of example found. double samples(void) const { return num_samples; } /// Add this observation, may specify number of occurrences void cumulate(const EST_String &s,double count=1); /// Add this observation, i must be with in EST\_Discrete range void cumulate(EST_Litem *i,double count=1); void cumulate(int i,double count=1); /// Return the most probable member of the distribution const EST_String &most_probable(double *prob = NULL) const; /** Return the entropy of the distribution \[ -\sum_{i=1}^N(prob(i)*log(prob(i))) \] */ double entropy(void) const; /// double probability(const EST_String &s) const; /// double probability(const int i) const; /// double frequency(const EST_String &s) const; /// double frequency(const int i) const; /// Used for iterating through members of the distribution EST_Litem *item_start() const; /// Used for iterating through members of the distribution EST_Litem *item_next(EST_Litem *idx) const; /// Used for iterating through members of the distribution int item_end(EST_Litem *idx) const; /// During iteration returns name given index const EST_String &item_name(EST_Litem *idx) const; /// During iteration returns name and frequency given index void item_freq(EST_Litem *idx,EST_String &s,double &freq) const; /// During iteration returns name and probability given index void item_prob(EST_Litem *idx,EST_String &s,double &prob) const; /// Returns discrete vocabulary of distribution inline const EST_Discrete *const get_discrete() const { return discrete; }; /** Sets the frequency of named item, modifies {\tt num\_samples} accordingly. This is used when smoothing frequencies. */ void set_frequency(const EST_String &s,double c); /** Sets the frequency of named item, modifies {\tt num\_samples} accordingly. This is used when smoothing frequencies. */ void set_frequency(int i,double c); void set_frequency(EST_Litem *i,double c); /// Sets the frequency of named item, without modifying {\tt num\_samples}. void override_frequency(const EST_String &s,double c); /// Sets the frequency of named item, without modifying {\tt num\_samples}. void override_frequency(int i,double c); void override_frequency(EST_Litem *i,double c); /** Sets the number of samples. Care should be taken on setting this as it will affect how probabilities are calculated. */ void set_num_samples(const double c) { num_samples = c;} friend ostream & operator <<(ostream &s, const EST_DiscreteProbDistribution &p); EST_DiscreteProbDistribution &operator=(const EST_DiscreteProbDistribution &a); }; #endif // __EST_SIMPLESTATS_H__ speech_tools/include/EST_Pathname.h0000644000076400007640000001173311146561456015743 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ #ifndef __EST_PATHNAME_H__ #define __EST_PATHNAME_H__ #include "EST_String.h" #include "EST_TList.h" /** Class representing pathnames. Makes common filename manipulations * available as methods. Different implementations are provided for * different systems. */ class EST_Pathname : public EST_String { private: void setup(void); public: EST_Pathname(void) : EST_String("") { }; EST_Pathname(EST_String s) : EST_String(s) { this->setup(); }; EST_Pathname(const char *s) : EST_String(s) { this->setup(); }; static EST_Pathname construct(EST_Pathname dir, EST_String basename, EST_String extension); static EST_Pathname construct(EST_Pathname dir, EST_String filename); // component parts of a filename EST_Pathname directory(void) const; EST_Pathname filename(void) const; EST_String basename(int remove_all=0) const; EST_String extension(void) const; EST_Pathname as_file(void) const; EST_Pathname as_directory(void) const; int is_absolute(void) const; inline int is_relative(void) const {return !is_absolute();}; int is_dirname(void) const; inline int is_filename(void) const {return !is_dirname(); }; EST_TList entries(int check_for_directories = 1) const; static EST_Pathname append(EST_Pathname directory, EST_Pathname addition); static void divide(EST_Pathname path, int at, EST_Pathname &start, EST_Pathname &end); friend EST_Pathname operator + (const EST_Pathname p, const EST_Pathname addition); friend EST_Pathname operator + (const char *p, const EST_Pathname addition); // solve an ambiguity EST_Pathname &operator += (const char * addition) { return (*this) = append(*this, addition); } EST_Pathname &operator += (const EST_String addition) { return (*this) = append(*this, addition); } EST_Pathname &operator += (const EST_Pathname addition) { return (*this) = append(*this, addition); } EST_Pathname operator + (const EST_String addition) { return append(*this, EST_Pathname(addition)); } EST_Pathname operator + (const char *addition) { return append(*this, EST_Pathname(addition)); } int operator == (const EST_String thing) { return EST_String(*this) == thing; } int operator == (const char * thing) { return EST_String(*this) == EST_String(thing); } int operator != (const EST_String thing) { return EST_String(*this) != thing; } int operator != (const char * thing) { return EST_String(*this) != EST_String(thing); } }; EST_Pathname operator + (const EST_Pathname p, const EST_Pathname addition); EST_Pathname operator + (const char *p, const EST_Pathname addition); #endif speech_tools/include/EST_viterbi.h0000644000076400007640000002122510056153700015633 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* A viterbi decoder */ /* */ /* User provides the candidates, target and combine score function */ /* and it searches for the best path through the candidates */ /* */ /*=======================================================================*/ #ifndef __VERTERBI_H__ #define __VERTERBI_H__ #include "EST_cutils.h" #include "EST_Features.h" #include "ling_class/EST_Relation.h" /** Internal class to \Ref{EST_Viterbi_Decoder} used to a represent a candidate. These objects need to be created and set by the user of the Viterbi decoder. @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_VTCandidate { private: public: EST_VTCandidate() {score=0.0; next=0; s=0; } ~EST_VTCandidate() {if (next != 0) delete next;} float score; EST_Val name; int pos; EST_Item *s; EST_VTCandidate *next; }; /** Internal class to \Ref{EST_Viterbi_Decoder} used to a represent a link in a path the candidates. @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_VTPath { private: public: EST_VTPath() {score=0.0; from=0; next=0; c=0;} ~EST_VTPath() {if (next != 0) delete next;} double score; /* cumulative score for path */ int state; EST_Features f; EST_VTCandidate *c; EST_VTPath *from; EST_VTPath *next; }; /** Internal class to \Ref{EST_Viterbi_Decoder used to a node in the decoder table @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_VTPoint { private: public: EST_VTPoint() {next=0; s=0; paths=0; num_paths=0; cands=0; st_paths=0; num_states=0;} ~EST_VTPoint(); EST_Item *s; int num_states; int num_paths; EST_VTCandidate *cands; EST_VTPath *paths; EST_VTPath **st_paths; EST_VTPoint *next; }; typedef EST_VTCandidate *(*uclist_f_t)(EST_Item *s,EST_Features &f); typedef EST_VTPath *(*unpath_f_t)(EST_VTPath *p,EST_VTCandidate *c, EST_Features &f); /** A class that offers a generalised Viterbi decoder. This class can be used to find the best path through a set of candidates based on likelihoods of the candidates and some combination function. The candidate list and joining are not included in the decoder itself but are user defined functions that are specified at construction time. Those functions need to return a list of candidates and score a join of a path to a candidate and (optionally define a state). Although this offers a full Viterbi search it may also be used as a generalised beam search. See {\tt viterbi_main.cc} for an example of using this. @author Alan W Black (awb@cstr.ed.ac.uk): July 1996 */ class EST_Viterbi_Decoder { private: int num_states; /// very detailed info - for developers int debug; /// less detailed info than debug - for users int trace; int beam_width; int cand_width; int big_is_good; uclist_f_t user_clist; unpath_f_t user_npath; EST_VTPoint *timeline; /// pruning parameters bool do_pruning; float overall_path_pruning_envelope_width; float candidate_pruning_envelope_width; void add_path(EST_VTPoint *p, EST_VTPath *np); void vit_add_path(EST_VTPoint *p, EST_VTPath *np); void vit_add_paths(EST_VTPoint *p, EST_VTPath *np); EST_VTPath *find_best_end() const; const int betterthan(const float a,const float b) const; void prune_initialize(EST_VTPoint *p, double &best_score, double &best_candidate_score, double &score_cutoff, double &candidate_cutoff, int &cand_count); public: /// For holding values to pass to user called functions EST_Features f; /// Unfortunately using MAX_DOUBLE doesn't do the right thing /// (e.g. comparison don't work with MAX_DOUBLE on alphas), so /// we declare our own large number. const double vit_a_big_number; /** Construct a decoder with given candidate function and join function, as number of states is given this implies a beam search */ EST_Viterbi_Decoder(uclist_f_t a, unpath_f_t b); /** Construct a decoder with given candidate function and join function with a state size as specified. */ EST_Viterbi_Decoder(uclist_f_t a, unpath_f_t b, int num_states); /// ~EST_Viterbi_Decoder(); /// Only for use in beam search mode: number of paths to consider void set_beam_width(int w) {beam_width = w;} /// Only for use in beam search mode: number of candidates to consider void set_cand_width(int w) {cand_width = w;} /// Output some debugging information void set_debug(int d) {debug = d;} /** Define whether good scores are bigger or smaller. This allows the search to work for likelihoods probabilities, scores or whatever */ void set_big_is_good(int flag) { big_is_good = flag; } /** Add a new candidate to list if better than others, pruning the list if required. */ EST_VTCandidate *add_cand_prune(EST_VTCandidate *newcand, EST_VTCandidate *allcands); bool vit_prune_path(double path_score, double score_cutoff); /// Build the initial table from a \Ref{EST_Relation} void initialise(EST_Relation *r); /// set beam widths for pruning void set_pruning_parameters(float beam, float ob_beam); void turn_on_debug(); void turn_on_trace(); /// Do the the actual search void search(void); /** Extract the result from the table and store it as a feature on the related \Ref{EST_Item} in the given \Ref{EST_Relation} named as {\tt n}. Return FALSE if no path is found. */ bool result(const EST_String &n); /** Extract the end point of the best path found during search. Return FALSE if no path is found. */ bool result( EST_VTPath **bestPathEnd ); /// Copy named feature from the best path to related stream item void copy_feature(const EST_String &n); }; #endif // __VERTERBI_H__ speech_tools/include/EST_lattice_io.h0000644000076400007640000000606207262605664016325 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : November 1996 */ /*-----------------------------------------------------------------------*/ /* Lattice/Finite State Network i/o functions */ /* */ /*=======================================================================*/ #ifndef __EST_LATTICE_IO_H__ #define __EST_LATTICE_IO_H__ #include #include #include "sp_common_types.h" #include "wp_grammar.h" #include "EST_lattice.h" bool save(Lattice &lattice,String filename); #endif speech_tools/include/EST_lattice.h0000644000076400007640000002240207262605664015632 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : November 1996 */ /*-----------------------------------------------------------------------*/ /* Lattice/Finite State Network */ /* */ /*=======================================================================*/ #ifndef __EST_LATTICE_H__ #define __EST_LATTICE_H__ #include "EST_types.h" #include "EST_Track.h" class Lattice { public: /* struct quantised_label_table_entry_t{ int index; float value; }; */ /* struct name_map_entry_t{ int index; String name; }; */ struct symbol_t{ int qmap_index; int nmap_index; symbol_t operator += (const symbol_t s2); bool operator != (const symbol_t &s2) const; }; struct Node; struct Arc; struct Arc{ int label; Node *to; }; struct Node{ EST_IList name; // list of ints, referring to the table of names EST_TList arcs_out; }; private: protected: // not necessarily defined or used ... //friend inline ostream& operator<<(ostream &s, Lattice::quantised_label_table_entry_t &q); //friend inline ostream& operator<<(ostream& s, Lattice::name_map_entry_t &n); friend inline ostream& operator<<(ostream& s, const Lattice::symbol_t &sy); friend inline ostream& operator<<(ostream& s, const Lattice::Node &n); friend inline ostream& operator<<(ostream& s, const Lattice::Arc &n); // maps, for speed float qmap_error_margin; // only used in construction, so remove .. to do // quantised log probabilities EST_FVector qmap; // 'words' EST_TVector nmap; // not used EST_String name_as_string(EST_IList &l); // given a list of nmap indices // the finite state machines alphabet EST_TVector alphabet; int e_move_symbol_index; //int enter_move_symbol_index; //symbol_t* alphabet_lookup(int nmap_index, int qmap_index); //symbol_t* alphabet_lookup_from_end(int nmap_index, int qmap_index); int alphabet_index_lookup(int nmap_index, int qmap_index); // return index //int alphabet_index_lookup_from_end(int nmap_index, int qmap_index); // return index // the nodes EST_TList nodes; //Node* start_node; // a subset of nodes EST_TList final_nodes; // a subset of nodes bool final(Node *n); // an alternative representation is a transition function // useful (fast) for dense networks, but inefficient for sparse ones int **tf; // indexed [node index][symbol index], contains destination node bool build_transition_function(); bool build_distinguished_state_table(bool ** &dst); bool build_distinguished_state_table_direct(bool ** &dst); bool build_distinguished_state_table_from_transition_function(bool ** &dst); void sort_arc_lists(); bool link(Node *n1, Node *n2, int label); //, EST_TList *l = NULL); void merge_nodes(EST_TList &l); void merge_arcs(); void prune_arc(Node *node, Arc *arc); void prune_arcs(Node *node, EST_TList arcs); void remove_arc_from_nodes_out_list(Node *n, Arc *a); int node_index(Node *n); // only for output in HTK format // SIMONK FIX THIS // bool build_qmap(Bigram &g, float error_margin=0); // bool build_nmap(Bigram &g); public: Lattice(); ~Lattice(); // SIMONK FIX THIS // bool construct_alphabet(Bigram &g); // bool construct(Bigram &g); bool determinise(); bool prune(); bool minimise(); bool expand(); Node *start_node(); // traversing functions bool accepts(EST_TList &string); float viterbi_transduce(EST_TList &input, EST_TList &path, EST_Litem *current_symbol = NULL, Node *start_node = NULL); // observations are indexed same as wordlist, excluding !ENTER and !EXIT float viterbi_transduce(EST_Track &observations, EST_TList &path, float &score, int current_frame = 0, Node *start_node = NULL); // map lookup functions float qmap_index_to_value(int index); int qmap_value_to_index(float value); EST_String nmap_index_to_name(int index); int nmap_name_to_index(const EST_String &name); symbol_t* alphabet_index_to_symbol(int index); int alphabet_symbol_to_index(symbol_t *sym); friend bool save(Lattice &lattice, EST_String filename); friend bool load(Lattice &lattice, EST_String filename); friend class Lattice_Language_Model; }; /* inline int operator > (const Lattice::name_map_entry_t &n1, const Lattice::name_map_entry_t &n2) { return (n1.name > n2.name); }; inline int operator < (const Lattice::name_map_entry_t &n1, const Lattice::name_map_entry_t &n2) { return (n1.name < n2.name); }; */ inline int operator > (const Lattice::symbol_t s1, const Lattice::symbol_t s2) { if(s1.qmap_index > s2.qmap_index) return true; if(s1.qmap_index < s2.qmap_index) return false; return (s1.nmap_index > s2.nmap_index); } inline int operator < (const Lattice::symbol_t s1, const Lattice::symbol_t s2) { if(s1.qmap_index < s2.qmap_index) return true; if(s1.qmap_index > s2.qmap_index) return false; return (s1.nmap_index < s2.nmap_index); } inline Lattice::symbol_t operator + (const Lattice::symbol_t s1, const Lattice::symbol_t s2) { (void) s1; (void) s2; cerr << "operator + makes no sense for Lattice::symbol_t !" << endl; return Lattice::symbol_t(); } // used for sorting arcs lists inline int operator > (Lattice::Arc a1, Lattice::Arc a2) { return (a1.label > a2.label); } inline int operator < (Lattice::Arc a1, Lattice::Arc a2) { return (a1.label < a2.label); } inline int operator >= (Lattice::Arc a1, Lattice::Arc a2) { return (a1.label >= a2.label); } inline int operator <= (Lattice::Arc a1, Lattice::Arc a2) { return (a1.label <= a2.label); } inline int operator == (Lattice::Arc a1, Lattice::Arc a2) { return (a1.label == a2.label); } inline int operator == (Lattice::symbol_t s1, Lattice::symbol_t s2) { return ((s1.nmap_index == s2.nmap_index) && (s1.qmap_index == s2.qmap_index) ); } /* inline ostream& operator<<(ostream &s, Lattice::quantised_label_table_entry_t &q){ s << q.value; return s; } */ /* inline ostream& operator<<(ostream& s, Lattice::name_map_entry_t &n) { s << n.index << "=" << n.name; return s; } */ inline ostream& operator<<(ostream& s, const Lattice::symbol_t &sm) { s << "[q=" << sm.qmap_index << ",n=" << sm.nmap_index << "]"; return s; } inline ostream& operator<<(ostream& s, const Lattice::Node &n) { s << "Node:" << n.name; return s; } inline ostream& operator<<(ostream &s, const Lattice::Arc &a) { s << a.label; return s; } void sort_by_label(EST_TList &l); #endif speech_tools/include/EST_HMM.h0000644000076400007640000001060207262605664014625 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* HMM Class header file */ /* */ /*=======================================================================*/ #ifndef __EST_HMM_H__ #define __EST_HMM_H__ #include "EST_String.h" #include "EST_FMatrix.h" #include "EST_Token.h" class HMM_Mixture { private: public: HMM_Mixture(); HMM_Mixture(const HMM_Mixture &s); HMM_Mixture(int n); void init(int vsize); EST_FVector mean; EST_FVector var; float gconst; int vecsize; HMM_Mixture& operator = (const HMM_Mixture& a); }; ostream& operator<<(ostream& s, const HMM_Mixture &mix); class HMM_State { private: public: HMM_State(); HMM_State(const HMM_State &s); HMM_State(int n); void init(int n_mixes, int vsize); EST_TVector mixture; EST_FVector m_weight; HMM_State& operator = (const HMM_State& a); }; ostream& operator<<(ostream& s, const HMM_State &st); class HMM { private: public: HMM(); HMM(int n, int v); void init(int n_states, int vsize, int n_streams); EST_String name; void clear(); EST_String covkind; EST_String durkind; EST_String sampkind; EST_TVector state; EST_FMatrix trans; int num_streams; int vecsize; EST_read_status load(EST_String file); EST_read_status load_portion(EST_TokenStream &ts, int v_size, int n_streams); EST_write_status save(EST_String file); HMM& operator = (const HMM& a); void balls(void); }; ostream& operator<<(ostream& s, const HMM &model); int operator !=(const HMM_Mixture &a, const HMM_Mixture &b); int operator !=(const HMM_State &a, const HMM_State &b); typedef EST_TList EST_HMMList; #endif /* __EST_HMM_H__ */ speech_tools/include/EST_bool.h0000644000076400007640000001053010127000720015107 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 1 1997 */ /************************************************************************/ /* */ /* Temporary bool type definition. */ /* */ /************************************************************************/ #ifndef __EST_BOOL_H__ #define __EST_BOOL_H__ #if defined(__GNUC__) || defined(SYSTEM_IS_WIN32) /* GCC seems to be so very fond of bool -- it's built into * the compiler and it chokes on my definition. */ #ifdef __cplusplus extern "C" { #endif #ifndef TRUE #define TRUE (1==1) #endif #ifndef FALSE #define FALSE (1==0) #endif #ifdef __cplusplus } #endif #else /* __GNUC__ */ /* For a boring type we still #define everything for code * which uses ifdef to see if bool is defined. */ #undef true #undef false #undef TRUE #undef FALSE #ifdef __cplusplus #if 0 class BoolType { private: int p_val; public: BoolType(int i) { p_val = i!=0;}; BoolType() { p_val = 1==0;}; operator int () const { return p_val; }; BoolType operator == (BoolType b) const { return p_val == b.p_val;}; BoolType operator != (BoolType b) const { return p_val != b.p_val;}; }; #define true BoolType(1) #define false BoolType(0) #define TRUE BoolType(1) #define FALSE BoolType(0) #define bool BoolType #else /* 0 */ /* Because SunCC is stupid we pretend we can't do better than we */ /* could with C. */ #if __SUNPRO_CC_COMPAT != 5 #define bool int #endif #define TRUE (1==1) #define FALSE (1==0) #define true TRUE #define false FALSE #endif #else /* __cplusplus */ #define bool int #define TRUE (1==1) #define FALSE (1==0) #endif /* __cplusplus */ #endif /* not __GNUC__ */ #endif speech_tools/include/EST_THash.h0000644000076400007640000002657510127000720015203 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /************************************************************************/ #ifndef __EST_THASH_H__ #define __EST_THASH_H__ #include using namespace std; #include "EST_String.h" #include "EST_system.h" #include "EST_bool.h" #include "EST_TIterator.h" #include "instantiate/EST_THashI.h" #include "instantiate/EST_TStringHashI.h" /**@name Hash Tables * * @author Richard Caley * @version $Id: EST_THash.h,v 1.6 2004/09/29 08:24:17 robert Exp $ */ //@{ /** This is just a convenient place to put some useful hash functions. */ class EST_HashFunctions { public: /// A generally useful hash function. static unsigned int DefaultHash(const void *data, size_t size, unsigned int n); /// A hash function for strings. static unsigned int StringHash(const EST_String &key, unsigned int size); }; template class EST_THash; /** This class is used in hash tables to hold a key value pair. * Not much to say beyond that. */ template class EST_Hash_Pair { public: /// The key K k; /// The value V v; private: /// Pointer used to chain entries into buckets. EST_Hash_Pair *next; /// The hash table must be a friend so it can see the pointer. friend class EST_THash; }; /** An open hash table. The number of buckets should be set to allow * enough space that there are relatively few entries per bucket on * average. */ template class EST_THash : protected EST_HashFunctions { private: /// Something to return when there is no entry in the table. static V Dummy_Value; static K Dummy_Key; /// Total number of entries. unsigned int p_num_entries; /// Number of buckets. unsigned int p_num_buckets; /// Pointer to an array of p_num_bucketsbuckets. EST_Hash_Pair **p_buckets; /// The hash function to use on this table. unsigned int (*p_hash_function)(const K &key, unsigned int size); public: /** Create a table with the given number of buckets. Optionally setting * a custom hash function. */ EST_THash(int size, unsigned int (*hash_function)(const K &key, unsigned int size)= NULL); /// Create a copy EST_THash(const EST_THash &from); /// Destroy the table. ~EST_THash(void); /// Empty the table. void clear(void); /// Return the total number of entries in the table. unsigned int num_entries(void) const { return p_num_entries; }; /// Does the key have an entry? int present(const K &key) const; /** Return the value associated with the key. * found is set to whether such an entry was found. */ V &val(const K &key, int &found) const; /// Return the value associated with the key. V &val(const K &key) const {int x; return val(key, x); } const K &key(const V &val, int &found) const; const K &key(const V &val) const {int x; return key(val, x); } /// Copy all entries void copy(const EST_THash &from); /// Apply func to each entry in the table. void map(void (*func)(K&, V&)); /// Add an entry to the table. int add_item(const K &key, const V &value, int no_search = 0); /// Remove an entry from the table. int remove_item(const K &rkey, int quiet = 0); /// Assignment is a copy operation EST_THash &operator = (const EST_THash &from); /// Print the table to stream in a human readable format. void dump(ostream &stream, int all=0); /**@name Pair Iteration * * This iterator steps through the table returning key-value pairs. */ //@{ protected: /** A position in the table is given by a bucket number and a * pointer into the bucket. */ // struct IPointer{ unsigned int b; EST_Hash_Pair *p; }; struct IPointer_s{ unsigned int b; EST_Hash_Pair *p; }; typedef struct IPointer_s IPointer; /// Shift to point at something. void skip_blank(IPointer &ip) const { while (ip.p==NULL && ip.bnext; skip_blank(ip); } /// We are at the end if the pointer ever becomes NULL bool points_to_something(const IPointer &ip) const { return ip.b &points_at(const IPointer &ip) { return *(ip.p); } /// The iterator must be a friend to access this private interface. friend class EST_TStructIterator< EST_THash, IPointer, EST_Hash_Pair >; friend class EST_TRwStructIterator< EST_THash, IPointer, EST_Hash_Pair >; friend class EST_TIterator< EST_THash, IPointer, EST_Hash_Pair >; friend class EST_TRwIterator< EST_THash, IPointer, EST_Hash_Pair >; public: /// An entry returned by the iterator is a key value pair. typedef EST_Hash_Pair Entry; /// Give the iterator a sensible name. typedef EST_TStructIterator< EST_THash, IPointer, EST_Hash_Pair > Entries; typedef EST_TRwStructIterator< EST_THash, IPointer, EST_Hash_Pair > RwEntries; //@} /**@name Key Iteration * * This iterator steps through the table returning just keys. */ //@{ protected: /** A position in the table is given by a bucket number and a * pointer into the bucket. */ struct IPointer_k_s { unsigned int b; EST_Hash_Pair *p; }; typedef struct IPointer_k_s IPointer_k; /// Shift to point at something. void skip_blank(IPointer_k &ip) const { while (ip.p==NULL && ip.bnext; skip_blank(ip); } /// We are at the end if the pointer ever becomes NULL bool points_to_something(const IPointer_k &ip) const { return ip.bk; } /// The iterator must be a friend to access this private interface. friend class EST_TIterator< EST_THash, IPointer_k, K >; friend class EST_TRwIterator< EST_THash, IPointer_k, K >; public: /// An entry returned by this iterator is just a key. typedef K KeyEntry; /// Give the iterator a sensible name. typedef EST_TIterator< EST_THash, IPointer_k, K > KeyEntries; typedef EST_TRwIterator< EST_THash, IPointer_k, K > KeyRwEntries; //@} }; /** A specialised hash table for when the key is an EST_String. * * This is just a version of EST_THash which * has a different default hash function. */ template class EST_TStringHash : public EST_THash { public: /// Create a string hash table of size buckets. EST_TStringHash(int size) : EST_THash(size, EST_HashFunctions::StringHash) {}; /// An entry returned by the iterator is a key value pair. typedef EST_Hash_Pair Entry; /* struct IPointer_s{ unsigned int b; Entry *p; }; typedef struct IPointer_s IPointer; */ // Convince GCC that the IPointer we're going to use is a typename typedef typename EST_THash::IPointer TN_IPointer; /// Give the iterator a sensible name. typedef EST_TStructIterator< EST_THash, typename EST_THash::IPointer, EST_Hash_Pair > Entries; typedef EST_TRwStructIterator< EST_THash, typename EST_THash::IPointer, EST_Hash_Pair > RwEntries; //@} typedef EST_String KeyEntry; /* struct IPointer_k_s { unsigned int b; EST_Hash_Pair *p; }; typedef struct IPointer_k_s IPointer_k; */ /// Give the iterator a sensible name. // Convince GCC that the IPointer_k we're going to use is a typename typedef typename EST_THash::IPointer_k TN_IPointer_k; typedef EST_TIterator< EST_THash, typename EST_THash::IPointer_k, EST_String > KeyEntries; typedef EST_TRwIterator< EST_THash, typename EST_THash::IPointer_k, EST_String > KeyRwEntries; }; /** The default hash function used by EST_THash */ inline static unsigned int DefaultHashFunction(const void *data, size_t size, unsigned int n) { unsigned int x=0; const char *p = (const char *)data; for(; size>0 ; p++, size--) x = ((x+*p)*33) % n; return x; } //@} #endif speech_tools/include/EST_TrackMap.h0000644000076400007640000001531010127000720015657 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ #ifndef __EST_TRACKMAP_H__ #define __EST_TRACKMAP_H__ #include using namespace std; #include "EST_TNamedEnum.h" #include "EST_ChannelType.h" #include "EST_Handleable.h" #include "EST_THandle.h" /** Track maps provide a mapping from symbolic track names to the * actual position of the information within a track frame. The * symbolic names are defined by the EST_ChannelType enumerated type. * * Track maps can be declared statically by code which always uses * tracks of a given style, or they can be built at run time as * is done by lpc_analysis to record whichinformation the * user has requested. Finally they can be constructed by the Track * itself from the names of the channels, for instance when a track has * just been read in from a file. * * @see EST_Track * @see EST_ChannelType * @see EST_TrackMap:example * @author Richard Caley * @version $Id: EST_TrackMap.h,v 1.4 2004/09/29 08:24:17 robert Exp $ */ class EST_TrackMap : public EST_Handleable { public: /**@name ChannelMapping * An auxiliary type used just to define static EST_TrackMaps. * Defining one of these and then converting it to an EST_TrackMap * is, unfortunately, the only way C++ allows us to define * a constant EST_TrackMap. */ //@{ /// structure for the table. struct ChannelMappingElement { EST_ChannelType type; unsigned short channel; }; /// Table of type to position pairs. // typedef struct ChannelMappingElement ChannelMapping[]; //@} typedef EST_THandle P; public: /// Returned if we ask for a channel not in the map. # define NO_SUCH_CHANNEL (-1) private: /// The map itself. short p_map[num_channel_types]; /// Parent is looked at if this map doesn't define the position. EST_TrackMap::P p_parent; /// Subtracted from the values in the parent. int p_offset; /// No copy constructor. Don't copy these things. EST_TrackMap(EST_TrackMap &from); protected: /// Pass to creation function to turn on refcounting. #define EST_TM_REFCOUNTED (1) /// Creation function used by friends to create refcounted maps. EST_TrackMap(int refcount); /// Creation function used by friends to create sub-track maps. EST_TrackMap(const EST_TrackMap *parent, int offset, int refcount); /// copy an exiting map. void copy(EST_TrackMap &from); /// Initialise the map. void init(void); short get_parent(EST_ChannelType type) const ; public: /// Default constructor. EST_TrackMap(void); /// Copy the mapping. EST_TrackMap(EST_TrackMap &from, int refcount); /// Create from static table. EST_TrackMap(struct ChannelMappingElement map[]); ~EST_TrackMap(); /// Empty the map. void clear(void); /// Record the position of a channel. void set(EST_ChannelType type, short pos) { p_map[(int)type] = pos; } /// Get the position of a channel. short get(EST_ChannelType type) const { short c = p_map[(int)type]; return c!=NO_SUCH_CHANNEL?c:get_parent(type); } /// Get the position of a channel. short operator() (EST_ChannelType type) const { return get(type); } /// Does the mapping contain a position for this channel? bool has_channel(EST_ChannelType type) const { return p_map[(int)type] != NO_SUCH_CHANNEL || ( p_parent!=0 && p_parent->has_channel(type) ); } /// Returns the index of the last known channel. short last_channel(void) const; /// Returns the type of the channel at the given position. EST_ChannelType channel_type(unsigned short channel) const; EST_TrackMap * object_ptr() { return this; } const EST_TrackMap * object_ptr() const { return this; } friend class EST_Track; friend ostream& operator << (ostream &st, const EST_TrackMap &m); }; /** Channel name maps map textual names for track channels to symbolic * names, they are just a special case of named enums. */ typedef EST_TNamedEnum EST_ChannelNameMap; /** Table type used to create EST_ChannelNameMaps. */ typedef EST_TValuedEnumDefinition EST_ChannelNameTable[]; /// Definition of standard names we use for channels. extern EST_ChannelNameMap EST_default_channel_names; /// Definition of the names ESPS programs use for channels. extern EST_ChannelNameMap esps_channel_names; extern ostream& operator << (ostream &st, const EST_TrackMap &m); #endif speech_tools/include/EST_ChannelType.h0000644000076400007640000002563111223436124016407 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ #ifndef __EST_CHANNELTYPE_H__ #define __EST_CHANNELTYPE_H__ /**@name Channel Types */ //@{ /** Symbolic names for coefficient types. * * Used to record what kinds of information are in a track and * anywhere else we need to refer to coefficient types. * * @see EST_ChannelType */ enum EST_CoefficientType { /// Linear prediction filter cot_lpc=0, /// guaranteed to be the first known type cot_first=cot_lpc, /// reflection coefficients. cot_reflection, /// Cepstral coefficients cot_cepstrum, /// Mel Scale Cepstrum cot_melcepstrum, /// Mel Scale filter bank cot_fbank, /// Line spectral pairs. cot_lsf, /// Tube areas for filter. cot_tubearea, /// Unknown filter type. cot_filter, /// Free for experimentation cot_user1, /// Free for experimentation cot_user2, /// Guaranteed to be one more than last legal coefficient type cot_free }; /**@name Channel Type Numbering Scheme * * Channel types are given numbers containing the following information: * \begin{itemize} * \item A numeric index. * \item A Number of differentiations 0-2 * \item 0 for start, 1 for end * \end{itemize} * Things which do not require all these features are packed in according * to the following rules: * \begin{itemize} * \item Single values which can be differentiated are paired as * if they were start and end positions of an unknown type * of coefficient. * \item Single values which can't be differentiated are put in the * positions where the 3rd derivatives would logically be * found. * \end{itemize} */ //@{ /// extract the coefficient type #define EST_ChannelTypeCT(T) ( (T) >> 3 ) /// extract the number of differentiations #define EST_ChannelTypeD(T) ( (T) >> 1 & 3 ) /// extract the start/end flag. #define EST_ChannelTypeSE(T) ( (T) & 1 ) /// get start from end #define EST_ChannelTypeStart(T) EST_CoefChannelId(\ EST_ChannelTypeCT(T), \ EST_ChannelTypeD(T), \ 0) /// get end from start #define EST_ChannelTypeEnd(T) EST_CoefChannelId(\ EST_ChannelTypeCT(T), \ EST_ChannelTypeD(T), \ 1) /// differentiate once #define EST_ChannelTypeIncD(T) EST_CoefChannelId(\ EST_ChannelTypeCT(T), \ EST_ChannelTypeD(T)+1, \ EST_ChannelTypeSE(T)) /// differentiate N times #define EST_ChannelTypeDelta(T, N) EST_CoefChannelId(\ EST_ChannelTypeCT(T), \ EST_ChannelTypeD(T)+(N), \ EST_ChannelTypeSE(T)) /// integrate once #define EST_ChannelTypeDecD(T) EST_CoefChannelId(\ EST_ChannelTypeCT(T), \ EST_ChannelTypeD(T)-1, \ EST_ChannelTypeSE(T)) /** Build a number representing a channel type for a coefficient type. * * CT = coefficient type * D = Number of levels of differentiation. * SE = Start=0 end=1 */ #define EST_CoefChannelId(CT,D,SE) ( (CT)<<3 | ((D)<<1 & 6) | ((SE)&1) ) /** Build a number representing a channel type for a single value which can * N = count starting from 0 * D = Number of levels of differentiation. * be differentiated. */ #define EST_DiffChannelId(N,D) ( EST_CoefChannelId(((N)>>1)+(int)cot_free, D, (N)&1) ) /** Build a number representing a channel type for a simple value * such as length or voicing probability. */ #define EST_ChannelId(N) EST_CoefChannelId((N)>>1, 3, (N)&1) //@} /** Symbolic names for track channels. * Used in track maps to label channels so they can be accessed without * knowing exactly where in the track they are. * * @see EST_CoefficientType * @see EST_TrackMap * @see EST_Track * @see EST_TrackMap:example * @author Richard Caley * @version $Id: EST_ChannelType.h,v 1.4 2009/07/03 17:13:56 awb Exp $ */ enum EST_ChannelType { /// Value to return for errors, never occurs in TrackMaps channel_unknown = EST_ChannelId(0), /// order of analysis. channel_order = EST_ChannelId(1), /// So we know how many there are first_channel_type=channel_order, /// Peak amplitude. channel_peak = EST_ChannelId(2), /// Duration of section of signal. channel_duration = EST_ChannelId(3), /// Length of section in samples. channel_length = EST_ChannelId(4), /// Offset from frame center to center of window channel_offset = EST_ChannelId(5), /// Voicing decision. channel_voiced = EST_ChannelId(6), /// Number of related frame in another track. channel_frame = EST_ChannelId(7), /// Time in seconds this frame refers to. channel_time = EST_ChannelId(8), /// RMS power of section of signal. channel_power = EST_DiffChannelId(0,0), channel_power_d = EST_DiffChannelId(0,1), channel_power_a = EST_DiffChannelId(0,2), /// RMS energy of section of signal. channel_energy = EST_DiffChannelId(1,0), channel_energy_d = EST_DiffChannelId(1,1), channel_energy_a = EST_DiffChannelId(1,2), /// F0 in Hz. channel_f0 = EST_DiffChannelId(2,0), channel_f0_d = EST_DiffChannelId(2,1), channel_f0_a = EST_DiffChannelId(2,2), channel_lpc_0 = EST_CoefChannelId(cot_lpc,0,0), channel_lpc_N = EST_CoefChannelId(cot_lpc,0,1), channel_lpc_d_0 = EST_CoefChannelId(cot_lpc,1,0), channel_lpc_d_N = EST_CoefChannelId(cot_lpc,1,1), channel_lpc_a_0 = EST_CoefChannelId(cot_lpc,2,0), channel_lpc_a_N = EST_CoefChannelId(cot_lpc,2,1), channel_reflection_0 = EST_CoefChannelId(cot_reflection,0,0), channel_reflection_N = EST_CoefChannelId(cot_reflection,0,1), channel_reflection_d_0 = EST_CoefChannelId(cot_reflection,1,0), channel_reflection_d_N = EST_CoefChannelId(cot_reflection,1,1), channel_reflection_a_0 = EST_CoefChannelId(cot_reflection,2,0), channel_reflection_a_N = EST_CoefChannelId(cot_reflection,2,1), channel_cepstrum_0 = EST_CoefChannelId(cot_cepstrum,0,0), channel_cepstrum_N = EST_CoefChannelId(cot_cepstrum,0,1), channel_cepstrum_d_0 = EST_CoefChannelId(cot_cepstrum,1,0), channel_cepstrum_d_N = EST_CoefChannelId(cot_cepstrum,1,1), channel_cepstrum_a_0 = EST_CoefChannelId(cot_cepstrum,2,0), channel_cepstrum_a_N = EST_CoefChannelId(cot_cepstrum,2,1), channel_melcepstrum_0 = EST_CoefChannelId(cot_melcepstrum,0,0), channel_melcepstrum_N = EST_CoefChannelId(cot_melcepstrum,0,1), channel_melcepstrum_d_0 = EST_CoefChannelId(cot_melcepstrum,1,0), channel_melcepstrum_d_N = EST_CoefChannelId(cot_melcepstrum,1,1), channel_melcepstrum_a_0 = EST_CoefChannelId(cot_melcepstrum,2,0), channel_melcepstrum_a_N = EST_CoefChannelId(cot_melcepstrum,2,1), channel_fbank_0 = EST_CoefChannelId(cot_fbank,0,0), channel_fbank_N = EST_CoefChannelId(cot_fbank,0,1), channel_fbank_d_0 = EST_CoefChannelId(cot_fbank,1,0), channel_fbank_d_N = EST_CoefChannelId(cot_fbank,1,1), channel_fbank_a_0 = EST_CoefChannelId(cot_fbank,2,0), channel_fbank_a_N = EST_CoefChannelId(cot_fbank,2,1), channel_lsf_0 = EST_CoefChannelId(cot_lsf,0,0), channel_lsf_N = EST_CoefChannelId(cot_lsf,0,1), channel_lsf_d_0 = EST_CoefChannelId(cot_lsf,1,0), channel_lsf_d_N = EST_CoefChannelId(cot_lsf,1,1), channel_lsf_a_0 = EST_CoefChannelId(cot_lsf,2,0), channel_lsf_a_N = EST_CoefChannelId(cot_lsf,2,1), channel_tubearea_0 = EST_CoefChannelId(cot_tubearea,0,0), channel_tubearea_N = EST_CoefChannelId(cot_tubearea,0,1), channel_tubearea_d_0 = EST_CoefChannelId(cot_tubearea,1,0), channel_tubearea_d_N = EST_CoefChannelId(cot_tubearea,1,1), channel_tubearea_a_0 = EST_CoefChannelId(cot_tubearea,2,0), channel_tubearea_a_N = EST_CoefChannelId(cot_tubearea,2,1), channel_filter_0 = EST_CoefChannelId(cot_filter,0,0), channel_filter_N = EST_CoefChannelId(cot_filter,0,1), channel_filter_d_0 = EST_CoefChannelId(cot_filter,1,0), channel_filter_d_N = EST_CoefChannelId(cot_filter,1,1), channel_filter_a_0 = EST_CoefChannelId(cot_filter,2,0), channel_filter_a_N = EST_CoefChannelId(cot_filter,2,1), channel_user1_0 = EST_CoefChannelId(cot_user1,0,0), channel_user1_N = EST_CoefChannelId(cot_user1,0,1), channel_user1_d_0 = EST_CoefChannelId(cot_user1,1,0), channel_user1_d_N = EST_CoefChannelId(cot_user1,1,1), channel_user1_a_0 = EST_CoefChannelId(cot_user1,2,0), channel_user1_a_N = EST_CoefChannelId(cot_user1,2,1), channel_user2_0 = EST_CoefChannelId(cot_user2,0,0), channel_user2_N = EST_CoefChannelId(cot_user2,0,1), channel_user2_d_0 = EST_CoefChannelId(cot_user2,1,0), channel_user2_d_N = EST_CoefChannelId(cot_user2,1,1), channel_user2_a_0 = EST_CoefChannelId(cot_user2,2,0), channel_user2_a_N = EST_CoefChannelId(cot_user2,2,1), last_channel_type = channel_f0_a, /// Can be used to size arrays etc. num_channel_types }; //@} typedef enum EST_ChannelType EST_ChannelType; #endif speech_tools/include/EST_cmd_line_options.h0000644000076400007640000000632007262605664017533 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1994 */ /*-----------------------------------------------------------------------*/ /* Command line options */ /* */ /*=======================================================================*/ #ifndef __CMD_LINE_OPTIONS_H__ #define __CMD_LINE_OPTIONS_H__ #include "EST_String.h" EST_String options_wave_input(void); EST_String options_wave_output(void); EST_String options_track_input(void); EST_String options_track_output(void); EST_String options_pda_general(void); EST_String options_pda_srpd(void); EST_String options_io_general(void); #endif /* __CMD_LINE_OPTIONS_H__ */ speech_tools/include/EST_strcasecmp.h0000644000076400007640000000713510127000720016327 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Jun 25 1997 */ /* -------------------------------------------------------------------- */ /* */ /* Declaration for string comparison operation. */ /* */ /************************************************************************/ #ifndef __EST_STRCASECMP_H__ #define __EST_STRCASECMP_H__ #ifdef __cplusplus #include using namespace std; #else #include #endif #ifdef __cplusplus extern "C" { #endif int EST_strcasecmp(const char *s1, const char *s2, const unsigned char *charmap); int EST_strncasecmp(const char *s1, const char *s2, size_t n, const unsigned char *charmap); #ifdef __cplusplus } inline int EST_strcasecmp(const char *s1, const char *s2) { return EST_strcasecmp(s1, s2, NULL); }; inline int EST_strncasecmp(const char *s1, const char *s2, size_t n) { return EST_strncasecmp(s1, s2, n, NULL); }; #endif #endif speech_tools/include/EST_error.h0000644000076400007640000001675710127000720015326 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Thu Aug 14 1997 */ /* -------------------------------------------------------------------- */ /* Fatal error calls. */ /* */ /*************************************************************************/ #ifndef __EST_ERROR_H__ #define __EST_ERROR_H__ /* may get included from C */ #ifdef __cplusplus #include #include #else #include #include #endif #include #include "EST_unix.h" #ifdef __cplusplus extern "C" { #endif #define MAX_ERROR_MESSAGE_LENGTH 1024 typedef void (*EST_error_handler)(const char *format, ...); extern const char *EST_error_where; extern char *EST_error_message; extern EST_error_handler EST_bug_func; extern EST_error_handler EST_error_func; extern EST_error_handler EST_sys_error_func; extern EST_error_handler EST_warning_func; extern EST_error_handler old_error_function; extern EST_error_handler old_sys_error_function; extern FILE *EST_error_stream; extern FILE *EST_warning_stream; extern jmp_buf *est_errjmp; extern long errjmp_ok; extern void EST_errors_default(); extern void EST_errors_quiet(); void EST_quiet_error_fn(const char *format, ...); void EST_quiet_sys_error_fn(const char *format, ...); #define __S_(X) #X #define __s_(X) __S_(X) #define EST_bug (EST_error_where = __FILE__ ", line " __s_(__LINE__)),\ (*EST_bug_func) #if defined(EST_DEBUGGING) #define EST_exit(N) abort() #define EST_error (EST_error_where = __FILE__ ", line " __s_(__LINE__)),\ (*EST_error_func) #define EST_warning (EST_error_where = __FILE__ ", line " __s_(__LINE__)),\ (*EST_warning_func) #define EST_sys_error (EST_error_where = __FILE__ ", line " __s_(__LINE__)),\ (*EST_sys_error_func) #else #define EST_exit(N) exit(N) #define EST_error (EST_error_where = NULL),\ (*EST_error_func) #define EST_warning (EST_error_where = NULL),\ (*EST_warning_func) #define EST_sys_error (EST_error_where = NULL),\ (*EST_sys_error_func) #endif #define est_error_throw() (est_errjmp ? longjmp(*est_errjmp,1) : (void)EST_exit(-1)) #define est_error() est_error_throw() #define CATCH_ERRORS_SKEL( INIT,CLEANUP) \ { \ INIT \ jmp_buf *old_errjmp = est_errjmp; \ int old_errjmp_ok = errjmp_ok; \ errjmp_ok =1; \ est_errjmp = (jmp_buf *)malloc(sizeof(jmp_buf)); \ int jmp_val = setjmp(*est_errjmp); \ if (jmp_val) { free(est_errjmp); est_errjmp = old_errjmp; errjmp_ok = old_errjmp_ok; CLEANUP} \ if (jmp_val) #define CATCH_ERRORS() \ CATCH_ERRORS_SKEL(\ const int est_err_quiet=0; \ , \ ;) #define CATCH_ERRORS_QUIET() \ CATCH_ERRORS_SKEL(\ const int est_err_quiet=1; \ EST_error_handler old_error_function=EST_error_func; \ EST_error_handler old_sys_error_function=EST_sys_error_func; \ EST_error_func = EST_quiet_error_fn; \ EST_sys_error_func = EST_quiet_sys_error_fn; \ , \ EST_error_func=old_error_function; \ EST_sys_error_func=old_sys_error_function; \ ) #define END_CATCH_ERRORS() \ free(est_errjmp); \ est_errjmp = old_errjmp; \ errjmp_ok = old_errjmp_ok; \ if (est_err_quiet) { \ EST_error_func=old_error_function; \ EST_sys_error_func=old_sys_error_function; \ } \ } while (0) /** Defines the attitude of a call to possible fatal errors. * Passing one of these values to a function tells it how much * care it needs to take to avoid calls to EST_error. * * These need snappier names. * the numbers are their for historical reasons */ enum EST_error_behaviour { /** Function will not normally return an error unless something * really bad has gone wrong. For feature lookup, will return * default value if feature doesn't exist */ est_errors_checked = 0, /** Function will throw errors when feature doesn't exist. */ est_errors_allowed = 1, /** No fatal errors allowed. Function must catch all EST_error calls. * Will *always* return a default value. */ est_errors_never = 2 }; #ifdef __cplusplus } #include "EST_String.h" /* These are used to pass values into error functions inside */ /* templates. For classes we can define a function cast to EST_String, */ /* but we need the basic versions. */ inline const char *error_name(const EST_String val) {return val;} inline const char *error_name(const void *val) {return EST_String::cat("<>");} inline const char *error_name(const EST_Regex val) {return val.tostring();} inline const char *error_name(int val) {return EST_String::Number(val);} inline const char *error_name(long val) {return EST_String::Number(val);} inline const char *error_name(float val) {return EST_String::Number(val);} inline const char *error_name(double val) {return EST_String::Number(val);} inline const char *error_name(char val) {return EST_String::FromChar(val);} #endif #endif speech_tools/include/EST_TBuffer.h0000644000076400007640000001410310127000720015511 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name EST_TBuffer.h * Extending buffers, ie arrays which grow as needed. * I got fed up of writing equivalent code all over the place. * * @see EST_TBuffer * @author Richard Caley * @version $Id: EST_TBuffer.h,v 1.4 2004/09/29 08:24:17 robert Exp $ */ //@{ #ifndef __EST_TBUFFER_H__ #define __EST_TBUFFER_H__ #include "EST_bool.h" /// How many chunks of memory to keep around for re-use. #define TBUFFER_N_OLD (10) /// Initial size for buffers created with no size specified. #define TBUFFER_DEFAULT_SIZE 0 /// Amount to increment buffer size by. #define TBUFFER_DEFAULT_STEP 100 /** Structure to remember old buffers for re-use. * @see EST_TBuffer.h */ struct old_tbuffer { void *mem; unsigned int size; }; /// Memory of old buffers extern struct old_tbuffer EST_old_buffers[TBUFFER_N_OLD]; /** Extending buffer class. *

* This class provides the convenience of arrays which change in size * at run time rather more efficiently than the full EST_TVector class * would. *

* Buffers can only be expanded and when a buffer is no longer needed * (i.e. when the variable goes out of scope) the memory is not deleted, * rather it is saved for re-use as a new buffer. *

* A typical use would be a buffer to hold a windowed section of a signal * inside a signal processing loop where the size of the window changes from * iteration to iteration. * * @see EST_TBuffer.h, Associated definitions. * @see EST_TVector, class to use for more general uses. * @see lpc_analyse, example of use. */ template class EST_TBuffer { private: /// Pointer to memory. TYPE *p_buffer; /// Current size. unsigned int p_size; /// Amount to grow by (if negative it is a percentage). int p_step; private: /// Setup code. void init(unsigned int size, int step); /// Expand the buffer. void expand_to(unsigned int req_size, bool cpy); /// Expand and set some of it to a known value. void expand_to(unsigned int req_size, const TYPE &set_to, int howmany); public: /** Create with size and increment. * Increment can be negative for percentage growth. *

* Tries to use a buffer from EST_old_buffers[] if there is one which * is suitable * @see EST_old_buffers */ EST_TBuffer(unsigned int size=TBUFFER_DEFAULT_SIZE, int step=TBUFFER_DEFAULT_STEP); /// Destructor. Places the memory in EST_old_buffers[] for re-use if there is room. ~EST_TBuffer(void); /// Current available space. unsigned int length(void) const {return p_size;} /// Set to the given value. By default sets all values. void set(const TYPE &set_to, int howmany=-1); /**@name Methods to make sure there is enough space. */ //@{ /// Extend if needed, copying existing data. void ensure(unsigned int req_size) {if (req_size > p_size) expand_to(req_size, (bool)TRUE);} /// Make sure there is enough space, copying if requested. void ensure(unsigned int req_size, bool copy) {if (req_size > p_size) expand_to(req_size, copy,-1);} /// Make sure there is enough space, setting to a known value. void ensure(unsigned int req_size, const TYPE &set_to, int howmany=-1) {if (req_size > p_size) expand_to(req_size, set_to, howmany);} //@} /**@name Access to the memory itself. */ //@{ /// Simple access as a pointer. TYPE *b(void) {return p_buffer;} /// Read-only access when the EST_TBuffer is a constant const TYPE *b(void) const {return p_buffer;} /// operator () is simple access const TYPE &operator() (unsigned int i) const { return p_buffer[i];} TYPE &operator[] (unsigned int i) { return p_buffer[i];} const TYPE &operator[] (unsigned int i) const { return p_buffer[i];} //@} }; #endif //@} speech_tools/include/EST_Wagon.h0000644000076400007640000002521611141740701015245 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* Public declarations for Wagon (CART builder) */ /* */ /*=======================================================================*/ #ifndef __WAGON_H__ #define __WAGON_H__ #include "EST_String.h" #include "EST_Val.h" #include "EST_TVector.h" #include "EST_TList.h" #include "EST_simplestats.h" /* For EST_SuffStats class */ #include "EST_Track.h" #include "siod.h" #define wagon_error(WMESS) (cerr << WMESS << endl,exit(-1)) // I get floating point exceptions of Alphas when I do any comparisons // with HUGE_VAL or FLT_MAX so I'll make my own #define WGN_HUGE_VAL 1.0e20 class WVector : public EST_FVector { public: WVector(int n) : EST_FVector(n) {} int get_int_val(int n) const { return (int)a_no_check(n); } float get_flt_val(int n) const { return a_no_check(n); } void set_int_val(int n,int i) { a_check(n) = (int)i; } void set_flt_val(int n,float f) { a_check(n) = f; } }; typedef EST_TList WVectorList; typedef EST_TVector WVectorVector; /* Different types of feature */ enum wn_dtype {/* for predictees and predictors */ wndt_binary, wndt_float, wndt_class, /* for predictees only */ wndt_cluster, wndt_vector, wndt_matrix, wndt_trajectory, /* for ignored features */ wndt_ignore}; class WDataSet : public WVectorList { private: int dlength; EST_IVector p_type; EST_IVector p_ignore; EST_StrVector p_name; public: void load_description(const EST_String& descfname,LISP ignores); void ignore_non_numbers(); int ftype(const int &i) const {return p_type(i);} int ignore(int i) const {return p_ignore(i); } void set_ignore(int i,int value) { p_ignore[i] = value; } const EST_String &feat_name(const int &i) const {return p_name(i);} int samples(void) const {return length();} int width(void) const {return dlength;} }; enum wn_oper {wnop_equal, wnop_binary, wnop_greaterthan, wnop_lessthan, wnop_is, wnop_in, wnop_matches}; class WQuestion { private: int feature_pos; wn_oper op; int yes; int no; EST_Val operand1; EST_IList operandl; float score; public: WQuestion() {;} WQuestion(const WQuestion &s) { feature_pos=s.feature_pos; op=s.op; yes=s.yes; no=s.no; operand1=s.operand1; operandl = s.operandl; score=s.score;} ~WQuestion() {;} WQuestion(int fp, wn_oper o,EST_Val a) { feature_pos=fp; op=o; operand1=a; } void set_fp(const int &fp) {feature_pos=fp;} void set_oper(const wn_oper &o) {op=o;} void set_operand1(const EST_Val &a) {operand1 = a;} void set_yes(const int &y) {yes=y;} void set_no(const int &n) {no=n;} int get_yes(void) const {return yes;} int get_no(void) const {return no;} const int get_fp(void) const {return feature_pos;} const wn_oper get_op(void) const {return op;} const EST_Val get_operand1(void) const {return operand1;} const EST_IList &get_operandl(void) const {return operandl;} const float get_score(void) const {return score;} void set_score(const float &f) {score=f;} const int ask(const WVector &w) const; friend ostream& operator<<(ostream& s, const WQuestion &q); }; enum wnim_type {wnim_unset, wnim_float, wnim_class, wnim_cluster, wnim_vector, wnim_matrix, wnim_trajectory}; // Impurity measure for cumulating impurities from set of data class WImpurity { private: wnim_type t; EST_SuffStats a; EST_DiscreteProbDistribution p; float cluster_impurity(); float cluster_member_mean(int i); float vector_impurity(); float trajectory_impurity(); public: EST_IList members; // Maybe there should be a cluster class EST_SuffStats **trajectory; float score; int l,width; WImpurity() { t=wnim_unset; a.reset(); trajectory=0; l=0; width=0; } ~WImpurity(); WImpurity(const WVectorVector &ds); void copy(const WImpurity &s) { int i,j; t=s.t; a=s.a; p=s.p; members=s.members; l=s.l; width=s.width; score = s.score; if (s.trajectory) { trajectory = new EST_SuffStats *[l]; for (i=0; iEST_Features class, to enable features to take on values of different types. */ class EST_Val { private: val_type t; union { int ival; float fval; EST_Contents *pval;} v; // * may have a string name as well as a value EST_String sval; const int to_int() const; const float to_flt() const; const EST_String &to_str() const; public: /**@name Constructor and Destructor functions */ //@{ /** Default constructor */ EST_Val() {t=val_unset;} /** Copy constructor for another EST_Val*/ EST_Val(const EST_Val &val); /** Copy constructor for an int*/ EST_Val(const int i) {t=val_int; v.ival=i;} /** Copy constructor for a float*/ EST_Val(const float f) {t=val_float; v.fval=f;} /** Copy constructor for a double*/ EST_Val(const double d) {t=val_float; v.fval=d;} /** Copy constructor for a string*/ // EST_Val(const EST_String &s) {t=val_string; sval = s;} EST_Val(const EST_String &s) : t(val_string), sval(s) {}; /** Copy constructor for a string literal*/ // EST_Val(const char *s) {t=val_string; sval = s;} EST_Val(const char *s) : t(val_string), sval(s) {}; EST_Val(val_type type,void *p, void (*f)(void *)); /** Destructor */ ~EST_Val(void); //@} /**@name Getting cast values */ //@{ /** returns the type that the val is currently holding */ const val_type type(void) const {return t;} /** returns the value, cast as an int */ const int Int(void) const {if (t==val_int) return v.ival; return to_int();} /** returns the value, cast as an int */ const int I(void) const { return Int(); } /** returns the value, cast as a float */ const float Float(void) const {if (t==val_float) return v.fval; return to_flt();} /** returns the value, cast as a float */ const float F(void) const { return Float(); } /** returns the value, cast as a string */ const EST_String &String(void) const {if (t!=val_string) to_str(); return sval;} /** returns the value, cast as a string */ const EST_String &string(void) const {return String();} /** returns the value, cast as a string */ const EST_String &S(void) const {return String();} /** returns the value, cast as a string */ const EST_String &string_only(void) const {return sval;} //@} // Humans should never call this only automatic functions const void *internal_ptr(void) const { return v.pval->get_contents(); } /**@name Setting values */ //@{ /** Assignment of val to an int */ EST_Val &operator=(const int i) { t=val_int; v.ival=i; return *this;} /** Assignment of val to a float */ EST_Val &operator=(const float f) { t=val_float; v.fval=f; return *this;} /** Assignment of val to a double */ EST_Val &operator=(const double d) { t=val_float; v.fval=d; return *this;} /** Assignment of val to a string */ EST_Val &operator=(const EST_String &s) { t=val_string; sval = s; return *this;} /** Assignment of val to a string literal*/ EST_Val &operator=(const char *s) { t=val_string; sval = s; return *this;} /** Assignment of val to another val*/ EST_Val &operator=(const EST_Val &c); //@} /**@name Equivalence test */ //@{ /** Test whether val is equal to a*/ int operator ==(const EST_Val &a) const { if (t != a.t) return (1==0); else if (t == val_string) return (sval == a.sval); else if (t == val_int) return (v.ival == a.v.ival); else if (t == val_float) return (v.fval == a.v.fval); else return (internal_ptr() == a.internal_ptr()); } /** Test whether val is equal to the string a*/ int operator ==(const EST_String &a) const { return (string() == a); } /** Test whether val is equal to the char * a*/ int operator ==(const char *a) const { return (string() == a); } /** Test whether val is equal to the int a*/ int operator ==(const int &i) const { return (Int() == i); } /** Test whether val is equal to the float a*/ int operator ==(const float &f) const { return (Float() == f); } /** Test whether val is equal to the double a*/ int operator ==(const double &d) const { return (Float() == d); } /** Test whether val is not equal to the val a*/ int operator !=(const EST_Val &a) const { return (!(*this == a)); } /** Test whether val is not equal to the string a*/ int operator !=(const EST_String &a) const { return (string() != a); } /** Test whether val is not equal to the char * a*/ int operator !=(const char *a) const { return (string() != a); } /** Test whether val is not equal to the int a*/ int operator !=(const int &i) const { return (Int() != i);} /** Test whether val is not equal to the float a*/ int operator !=(const float &f) const { return (Float() != f); } /** Test whether val is not equal to the double float a*/ int operator !=(const double &d) const { return (Float() != d); } //@{ /**@name Automatic casting */ //@{ /** Automatically cast val as an int*/ operator int() const { return Int(); } /** Automatically cast val as an float*/ operator float() const { return Float(); } /** Automatically cast val as an string*/ operator EST_String() const { return string(); } //@} /** print val*/ friend ostream& operator << (ostream &s, const EST_Val &a) { if (a.type() == val_unset) s << "[VAL unset]" ; else if (a.type() == val_int) s << a.v.ival; else if (a.type() == val_float) s << a.v.fval; else if (a.type() == val_string) s << a.sval; else s << "[PVAL " << a.type() << "]"; return s; } }; inline const char *error_name(const EST_Val val) { return (EST_String)val;} // For consistency with other (user-defined) types in val inline EST_Val est_val(const EST_String s) { return EST_Val(s); } inline EST_Val est_val(const char *s) { return EST_Val(s); } inline int Int(const EST_Val &v) { return v.Int(); } inline EST_Val est_val(const int i) { return EST_Val(i); } inline float Float(const EST_Val &v) { return v.Float(); } inline EST_Val est_val(const float f) { return EST_Val(f); } #endif speech_tools/include/EST_Val_defs.h0000644000076400007640000002350610044502521015712 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : March 1999 */ /*-----------------------------------------------------------------------*/ /* */ /* Macros definitions for defining anything as vals */ /* */ /*=======================================================================*/ #ifndef __EST_VAL_DEFS_H__ #define __EST_VAL_DEFS_H__ /* Macro for defining new class as values public functions */ #define VAL_REGISTER_CLASS_DCLS(NAME,CLASS) \ extern val_type val_type_##NAME; \ class CLASS *NAME(const EST_Val &v); \ EST_Val est_val(const class CLASS *v); /* For things that aren't classes (typed def something else) */ #define VAL_REGISTER_TYPE_DCLS(NAME,CLASS) \ extern val_type val_type_##NAME; \ CLASS *NAME(const EST_Val &v); \ EST_Val est_val(const CLASS *v); #define VAL_REGISTER_FUNCPTR_DCLS(NAME,TYPE) \ extern val_type val_type_##NAME; \ TYPE NAME(const EST_Val &v); \ EST_Val est_val(const TYPE v); /* Macro for defining new class as values */ #define VAL_REGISTER_CLASS(NAME,CLASS) \ val_type val_type_##NAME=#NAME; \ class CLASS *NAME(const EST_Val &v) \ { \ if (v.type() == val_type_##NAME) \ return (class CLASS *)v.internal_ptr(); \ else \ EST_error("val not of type val_type_"#NAME); \ return NULL; \ } \ \ static void val_delete_##NAME(void *v) \ { \ delete (class CLASS *)v; \ } \ \ EST_Val est_val(const class CLASS *v) \ { \ return EST_Val(val_type_##NAME, \ (void *)v,val_delete_##NAME); \ } \ /* Macro for defining new typedef'd things as vals */ /* You don't need CLASS and TYPE but it often convenient */ #define VAL_REGISTER_TYPE(NAME,CLASS) \ val_type val_type_##NAME=#NAME; \ CLASS *NAME(const EST_Val &v) \ { \ if (v.type() == val_type_##NAME) \ return (CLASS *)v.internal_ptr(); \ else \ EST_error("val not of type val_type_"#NAME); \ return NULL; \ } \ \ static void val_delete_##NAME(void *v) \ { \ delete (CLASS *)v; \ } \ \ EST_Val est_val(const CLASS *v) \ { \ return EST_Val(val_type_##NAME, \ (void *)v,val_delete_##NAME); \ } \ /* Macro for defining new typedef'd things as vals that don't get deleted */ /* You don't need CLASS and TYPE but it often convenient */ #define VAL_REGISTER_TYPE_NODEL(NAME,CLASS) \ val_type val_type_##NAME=#NAME; \ CLASS *NAME(const EST_Val &v) \ { \ if (v.type() == val_type_##NAME) \ return (CLASS *)v.internal_ptr(); \ else \ EST_error("val not of type val_type_"#NAME); \ return NULL; \ } \ \ static void val_delete_##NAME(void *v) \ { \ (void)v; \ } \ \ EST_Val est_val(const CLASS *v) \ { \ return EST_Val(val_type_##NAME, \ (void *)v,val_delete_##NAME); \ } \ /* Macro for defining new class as values */ #define VAL_REGISTER_CLASS_NODEL(NAME,CLASS) \ val_type val_type_##NAME=#NAME; \ class CLASS *NAME(const EST_Val &v) \ { \ if (v.type() == val_type_##NAME) \ return (class CLASS *)v.internal_ptr(); \ else \ EST_error("val not of type val_type_"#NAME); \ return NULL; \ } \ \ static void val_delete_##NAME(void *v) \ { \ (void)v; \ } \ \ EST_Val est_val(const class CLASS *v) \ { \ return EST_Val(val_type_##NAME, \ (void *)v,val_delete_##NAME); \ } \ /* Macro for defining function pointers as values */ #define VAL_REGISTER_FUNCPTR(NAME,CLASS) \ val_type val_type_##NAME=#NAME; \ CLASS NAME(const EST_Val &v) \ { \ if (v.type() == val_type_##NAME) \ return (CLASS)v.internal_ptr(); \ else \ EST_error("val not of type val_type_"#NAME); \ return NULL; \ } \ \ static void val_delete_##NAME(void *v) \ { \ (void)v; \ } \ \ EST_Val est_val(const CLASS v) \ { \ return EST_Val(val_type_##NAME, \ (void *)v,val_delete_##NAME); \ } \ #endif speech_tools/include/EST_system.h0000644000076400007640000000650210127000720015504 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Make all systems look similar enough to unix to be easy to cope with. */ /* */ /*************************************************************************/ #if !defined(EST_SYSTEM_H) # define EST_SYSTEM_H 1 #if defined(SYSTEM_IS_WIN32) # define _WINSOCKAPI_ /* horrible hack */ # define _LPCVOID_DEFINED /* and another */ # include # include "win32/EST_defines_win32.h" # if defined(_MSC_VER) # define VISUAL_CPP 1 # endif #else # define SYSTEM_IS_UNIX 1 # include # include "unix/EST_defines_unix.h" #endif #endif speech_tools/include/EST_unix.h0000644000076400007640000000661410044502521015153 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Declare unix things. On unix just include header files, */ /* on other systems define compatibility routines */ /* */ /*************************************************************************/ #if !defined(EST_UNIX_H) # define EST_UNIX_H 1 #include "EST_system.h" #if defined(SYSTEM_IS_UNIX) # include # include # include # include # include # include # include #elif defined(SYSTEM_IS_WIN32) # include # include "win32/EST_unix_win32.h" #else # error No System Selected #endif #endif speech_tools/include/EST_socket.h0000644000076400007640000000640210127000720015447 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Various socket includes and definitions. */ /* */ /*************************************************************************/ #include "EST_system.h" #if defined(SYSTEM_IS_UNIX) # include # include # include # include # include # include "unix/EST_socket_unix.h" #elif defined(SYSTEM_IS_WIN32) # include # include "win32/EST_socket_win32.h" #else # error No System Selected #endif speech_tools/include/EST_iostream.h0000644000076400007640000000652710127000720016012 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Wrapper around iostream.h because the visual C++ clashes with some */ /* unix stuff. */ /* */ /*************************************************************************/ #if !defined(EST_IOSTREAM_H) # define EST_IOSTREAM_H 1 #include "EST_system.h" #if defined(__EMX__) /* For OS/2 */ # include using namespace std; #elif defined(SYSTEM_IS_UNIX) # include using namespace std; #elif defined(SYSTEM_IS_WIN32) # include "win32/EST_iostream_win32.h" #else # error No System Selected #endif #endif speech_tools/include/siod.h0000644000076400007640000001561607611041367014431 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * */ /*===========================================================*/ /* */ /* Public LISP functions */ /* */ /*===========================================================*/ #ifndef __SIOD_H__ #define __SIOD_H__ #include "EST_String.h" #include "EST_string_aux.h" #include "EST_error.h" #include "EST_Val.h" #include "siod_defs.h" int siod_init(int heap_size=DEFAULT_HEAP_SIZE); int siod_repl(int interactive); void siod_print_welcome(EST_String extra_info); void siod_print_welcome(void); const char *get_c_string(LISP x); int get_c_int(LISP x); double get_c_double(LISP x); float get_c_float(LISP x); LISP flocons(double x); FILE *get_c_file(LISP p,FILE *deflt); LISP siod_make_typed_cell(long type, void *s); LISP cintern(const char *name); LISP rintern(const char *name); LISP strintern(const char *data); LISP strcons(long length,const char *data); LISP cstrcons(const char *data); void init_subr(const char *name, long type, SUBR_FUNC fcn, const char *doc); void init_subr_0(const char *name, LISP (*fcn)(void), const char *doc); void init_subr_1(const char *name, LISP (*fcn)(LISP), const char *doc); void init_subr_2(const char *name, LISP (*fcn)(LISP,LISP), const char *doc); void init_subr_3(const char *name, LISP (*fcn)(LISP,LISP,LISP), const char *doc); void init_subr_4(const char *name, LISP (*fcn)(LISP,LISP,LISP,LISP), const char *doc); void init_lsubr(const char *name, LISP (*fcn)(LISP), const char *doc); void init_fsubr(const char *name, LISP (*fcn)(LISP,LISP), const char *doc); void init_msubr(const char *name, LISP (*fcn)(LISP *,LISP *), const char *doc); void setdoc(LISP name,LISP doc); int siod_register_user_type(const char *name); void set_gc_hooks(long type, int gc_free_once, LISP (*rel)(LISP), LISP (*mark)(LISP), void (*scan)(LISP), void (*free)(LISP), void (*clear)(LISP), long *kind); void set_eval_hooks(long type,LISP (*fcn)(LISP, LISP *, LISP *)); void set_type_hooks(long type, long (*c_sxhash)(LISP,long), LISP (*equal)(LISP,LISP)); void set_print_hooks(long type,void (*prin1)(LISP, FILE *), void (*print_string)(LISP, char *)); void set_io_hooks(long type, LISP (*fast_print)(LISP,LISP), LISP (*fast_read)(int,LISP)); void set_fatal_exit_hook(void (*fcn)(void)); extern long nointerrupt; extern LISP current_env; extern LISP truth; extern int audsp_mode; extern int siod_ctrl_c; extern const char *siod_prog_name; extern const char *siod_primary_prompt; extern const char *siod_secondary_prompt; void siod_reset_prompt(void); LISP siod_get_lval(const char *name,const char *message); LISP siod_set_lval(const char *name,LISP val); LISP siod_assoc_str(const char *key,LISP alist); LISP siod_member_str(const char *key,LISP list); LISP siod_regex_member_str(const EST_String &key,LISP list); EST_Regex &make_regex(const char *r); LISP siod_member_int(const int key,LISP list); LISP siod_nth(int nth,LISP list); LISP siod_last(LISP list); int siod_llength(LISP list); int siod_atomic_list(LISP list); LISP siod_flatten(LISP tree); int siod_eof(LISP item); EST_String siod_sprint(LISP exp); LISP symbol_boundp(LISP x,LISP env); LISP get_param_lisp(const char *name, LISP params, LISP defval); int get_param_int(const char *name, LISP params, int defval); float get_param_float(const char *name, LISP params, float defval); const char *get_param_str(const char *name, LISP params,const char *defval); LISP make_param_int(const char *name, int val); LISP make_param_float(const char *name, float val); LISP make_param_str(const char *name,const char *val); LISP make_param_lisp(const char *name,LISP val); LISP apply_hooks(LISP hook,LISP arg); LISP apply_hooks_right(LISP hook,LISP args); LISP apply(LISP func,LISP args); int parse_url(const EST_String &url, EST_String &protocol, EST_String &host, EST_String &port, EST_String &path); LISP err(const char *message, LISP x); LISP err(const char *message, const char *s); LISP errswitch(void); void siod_list_to_strlist(LISP l, EST_StrList &a); LISP siod_strlist_to_list(EST_StrList &a); void siod_tidy_up(); LISP siod_quit(void); const char *siod_version(void); void gc_protect(LISP *location); void gc_unprotect(LISP *location); void gc_protect_n(LISP *location,long n); void gc_protect_sym(LISP *location,const char *st); LISP user_gc(LISP args); // Siod internal function that lots of people use LISP equal(LISP,LISP); LISP eql(LISP x,LISP y); LISP reverse(LISP obj); LISP append(LISP l1, LISP l2); LISP cons(LISP x,LISP y); LISP car(LISP x); LISP cdr(LISP x); LISP consp(LISP x); LISP numberp(LISP x); LISP atomp(LISP x); LISP assoc(LISP x,LISP alist); LISP setcar(LISP cell, LISP value); LISP setcdr(LISP cell, LISP value); LISP assq(LISP x,LISP alist); LISP delq(LISP elem,LISP l); LISP leval(LISP x,LISP env); LISP symbol_value(LISP x,LISP env); LISP setvar(LISP var,LISP val,LISP env); LISP copy_list(LISP x); LISP quote(LISP item); LISP read_from_lstring(LISP x); LISP symbolexplode(LISP name); LISP fopen_c(const char *name, const char *how); LISP fclose_l(LISP p); LISP lprin1f(LISP exp,FILE *f); void pprint(LISP exp); LISP lprint(LISP exp); void pprint_to_fd(FILE *fd,LISP exp); LISP lread(void); LISP lreadtk(long j); LISP lreadf(FILE *f); #ifdef WIN32 LISP lreadwinsock(void); #endif void set_read_hooks(char *all_set,char *end_set, LISP (*fcn1)(int, struct gen_readio *), LISP (*fcn2)(char *,long, int *)); LISP vload(const char *fname,long cflag); LISP read_from_string(const char *); long repl_c_string(char *,long want_sigint,long want_init,long want_print); long repl_from_socket(int fd); void init_subrs(void); LISP stringexplode(const char *str); void fput_st(FILE *f,const char *st); LISP get_eof_val(void); #if 0 void print_hs_1(void); void print_hs_2(void); void set_repl_hooks(void (*puts_f)(char *), LISP (*read_f)(void), LISP (*eval_f)(LISP), void (*print_f)(LISP)); long repl(struct repl_hooks *); LISP lerr(LISP message, LISP x); LISP eq(LISP x,LISP y); LISP symcons(char *pname,LISP vcell); LISP symbol_value_p(LISP x,LISP env,int *set); LISP subrcons(long type, const char *name, SUBR_FUNC f); void init_storage(int heap_size=DEFAULT_HEAP_SIZE); LISP gc_status(LISP args); /* For user defined types in OBJ */ LISP oblistfn(void); LISP save_forms(LISP fname,LISP forms,LISP how); LISP intern(LISP x); void init_trace(void); LISP siod_fdopen_c(int fd,const char *name,char *how); LISP probe_file(LISP fname); LISP fopen_l(LISP name,LISP how); LISP fopen_l(LISP name,const char *how); #endif #define siod_error() (errjmp_ok ? longjmp(*est_errjmp,1) : exit(-1)) #include "siod_est.h" #endif speech_tools/include/siod_defs.h0000644000076400007640000002514610056153700015421 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : March 1999 */ /*-----------------------------------------------------------------------*/ /* */ /* Struct and macro definitions for SIOD */ /* */ /*=======================================================================*/ #ifndef __EST_SIOD_DEFS_H__ #define __EST_SIOD_DEFS_H__ /* This states the default heap size is effective unset */ /* The size if no heap is specified by a command argument, the */ /* value of the environment variable SIODHEAPSIZE will be used */ /* otherwise ACTUAL_DEFAULT_HEAP_SIZE is used. This is *not* */ /* documented because environment variables can cause so many */ /* problems I'd like to discourage this use unless absolutely */ /* necessary. */ #define DEFAULT_HEAP_SIZE -1 #define ACTUAL_DEFAULT_HEAP_SIZE 210000 struct obj {union {struct {struct obj * car; struct obj * cdr;} cons; struct {double data;} flonum; struct {const char *pname; struct obj * vcell;} symbol; struct {const char *name; struct obj * (*f)(void);} subr0; struct {const char *name; struct obj * (*f)(struct obj *);} subr1; struct {const char *name; struct obj * (*f)(struct obj *, struct obj *);} subr2; struct {const char *name; struct obj * (*f)(struct obj *, struct obj *, struct obj *); } subr3; struct {const char *name; struct obj * (*f)(struct obj *, struct obj *, struct obj *, struct obj *); } subr4; struct {const char *name; struct obj * (*f)(struct obj **, struct obj **);} subrm; struct {const char *name; struct obj * (*f)(void *,...);} subr; struct {struct obj *env; struct obj *code;} closure; struct {long dim; long *data;} long_array; struct {long dim; double *data;} double_array; struct {long dim; char *data;} string; struct {long dim; struct obj **data;} lisp_array; struct {FILE *f; char *name;} c_file; struct {EST_Val *v;} val; struct {void *p;} user; } storage_as; char *pname; // This is currently only used by FLONM short gc_mark; short type; }; #define CAR(x) ((*x).storage_as.cons.car) #define CDR(x) ((*x).storage_as.cons.cdr) #define PNAME(x) ((*x).storage_as.symbol.pname) #define VCELL(x) ((*x).storage_as.symbol.vcell) #define SUBR0(x) (*((*x).storage_as.subr0.f)) #define SUBR1(x) (*((*x).storage_as.subr1.f)) #define SUBR2(x) (*((*x).storage_as.subr2.f)) #define SUBR3(x) (*((*x).storage_as.subr3.f)) #define SUBR4(x) (*((*x).storage_as.subr4.f)) #define SUBRM(x) (*((*x).storage_as.subrm.f)) #define SUBRF(x) (*((*x).storage_as.subr.f)) #define FLONM(x) ((*x).storage_as.flonum.data) #define FLONMPNAME(x) ((*x).pname) #define USERVAL(x) ((*x).storage_as.user.p) #define UNTYPEDVAL(x) ((*x).storage_as.user.p) #define NIL ((struct obj *) 0) #define EQ(x,y) ((x) == (y)) #define NEQ(x,y) ((x) != (y)) #define NULLP(x) EQ(x,NIL) #define NNULLP(x) NEQ(x,NIL) #define TYPE(x) (((x) == NIL) ? 0 : ((*(x)).type)) #define TYPEP(x,y) (TYPE(x) == (y)) #define NTYPEP(x,y) (TYPE(x) != (y)) #define tc_nil 0 #define tc_cons 1 #define tc_flonum 2 #define tc_symbol 3 #define tc_subr_0 4 #define tc_subr_1 5 #define tc_subr_2 6 #define tc_subr_3 7 #define tc_lsubr 8 #define tc_fsubr 9 #define tc_msubr 10 #define tc_closure 11 #define tc_free_cell 12 #define tc_string 13 #define tc_double_array 14 #define tc_long_array 15 #define tc_lisp_array 16 #define tc_c_file 17 #define tc_untyped 18 #define tc_subr_4 19 #define tc_sys_1 31 #define tc_sys_2 32 #define tc_sys_3 33 #define tc_sys_4 34 #define tc_sys_5 35 // older method for adding application specific types #define tc_application_1 41 #define tc_application_2 42 #define tc_application_3 43 #define tc_application_4 44 #define tc_application_5 45 #define tc_application_6 46 #define tc_application_7 47 // Application specific types may be added using siod_register_user_type() // Will increment from tc_first_user_type to tc_table_dim #define tc_first_user_type 50 #define tc_table_dim 100 #define FO_fetch 127 #define FO_store 126 #define FO_list 125 #define FO_listd 124 typedef struct obj* LISP; typedef LISP (*SUBR_FUNC)(void); #define CONSP(x) TYPEP(x,tc_cons) #define FLONUMP(x) TYPEP(x,tc_flonum) #define SYMBOLP(x) TYPEP(x,tc_symbol) #define STRINGP(x) TYPEP(x,tc_string) #define NCONSP(x) NTYPEP(x,tc_cons) #define NFLONUMP(x) NTYPEP(x,tc_flonum) #define NSYMBOLP(x) NTYPEP(x,tc_symbol) // Not for the purists, but I find these more readable than the equivalent // code inline. #define CAR1(x) CAR(x) #define CDR1(x) CDR(x) #define CAR2(x) CAR(CDR1(x)) #define CDR2(x) CDR(CDR1(x)) #define CAR3(x) CAR(CDR2(x)) #define CDR3(x) CDR(CDR2(x)) #define CAR4(x) CAR(CDR3(x)) #define CDR4(x) CDR(CDR3(x)) #define CAR5(x) CAR(CDR4(x)) #define CDR5(x) CDR(CDR4(x)) #define LISTP(x) (NULLP(x) || CONSP(x)) #define LIST1P(x) (CONSP(x) && NULLP(CDR(x))) #define LIST2P(x) (CONSP(x) && CONSP(CDR1(x)) && NULLP(CDR2(x))) #define LIST3P(x) (CONSP(x) && CONSP(CDR1(x)) && CONSP(CDR2(x)) && NULLP(CDR3(x))) #define LIST4P(x) (CONSP(x) && CONSP(CDR1(x)) && CONSP(CDR2(x)) && CONSP(CDR3(x)) && NULLP(CDR4(x))) #define LIST5P(x) (CONSP(x) && CONSP(CDR1(x)) && CONSP(CDR2(x)) && CONSP(CDR3(x)) && CONSP(CDR4(x)) && NULLP(CDR5(x))) #define MKPTR(x) (siod_make_ptr((void *)x)) struct gen_readio {int (*getc_fcn)(char *); void (*ungetc_fcn)(int, char *); char *cb_argument;}; #define GETC_FCN(x) (*((*x).getc_fcn))((*x).cb_argument) #define UNGETC_FCN(c,x) (*((*x).ungetc_fcn))(c,(*x).cb_argument) struct repl_hooks {void (*repl_puts)(char *); LISP (*repl_read)(void); LISP (*repl_eval)(LISP); void (*repl_print)(LISP);}; /* Macro for defining new class as values public functions */ #define SIOD_REGISTER_CLASS_DCLS(NAME,CLASS) \ class CLASS *NAME(LISP x); \ int NAME##_p(LISP x); \ EST_Val est_val(const class CLASS *v); \ LISP siod(const class CLASS *v); /* Macro for defining new class as siod */ #define SIOD_REGISTER_CLASS(NAME,CLASS) \ class CLASS *NAME(LISP x) \ { \ return NAME(val(x)); \ } \ \ int NAME##_p(LISP x) \ { \ if (val_p(x) && \ (val_type_##NAME == val(x).type())) \ return TRUE; \ else \ return FALSE; \ } \ \ LISP siod(const class CLASS *v) \ { \ if (v == 0) \ return NIL; \ else \ return siod(est_val(v)); \ } \ /* Macro for defining typedefed something as values public functions */ #define SIOD_REGISTER_TYPE_DCLS(NAME,CLASS) \ CLASS *NAME(LISP x); \ int NAME##_p(LISP x); \ EST_Val est_val(const CLASS *v); \ LISP siod(const CLASS *v); /* Macro for defining new class as siod */ #define SIOD_REGISTER_TYPE(NAME,CLASS) \ CLASS *NAME(LISP x) \ { \ return NAME(val(x)); \ } \ \ int NAME##_p(LISP x) \ { \ if (val_p(x) && \ (val_type_##NAME == val(x).type())) \ return TRUE; \ else \ return FALSE; \ } \ \ LISP siod(const CLASS *v) \ { \ if (v == 0) \ return NIL; \ else \ return siod(est_val(v)); \ } \ /* Macro for defining function ptr as siod */ #define SIOD_REGISTER_FUNCPTR(NAME,CLASS) \ CLASS NAME(LISP x) \ { \ return NAME(val(x)); \ } \ \ int NAME##_p(LISP x) \ { \ if (val_p(x) && \ (val_type_##NAME == val(x).type())) \ return TRUE; \ else \ return FALSE; \ } \ \ LISP siod(const CLASS v) \ { \ if (v == 0) \ return NIL; \ else \ return siod(est_val(v)); \ } \ #endif speech_tools/include/siod_est.h0000644000076400007640000000730307262616577015313 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996-1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1999 */ /*-----------------------------------------------------------------------*/ /* */ /* Siod additions specific to Speech Tools */ /* */ /*=======================================================================*/ #ifndef __SIOD_EST_H__ #define __SIOD_EST_H__ void siod_est_init(); void siod_fringe_init(); class EST_Val &val(LISP x); int val_p(LISP x); LISP siod(const class EST_Val v); SIOD_REGISTER_CLASS_DCLS(wave,EST_Wave) SIOD_REGISTER_CLASS_DCLS(track,EST_Track) SIOD_REGISTER_CLASS_DCLS(feats,EST_Features) SIOD_REGISTER_CLASS_DCLS(utterance,EST_Utterance) SIOD_REGISTER_CLASS_DCLS(item,EST_Item) SIOD_REGISTER_CLASS_DCLS(scheme,obj) #define get_c_utt(x) (utterance(x)) #define get_c_item(x) (item(x)) LISP lisp_val(const EST_Val &pv); EST_Val val_lisp(LISP v); LISP features_to_lisp(EST_Features &f); void lisp_to_features(LISP lf,EST_Features &f); LISP kvlss_to_lisp(const EST_TKVL &kvl); void lisp_to_kvlss(LISP l, EST_TKVL &kvl); EST_Features &Param(); #endif speech_tools/include/EST_SCFG.h0000644000076400007640000003274710044502521014720 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Stochastic context free grammars */ /* */ /*=======================================================================*/ #ifndef __EST_SCFG_H__ #define __EST_SCFG_H__ #include "EST_simplestats.h" #include "EST_rw_status.h" #include "EST_TList.h" #include "siod.h" /** This class represents a bracketed string used in training of SCFGs. An object in this class builds an index of valid bracketing of the string, thus offering both a tree like access and direct access to the leafs of the tree. The definition of ``valid bracketing'' is any substring \[ W_{i,j} \] that doesn't cross any brackets. */ class EST_bracketed_string { private: int p_length; LISP *symbols; LISP bs; int **valid_spans; // triangular matrix int find_num_nodes(LISP string); int set_leaf_indices(LISP string,int i,LISP *symbols); int num_leafs(LISP l) const; void find_valid(int i,LISP t) const; void init(); public: /// EST_bracketed_string(); /// EST_bracketed_string(LISP string); /// ~EST_bracketed_string(); /// void set_bracketed_string(LISP string); /// int length() const {return p_length;} /// LISP string() const { return bs; } /// The nth symbol in the string. const EST_String symbol_at(int i) const { return EST_String(get_c_string(car(symbols[i]))); } /// If a bracketing from i to k is valid in string int valid(int i,int k) const { return valid_spans[i][k]; } /// int operator !=(const EST_bracketed_string &a) const { return (!(this == &a)); } /// friend ostream& operator << (ostream &s, const EST_bracketed_string &a) { (void)a; s << "[a bracketed string]" << endl; return s; } }; typedef EST_TVector EST_Bcorpus; // Only support Chomsky Normal Form at present enum est_scfg_rtype {est_scfg_unset, est_scfg_binary_rule, est_scfg_unary_rule}; /** A stochastic context free grammar rule. At present only two types of rule are supported: {\tt est\_scfg\_binary\_rule} and {\tt est\_scfg\_unary\_rule}. This is sufficient for the representation of grammars in Chomsky Normal Form. Each rule also has a probability associated with it. Terminals and noterminals are represented as ints using the \Ref{EST_Discrete}s in \Ref{EST_SCFG} to reference the actual alphabets. Although this class includes a ``probability'' nothing in the rule itself enforces it to be a true probability. It is responsibility of the classes that use this rule to enforce that condition if desired. @author Alan W Black (awb@cstr.ed.ac.uk): October 1997 */ class EST_SCFG_Rule { private: int p_mother; int p_daughter1; int p_daughter2; est_scfg_rtype p_type; double p_prob; public: /// EST_SCFG_Rule() {p_type=est_scfg_unset; p_prob=0;} /// EST_SCFG_Rule(const EST_SCFG_Rule &r) {p_mother = r.p_mother; p_daughter1 = r.p_daughter1; p_daughter2 = r.p_daughter2; p_type=r.p_type; p_prob = r.p_prob;} /// Create a unary rule. EST_SCFG_Rule(double prob,int p,int m); /// Create a binary rule. EST_SCFG_Rule(double prob,int p, int q, int r); /// The rule's probability double prob() const {return p_prob;} /// set the probability void set_prob(double p) { p_prob=p;} /// rule type est_scfg_rtype type() const { return p_type; } /// int mother() const {return p_mother;} /** In a unary rule this is a terminal, in a binary rule it is a nonterminal */ int daughter1() const {return p_daughter1;} /// int daughter2() const {return p_daughter2;} /// void set_rule(double prob,int p, int m); /// void set_rule(double prob,int p, int q, int r); }; typedef EST_TList SCFGRuleList; /** A class representing a stochastic context free grammar (SCFG). This class includes the representation of the grammar itself and methods for training and testing it against some corpus. At presnet of grammars in Chomsky Normal Form are supported. That is rules may be binary or unary. If binary the mother an two daughters are nonterminals, if unary the mother must be nonterminal and daughter a terminal symbol. The terminals and nonterminals symbol sets are derived automatically from the LISP representation of the rules at initialization time and are represented as \Ref{EST_Discrete}s. The distinguished symbol is assumed to be the first mother of the first rule in the given grammar. */ class EST_SCFG { private: EST_Discrete nonterminals; EST_Discrete terminals; int p_distinguished_symbol; // Index of probabilities for binary rules in grammar double ***p_prob_B; // Index of probabilities for unary rules in grammar double **p_prob_U; // Build rule probability caches void rule_prob_cache(); // Delete rule probability caches void delete_rule_prob_cache(); public: /**@name Constructor and initialisation functions */ //@{ EST_SCFG(); /// Initialize from a set of rules EST_SCFG(LISP rules); ~EST_SCFG(); //@} /**@name utility functions */ //@{ /// Set (or reset) rules from external source after construction void set_rules(LISP rules); /// Return rules as LISP list. LISP get_rules(); /// The rules themselves SCFGRuleList rules; int distinguished_symbol() const { return p_distinguished_symbol; } /** Find the terminals and nonterminals in the given grammar, adding them to the appropriate given string lists. */ void find_terms_nonterms(EST_StrList &nt, EST_StrList &t,LISP rules); /// Convert nonterminal index to string form EST_String nonterminal(int p) const { return nonterminals.name(p); } /// Convert terminal index to string form EST_String terminal(int m) const { return terminals.name(m); } /// Convert nonterminal string to index int nonterminal(const EST_String &p) const { return nonterminals.name(p); } /// Convert terminal string to index int terminal(const EST_String &m) const { return terminals.name(m); } /// Number of nonterminals int num_nonterminals() const { return nonterminals.length(); } /// Number of terminals int num_terminals() const { return terminals.length(); } /// The rule probability of given binary rule double prob_B(int p, int q, int r) const { return p_prob_B[p][q][r]; } /// The rule probability of given unary rule double prob_U(int p, int m) const { return p_prob_U[p][m]; } /// (re-)set rule probability caches void set_rule_prob_cache(); //@} /**@name file i/o functions */ //@{ /// Load grammar from named file EST_read_status load(const EST_String &filename); /// Save current grammar to named file EST_write_status save(const EST_String &filename); //@} }; /** A class used to train (and test) SCFGs is an extension of \Ref{EST_SCFG}. This offers an implementation of Pereira and Schabes ``Inside-Outside reestimation from partially bracket corpora.'' ACL 1992. A SCFG maybe trained from a corpus (optionally) containing brackets over a series of passes reestimating the grammar probabilities after each pass. This basically extends the \Ref{EST_SCFG} class adding support for a bracket corpus and various indexes for efficient use of the grammar. */ class EST_SCFG_traintest : public EST_SCFG { private: /// Index for inside probabilities double ***inside; /// Index for outside probabilities double ***outside; EST_Bcorpus corpus; /// Partial (numerator) for reestimation EST_DVector n; /// Partial (denominator) for reestimation EST_DVector d; /// Calculate inside probability. double f_I_cal(int c, int p, int i, int k); /// Lookup or calculate inside probability. double f_I(int c, int p, int i, int k) { double r; if ((r=inside[p][i][k]) != -1) return r; else return f_I_cal(c,p,i,k); } /// Calculate outside probability. double f_O_cal(int c, int p, int i, int k); /// Lookup or calculate outside probability. double f_O(int c, int p, int i, int k) { double r; if ((r=outside[p][i][k]) != -1) return r; else return f_O_cal(c,p,i,k); } /// Find probability of parse of corpus sentence {\tt c} double f_P(int c); /** Find probability of parse of corpus sentence {\tt c} for nonterminal {\tt p} */ double f_P(int c,int p); /// Re-estimate probability of binary rule using inside-outside algorithm void reestimate_rule_prob_B(int c, int ri, int p, int q, int r); /// Re-estimate probability of unary rule using inside-outside algorithm void reestimate_rule_prob_U(int c, int ri, int p, int m); /// Do grammar re-estimation void reestimate_grammar_probs(int passes, int startpass, int checkpoint, int spread, const EST_String &outfile); /// double cross_entropy(); /// Initialize the cache for inside/outside values for sentence {\tt c} void init_io_cache(int c,int nt); /// Clear the cache for inside/outside values for sentence {\tt c} void clear_io_cache(int c); public: EST_SCFG_traintest(); ~EST_SCFG_traintest(); /** Test the current grammar against the current corpus print summary. Cross entropy measure only is given. */ void test_corpus(); /** Test the current grammar against the current corpus. Summary includes percentage of cross bracketing accuracy and percentage of fully correct parses. */ void test_crossbrackets(); /** Load a corpus from the given file. Each sentence in the corpus should be contained in parentheses. Additional parenthesis may be used to denote phrasing within a sentence. The corpus is read using the LISP reader so LISP conventions shold apply, notable single quotes should appear within double quotes. */ void load_corpus(const EST_String &filename); /** Train a grammar using the loaded corpus. @param passes the number of training passes desired. @param startpass from which pass to start from @param checkpoint save the grammar every n passes @param spread Percentage of corpus to use on each pass, this cycles through the corpus on each pass. */ void train_inout(int passes, int startpass, int checkpoint, int spread, const EST_String &outfile); }; /** From a full parse, extract the string with bracketing only. */ LISP scfg_bracketing_only(LISP parse); /** Cummulate cross bracketing information between ref and test. */ void count_bracket_crossing(const EST_bracketed_string &ref, const EST_bracketed_string &test, EST_SuffStats &vs); #endif speech_tools/include/EST_SCFG_Chart.h0000644000076400007640000001752110044502521016032 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : June 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A SCFG chart parser, general functions */ /* */ /*=======================================================================*/ #ifndef __EST_SCFG_CHART_H__ #define __EST_SCFG_CHART_H__ #include "EST_String.h" #include "EST_simplestats.h" #include "EST_string_aux.h" #include "EST_SCFG.h" #include "ling_class/EST_Relation.h" class EST_SCFG_Chart_Edge; /** An internal class for \Ref{EST_SCFG_Chart} for representing edges in the chart during parsing with SCFGs. A standard Earley type chart edge, with representations for two daughters and a position or what has been recognised. A probability is also included. */ class EST_SCFG_Chart_Edge { private: int p_d1; int p_d2; int p_pos; double p_prob; public: /**@name Constructor and initialisation functions */ //@{ EST_SCFG_Chart_Edge(); EST_SCFG_Chart_Edge(double prob, int d1, int d2, int pos); ~EST_SCFG_Chart_Edge(); //@} /// Postion, 0 1 or 2, where 0 is empty, 1 is incomplete 2 is complete. int pos(void) { return p_pos; } /// Edge probability double prob(void) { return p_prob; } /// (Non)terminal of daughter 1 int d1() { return p_d1; } /// (Non)terminal of daughter 2 int d2() { return p_d2; } }; /** A class for parsing with a probabilistic grammars. The chart (sort of closer to CKY table) consists of indexes of edges indexed by vertex number of mother non-terminal. The initial values (well-formed substring table) are taken from an \Ref{EST_Stream} with a given feature. The grammar may be specified as LISP rules or as an already constructed \Ref{EST_SCFG}. This produces a single best parse. It treats the grammar as strictly context free in that the probability of a nonterminal over vertex n to m, is the sum of all the possible analyses of that sub-tree. Only the best analysis is kept for the resulting parse tree. @author Alan W Black (awb@cstr.ed.ac.uk): October 1997 */ class EST_SCFG_Chart { private: /// pointer to grammar EST_SCFG *grammar; /// TRUE is grammar was created internally, FALSE is can't be freed int grammar_local; /// Number of vertices (number of words + 1) int n_vertices; /// Index of edges by vertex start x vertex end x nonterminal EST_SCFG_Chart_Edge ****edges; /// Index of basic symbols indexed by (start) vertex. EST_SCFG_Chart_Edge **wfst; /// An empty edge, denotes 0 probability edge. EST_SCFG_Chart_Edge *emptyedge; // Find the best analysis of nonterminal {\tt p} from {\tt start} // to {\tt end}. Used after parsing double find_best_tree(int start,int end,int p) { EST_SCFG_Chart_Edge *r; if ((r=edges[start][end][p]) != 0) return r->prob(); else return find_best_tree_cal(start,end,p); } // Calculate best tree/probability double find_best_tree_cal(int start,int end,int p); void setup_edge_table(); void delete_edge_table(); LISP print_edge(int start, int end, int name, EST_SCFG_Chart_Edge *e); // Extract edge from chart and add it to stream void extract_edge(int start, int end, int p, EST_SCFG_Chart_Edge *e, EST_Item *s, EST_Item **word); // Build parse from distinguished symbol alone void extract_forced_parse(int start, int end, EST_Item *s, EST_Item *w); public: /**@name Constructor and initialisation functions */ //@{ EST_SCFG_Chart(); ~EST_SCFG_Chart(); //@} /**@name Grammar and parse string initialisation functions */ //@{ /// Initialize from LISP rules set void set_grammar_rules(LISP r); /// Initialize from existing \Ref{EST_SCFG} grammar void set_grammar_rules(EST_SCFG &grammar); /** Initialize for parsing from relation using {\tt name} feature setting up the "Well Formed Substring Table" */ void setup_wfst(EST_Relation *s,const EST_String &name="name"); /** Initialize for parsing from s to e using {\tt name} feature setting up the "Well Formed Substring Table" */ void setup_wfst(EST_Item *s, EST_Item *e,const EST_String &name="name"); //@} /**@name parsing functions */ //@{ /// Parses the loaded WFST with the loaded grammar. void parse(); /// Return the parse in full LISP form. LISP find_parse(); /// Extract parse tree and add it to syn linking leafs to word void extract_parse(EST_Relation *syn,EST_Relation *word,int force=0); /// Extract parse tree and add it to syn linking leafs to items s to e void extract_parse(EST_Relation *syn,EST_Item *s, EST_Item *e,int force=0); //@} }; /** Build a relation from a LISP list of items. */ void EST_SCFG_chart_load_relation(EST_Relation *s,LISP sent); /** Parse a given string using the given grammar. */ LISP scfg_parse(LISP string,LISP grammar); /** Parse the given string using the given \Ref{EST_SCFG}. */ LISP scfg_parse(LISP string,EST_SCFG &grammar); /** Parse named features in (list) relation Word into (tree) ** relation Syntax */ void scfg_parse(class EST_Relation *Word, const EST_String &name, class EST_Relation *Syntax, EST_SCFG &grammar); #endif speech_tools/include/EST_WFST.h0000644000076400007640000003760610044502521014760 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Weighted Finite State Transducers */ /* */ /*=======================================================================*/ #ifndef __EST_WFST_H__ #define __EST_WFST_H__ #include "EST_simplestats.h" #include "EST_rw_status.h" #include "EST_Option.h" #include "EST_TList.h" #include "EST_TVector.h" #include "EST_THash.h" #include "siod.h" #define wfst_error_msg(WMESS) (cerr << WMESS << endl,siod_error()) #define WFST_ERROR_STATE -1 class EST_WFST_State; class EST_WFST; /** an internal class for \Ref{EST_WFST} for representing transitions in an WFST */ class EST_WFST_Transition { private: float p_weight; int p_state; int p_in_symbol; int p_out_symbol; public: EST_WFST_Transition(); EST_WFST_Transition(const EST_WFST_Transition &t) { p_weight=t.p_weight; p_state=t.p_state; p_in_symbol = t.p_in_symbol; p_out_symbol=t.p_out_symbol; } EST_WFST_Transition(float w, int s, int i, int o) { p_weight=w; p_state=s; p_in_symbol=i; p_out_symbol=o;} ~EST_WFST_Transition() { }; float weight() const { return p_weight; } int state() const { return p_state; } int in_symbol() const { return p_in_symbol; } int out_symbol() const { return p_out_symbol; } void set_weight(float f) { p_weight = f; } void set_state(int s) { p_state = s; } }; typedef EST_TList wfst_translist; enum wfst_state_type {wfst_final, wfst_nonfinal, wfst_error, wfst_licence}; /** I'd like to use the enums but I need to binary read/write them **/ /** I don't believe that's portable so we need to have ints for these **/ #define WFST_FINAL 0 #define WFST_NONFINAL 1 #define WFST_ERROR 2 #define WFST_LICENCE 3 /** an internal class for \Ref{EST_WFST} used to represent a state in a WFST */ class EST_WFST_State { private: int p_name; enum wfst_state_type p_type; int p_tag; // for marking in traversing public: wfst_translist transitions; EST_WFST_State(int name); EST_WFST_State(const EST_WFST_State &state); ~EST_WFST_State(); EST_WFST_Transition *add_transition(float w, int end, int in, int out); int name() const { return p_name; } int num_transitions() const { return transitions.length(); } enum wfst_state_type type() const { return p_type; } void set_type(wfst_state_type t) { p_type = t; } void set_tag(int v) { p_tag = v;} int tag() const { return p_tag;} }; typedef EST_TVector wfst_state_vector; typedef EST_TStringHash EST_WFST_MultiStateIndex; enum wfst_mstate_type {wfst_ms_set, wfst_ms_list}; /** an internal class to \Ref{EST_WFST} used in holding multi-states when determinizing and find the intersections of other WFSTs. */ class EST_WFST_MultiState : public EST_IList { private: int p_name; float p_weight; enum wfst_mstate_type p_type; public: EST_WFST_MultiState() : EST_IList() { p_name = -1; p_weight = 0.0; p_type = wfst_ms_set; } EST_WFST_MultiState(enum wfst_mstate_type ty) : EST_IList() { p_name = -1; p_weight = 0.0; p_type = ty; } int name() const { return p_name; } void set_name(int i) { p_name = i; } float weight() const { return p_weight; } void set_weight(float w) { p_weight = w; } void set_type(enum wfst_mstate_type s) { p_type = s; } enum wfst_mstate_type type() const { return p_type; } void add(int i); }; int multistate_index(EST_WFST_MultiStateIndex &i,EST_WFST_MultiState *ms); /** a call representing a weighted finite-state transducer */ class EST_WFST { private: EST_Discrete p_in_symbols; EST_Discrete p_out_symbols; int p_start_state; int current_tag; int p_num_states; int p_cumulate; wfst_state_vector p_states; int operator_and(LISP l); int operator_or(LISP l); int operator_star(LISP l); int operator_plus(LISP l); int operator_optional(LISP l); int operator_not(LISP l); int terminal(LISP l); EST_WFST_State *copy_and_map_states(const EST_IVector &state_map, const EST_WFST_State *s, const EST_WFST &b) const; void extend_alphabets(const EST_WFST &b); int deterministiconstartstates(const EST_WFST &a, const EST_WFST &b) const; EST_read_status load_transitions_from_lisp(int s, LISP trans); void more_states(int new_max); int can_reach_final(int state); static int traverse_tag; public: /**@name Constructor and initialisation functions */ //@{ /// ? EST_WFST(); /// ? EST_WFST(const EST_WFST &wfst) { p_num_states = 0; copy(wfst); } ~EST_WFST(); //@} /**@name Reseting functions */ //@{ /// Clear with (estimation of number of states required) void init(int init_num_states=10); /// clear an initialise with given input and out alphabets void init(LISP in, LISP out); /// Copy from existing wfst void copy(const EST_WFST &wfst); /// clear removing existing states if any void clear(); //@} /**@name General utility functions */ //@{ int num_states() const { return p_num_states; } int start_state() const { return p_start_state; } /// Map input symbol to input alphabet index int in_symbol(const EST_String &s) const { return p_in_symbols.name(s); } /// Map input alphabet index to input symbol const EST_String &in_symbol(int i) const { return p_in_symbols.name(i); } /// Map output symbol to output alphabet index int out_symbol(const EST_String &s) const { return p_out_symbols.name(s); } /// Map output alphabet index to output symbol const EST_String &out_symbol(int i) const { return p_out_symbols.name(i); } /// LISP for on epsilon symbols LISP epsilon_label() const { return rintern("__epsilon__"); } /// Internal index for input epsilon int in_epsilon() const { return p_in_symbols.name("__epsilon__"); } /// Internal index for output epsilon int out_epsilon() const { return p_out_symbols.name("__epsilon__"); } /// Return internal state information const EST_WFST_State *state(int i) const { return p_states(i); } /// Return internal state information (non-const) EST_WFST_State *state_non_const(int i) { return p_states(i); } /// True if state {\tt i} is final int final(int i) const { return ((i != WFST_ERROR_STATE) && (state(i)->type() == wfst_final));} /// Accessing the input alphabet const EST_Discrete &in_symbols() const { return p_in_symbols; } /// Accessing the output alphabet const EST_Discrete &out_symbols() const { return p_out_symbols; } //@} /**@name file i/o */ //@{ /// ? EST_write_status save(const EST_String &filename, const EST_String type = "ascii"); EST_write_status save_binary(FILE *fd); /// ? EST_read_status load(const EST_String &filename); EST_read_status load_binary(FILE *fd, EST_Option &hinfo, int num_states, int swap); //@} /**@name transduction functions */ //@{ /// Find (first) new state given in and out symbols int transition(int state,int in, int out) const; int transition(int state,int in, int out, float &prob) const; /// Find (first) transition given in and out symbols EST_WFST_Transition *find_transition(int state,int in, int out) const; /// Find (first) new state given in and out strings int transition(int state,const EST_String &in,const EST_String &out) const; /// Find (first) new state given in/out string int transition(int state,const EST_String &inout) const; /// Transduce in to out from state int transduce(int state,int in,int &out) const; /// Transduce in to out (strings) from state int transduce(int state,const EST_String &in,EST_String &out) const; /// Transduce in to list of transitions void transduce(int state,int in,wfst_translist &out) const; /// Find all possible transitions for given state/input/output void transition_all(int state,int in, int out, EST_WFST_MultiState *ms) const; //@} /**@name Cumulation functions for adding collective probabilities for transitions from data */ //@{ /// Cumulation condition int cumulate() const {return p_cumulate;} /// Clear and start cumulation void start_cumulate(); /// Stop cumulation and calculate probabilities on transitions void stop_cumulate(); //@} /**@name WFST construction functions from external representations **/ //@{ /// Add a new state, returns new name int add_state(enum wfst_state_type state_type); /// Given a multi-state return type (final, ok, error) enum wfst_state_type ms_type(EST_WFST_MultiState *ms) const; /// Basic regex constructor void build_wfst(int start, int end,LISP regex); /// Basic conjunction constructor void build_and_transition(int start, int end, LISP conjunctions); /// Basic disjunction constructor void build_or_transition(int start, int end, LISP disjunctions); // from standard REGEX void build_from_regex(LISP inalpha, LISP outalpha, LISP regex); // Kay/Kaplan/Koskenniemi rule compile void kkrule_compile(LISP inalpha, LISP outalpha, LISP fp, LISP rule, LISP sets); // Build from regular (or pseudo-CF) grammar void build_from_rg(LISP inalpha, LISP outalpha, LISP distinguished, LISP rewrites, LISP sets, LISP terms, int max_depth); // Build simple tree lexicon void build_tree_lex(LISP inalpha, LISP outalpha, LISP wlist); //@} /**@name Basic WFST operators */ //@{ /// Build determinized form of a void determinize(const EST_WFST &a); /// Build minimized form of a void minimize(const EST_WFST &a); /// Build complement of a void complement(const EST_WFST &a); /** Build intersection of all WFSTs in given list. The new WFST recognizes the only the strings that are recognized by all WFSTs in the given list */ void intersection(EST_TList &wl); /** Build intersection of WFSTs a and b The new WFST recognizes the only the strings that are recognized by both a and b list */ void intersection(const EST_WFST &a, const EST_WFST &b); /** Build union of all WFSTs in given list. The new WFST recognizes the only the strings that are recognized by at least one WFSTs in the given list */ void uunion(EST_TList &wl); /** Build union of WFSTs a and b. The new WFST recognizes the only the strings that are recognized by either a or b */ void uunion(const EST_WFST &a, const EST_WFST &b); /** Build new WFST by composition of a and b. Outputs of a are fed to b, given a new WFSTs which has a's input language and b's output set. a's output and b's input alphabets must be the same */ void compose(const EST_WFST &a,const EST_WFST &b); /** Build WFST that accepts only strings in a that aren't also accepted by strings in b. */ void difference(const EST_WFST &a,const EST_WFST &b); /** Build WFST that accepts a language that consists of any string in a followed by any string in b **/ void concat(const EST_WFST &a,const EST_WFST &b); //@} /**@name construction support functions */ //@{ /// True if WFST is deterministic int deterministic() const; /// Transduce a multi-state given n and out EST_WFST_MultiState *apply_multistate(const EST_WFST &wfst, EST_WFST_MultiState *ms, int in, int out) const; /// Extend multi-state with epsilon reachable states void add_epsilon_reachable(EST_WFST_MultiState *ms) const; /// Remove error states from the WFST. void remove_error_states(const EST_WFST &a); EST_String summary() const; /// ? EST_WFST & operator = (const EST_WFST &a) { copy(a); return *this; } }; typedef EST_TList wfst_list; // The basic operations on WFST void minimize(EST_WFST &a,EST_WFST &b); void determinize(EST_WFST &a,EST_WFST &b); void concat(EST_WFST &a,EST_WFST &b,EST_WFST &c); void compose(EST_WFST &a,EST_WFST &b,EST_WFST &c); void intersect(wfst_list &wl,EST_WFST &wfst); void complement(EST_WFST &a,EST_WFST &b); void difference(EST_WFST &a,EST_WFST &b,EST_WFST &c); void concatenate(EST_WFST &a,EST_WFST &b,EST_WFST &c); // Compile a set of KK rules void kkcompile(LISP ruleset, EST_WFST &all_wfst); // Compile a set of LTS rules void ltscompile(LISP lts_rules, EST_WFST &all_wfst); // Compile a regular grammar void rgcompile(LISP rg, EST_WFST &all_wfst); // Compile a tree lexicon void tlcompile(LISP rg, EST_WFST &all_wfst); // Transduction and recognition functions int transduce(const EST_WFST &wfst,const EST_StrList &in,EST_StrList &out); int transduce(const EST_WFST &wfst,const EST_IList &in,EST_IList &out); int recognize(const EST_WFST &wfst,const EST_StrList &in,int quiet); int recognize(const EST_WFST &wfst,const EST_IList &in, const EST_IList &out,int quite); int recognize_for_perplexity(const EST_WFST &wfst, const EST_StrList &in, int quiet, float &count, float &sumlogp); int recognize_for_perplexity(const EST_WFST &wfst, const EST_IList &in, const EST_IList &out, int quiet, float &count, float &sumlogp); VAL_REGISTER_CLASS_DCLS(wfst,EST_WFST) #endif speech_tools/include/EST_Complex.h0000644000076400007640000001202710127000720015566 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor (pault@cstr.ed.ac.uk) */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* */ /*************************************************************************/ #ifndef __EST_COMPLEX_H__ #define __EST_COMPLEX_H__ #include #include using namespace std; #ifndef PI #define PI 3.14159265358979323846 #endif /** A class for complex numbers. The class stores the values as cartesian real and imaginary parts, but these can be read as polar coordinates using the {\tt mag()} and {\tt ang()} functions. Addition, subtraction, multiplication and division are supported. */ class EST_Complex { private: double r; double i; public: /**@name Constructor functions */ //@{ /// default constructor, initialises values to 0.0 EST_Complex() {r = 0.0; i = 0.0;} /// Constructor initialising real and imaginary parts EST_Complex(double real, double imag) { r = real; i = imag;} //@} /// Polar magnitude, read only double mag() const { return(sqrt(r*r+i*i)); } /// Polar angle, read only double ang(int degrees=0) const { double a; if ( r == 0. && i == 0. ) a = 0.0; else if ( r >= 0. ) a = atan(i/r); else if ( i >= 0. ) a = atan(i/r) + PI; else a = atan(i/r) - PI; return (degrees == 1) ? (a * 180 / PI) : a; } /// The real part - can be used for reading or writing double &real() {return r;} /// The imaginary part - can be used for reading or writing double &imag() {return i;} friend EST_Complex operator + (const EST_Complex& z1, const EST_Complex &z2); friend EST_Complex operator + (const EST_Complex &z, float x); friend EST_Complex operator + (float x, const EST_Complex &z); friend EST_Complex operator - (const EST_Complex &z1, const EST_Complex &z2); friend EST_Complex operator - (const EST_Complex &z, float x); friend EST_Complex operator - (float x, const EST_Complex &z); friend EST_Complex operator * (const EST_Complex &z1, const EST_Complex &z2); friend EST_Complex operator * (const EST_Complex &z, float x); friend EST_Complex operator * (float x, const EST_Complex &z); friend EST_Complex operator / (const EST_Complex &z1, const EST_Complex &z2); friend EST_Complex operator / (const EST_Complex &z, float x); friend EST_Complex operator / (float x, const EST_Complex &z); friend ostream& operator<< (ostream& s, const EST_Complex& a) { s << a.r << " " << a.i; return s;} }; #endif speech_tools/include/EST_inline_utils.h0000644000076400007640000000777010045556421016703 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /**@name EST_inline_utils.h * Some simple inline functions gathered together in one place. *

* @author Richard Caley * @version $Id: EST_inline_utils.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ //@{ #ifndef __EST_INLINE_UTILS_H__ #define __EST_INLINE_UTILS_H__ /// Round to nearest integer static inline int irint(float f) { return (int)(f+0.5); } /// Round to nearest integer static inline int irint(double f) { return (int)(f+0.5); } /// Round to nearest integer static inline int srint(float f) { return (short)(f+0.5); } /// Round to nearest integer static inline int srint(double f) { return (short)(f+0.5); } /// Round down static inline int ifloor(float f) { return (int)(f); } /// Round up static inline int iceil(float f) { return (int)(f+0.9999999); } /// Smaller of two ints static inline int min(int a, int b) { return (ab)?a:b; } /// Smaller of two floats static inline float min(float a, float b) { return (ab)?a:b; } /// Smaller of two doubles static inline double min(double a, double b) { return (ab)?a:b; } /// Absolute value. static inline short absval(short n) { return n<0?-n:n; } /// Absolute value. static inline int absval(int n) { return n<0?-n:n; } /// Absolute value. static inline float absval(float n) { return n<0.0?-n:n; } /// Absolute value. static inline double absval(double n) { return n<0.0?-n:n; } #endif //@} speech_tools/include/EST_Contents.h0000644000076400007640000001132707262605664016006 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* A class for representing ints floats and strings */ /* */ /*=======================================================================*/ #ifndef __EST_CONTENTS_H__ #define __EST_CONTENTS_H__ /** A class for containing some other (arbitrary) class Not general enough to call itself a run-time type system Is designed to solve the problem of holding user specified information. Keeps reference count to know when to delete contents This is done on two levels EST_Contents and Contents_Data */ class EST_Content_Data{ private: int refs; void *data; void (*free_func)(void *data); public: EST_Content_Data(void *d,void (*f)(void *d)) {free_func=f; data=d; refs=1;} ~EST_Content_Data() { free_func(data); } /// int unref() { return --refs; } /// int ref() { return ++refs; } /// int the_refs() { return refs; } void *contents() { return data; } EST_Content_Data &operator=(const EST_Content_Data &c) {refs = c.refs; data = c.data; free_func = free_func; return *this;} }; /** More contents */ class EST_Contents{ private: EST_Content_Data *content_data; void unref_contents(void) { if ((content_data != 0) && (content_data->unref() == 0)) delete content_data;} public: EST_Contents() { content_data = 0; } EST_Contents(void *p,void (*free_func)(void *p)) { content_data = new EST_Content_Data(p,free_func); } ~EST_Contents() { unref_contents(); } void set_contents(void *p,void (*free_func)(void *p)) { unref_contents(); content_data = new EST_Content_Data(p,free_func);} void *get_contents() const {return (content_data ? content_data->contents() : 0);} /// int refs() const { return ((content_data == 0) ? 0 : content_data->the_refs());} EST_Contents &operator=(const EST_Contents &c) { unref_contents(); content_data = c.content_data; if (content_data != 0) content_data->ref(); return *this; } }; #endif speech_tools/include/EST_FileType.h0000644000076400007640000000707007262605664015732 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* File functions for EST type files */ /* */ /*=======================================================================*/ // This is the .h file for EST generic header type parsing. // Only include this file in file i/o functions or else ott dependencies // will crop in. #ifndef __EST_FILETYPE_H__ #define __EST_FILETYPE_H__ #include "EST_Token.h" #include "EST_Option.h" typedef enum EST_EstFileType { est_file_none=0, est_file_track, est_file_wave, est_file_label, est_file_utterance, est_file_fmatrix, est_file_fvector, est_file_dmatrix, est_file_dvector, est_file_feature_data, est_file_fst, est_file_ngram, est_file_f_catalogue, est_file_index, est_file_unknown } EST_EstFileType; EST_read_status read_est_header(EST_TokenStream &ts, EST_Option &hinfo, bool &ascii, EST_EstFileType &t); #endif speech_tools/include/EST_Features.h0000644000076400007640000003114510044502521015743 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* A class for feature value pairs */ /*=======================================================================*/ #ifndef __EST_FEATURES_H__ #define __EST_FEATURES_H__ #include "EST_TKVL.h" #include "EST_Val.h" #include "EST_types.h" #include "EST_TIterator.h" #include "EST_error.h" class EST_TokenStream; class EST_String; VAL_REGISTER_CLASS_DCLS(feats,EST_Features) // This shouldn't be here and only is for older code typedef EST_Val (*EST_Item_featfunc)(class EST_Item *); EST_Val est_val(const EST_Item_featfunc f); /** A class for containing feature structures which can hold atomic values (int, float, string) or other feature structures. */ class EST_Features { protected: EST_TKVL *features; void save_fpair(ostream &outf, const EST_String &fname, const EST_Val &fvalue) const; public: static EST_Val feature_default_value; EST_Features(); EST_Features(const EST_Features &f); ~EST_Features(); /**@name Access functions which return EST_Val. Features can either be simple features, in which their name is the name of an plain attribute (e.g. "name"), or path features where their name is a dot separated path of concatenated attributes (e.g. "df.poa.alveolar"). */ //@{ /** Look up directly without decomposing name as path (just simple feature) */ const EST_Val &val(const char *name) const; /** Look up directly without decomposing name as path (just simple feature), returning def if not found */ const EST_Val &val(const char *name, const EST_Val &def) const; /** Look up feature name, which may be simple feature or path */ const EST_Val &val_path(const EST_String &path) const; /** Look up feature name, which may be simple feature or path, returning def if not found */ const EST_Val &val_path(const EST_String &path, const EST_Val &def) const; /** Look up feature name, which may be simple feature or path. */ const EST_Val &operator() (const EST_String &path) const {return val_path(path);} /** Look up feature name, which may be simple feature or path, returning def if not found */ const EST_Val &operator() (const EST_String &path, const EST_Val &def) const {return val_path(path, def);} /** Look up feature name, which may be simple feature or path. */ const EST_Val &f(const EST_String &path) const { return val_path(path); } /** Look up feature name, which may be simple feature or path, returning def if not found */ const EST_Val &f(const EST_String &path, const EST_Val &def) const { return val_path(path,def); } //@} /**@name Access functions which return types. These functions cast their EST_Val return value to a requested type, either float, int, string or features (A). In all cases the name can be a simple feature or a path, in which case their name is a dot separated string of concatenated attributes (e.g. "df.poa.alveolar"). */ //@{ /** Look up feature name, which may be simple feature or path, and return as a float */ const float F(const EST_String &path) const {return val_path(path).Float(); } /** Look up feature name, which may be simple feature or path, and return as a float, returning def if not found */ const float F(const EST_String &path, float def) const {return val_path(path, def).Float(); } /** Look up feature name, which may be simple feature or path, and return as an int */ const int I(const EST_String &path) const {return val_path(path).Int(); } /** Look up feature name, which may be simple feature or path, and return as an int, returning def if not found */ const int I(const EST_String &path, int def) const {return val_path(path, def).Int(); } /** Look up feature name, which may be simple feature or path, and return as a EST_String */ const EST_String S(const EST_String &path) const {return val_path(path).string(); } /** Look up feature name, which may be simple feature or path, and return as a EST_String, returning def if not found */ const EST_String S(const EST_String &path, const EST_String &def) const {return val_path(path, def).string(); } /** Look up feature name, which may be simple feature or path, and return as a EST_Features */ EST_Features &A(const EST_String &path) const {return *feats(val_path(path));} /** Look up feature name, which may be simple feature or path, and return as a EST_Features, returning def if not found */ EST_Features &A(const EST_String &path, EST_Features &def) const; //@} /**@name Setting features */ //@{ /** Add a new feature or set an existing feature name to value ival */ void set(const EST_String &name, int ival) { EST_Val pv(ival); set_path(name, pv);} /** Add a new feature or set an existing feature name to value fval */ void set(const EST_String &name, float fval) { EST_Val pv(fval); set_path(name, pv); } /** Add a new feature or set an existing feature name to value dval */ void set(const EST_String &name, double dval) { EST_Val pv((float)dval); set_path(name, pv); } /** Add a new feature or set an existing feature name to value sval */ void set(const EST_String &name, const EST_String &sval) { EST_Val pv(sval); set_path(name, pv); } /** Add a new feature or set an existing feature name to value cval */ void set(const EST_String &name, const char *cval) { EST_Val pv(cval); set_path(name, pv); } /** Add a new feature or set an existing feature name to value val. Name must be not be a path. */ void set_val(const EST_String &name, const EST_Val &sval) { features->add_item(name,sval); } /** Add a new feature or set an existing feature name to value val, where name is a path. */ void set_path(const EST_String &name, const EST_Val &sval); /** Add a new feature feature or set an existing feature name to value f, which is the named of a registered feature function. */ void set_function(const EST_String &name, const EST_String &f); /** Add a new feature or set an existing feature name to value f, which itself is a EST_Features. The information in f is copied into the features. */ void set(const EST_String &name, EST_Features &f) { EST_Features *ff = new EST_Features(f); set_path(name, est_val(ff)); } //@} /**@name Utility functions */ //@{ /** remove the named feature */ void remove(const EST_String &name) { features->remove_item(name,1); } /** number of features in feature structure */ int length() const { return features->length(); } /** return 1 if the feature is present */ int present(const EST_String &name) const; /** Delete all features from object */ void clear() { features->clear(); } /** Feature assignment */ EST_Features& operator = (const EST_Features& a); /** Print Features */ friend ostream& operator << (ostream &s, const EST_Features &f) { f.save(s); return s; } //@} // Iteration #if 0 EST_Litem *head() const { return features->list.head(); } EST_String &fname(EST_Litem *p) const { return features->list(p).k; } EST_Val &val(EST_Litem *p) const { return features->list(p).v; } float F(EST_Litem *p) const { return features->list(p).v.Float(); } EST_String S(EST_Litem *p) const { return features->list(p).v.string(); } int I(EST_Litem *p) const { return features->list(p).v.Int(); } EST_Features &A(EST_Litem *p) { return *feats(features->list(p).v); } #endif protected: struct IPointer { EST_TKVL::RwEntries i; }; void point_to_first(IPointer &ip) const { ip.i.begin(*features);} void move_pointer_forwards(IPointer &ip) const { ++(ip.i); } bool points_to_something(const IPointer &ip) const { return ip.i != 0; } EST_TKVI &points_at(const IPointer &ip) { return *(ip.i); } friend class EST_TIterator< EST_Features, IPointer, EST_TKVI >; friend class EST_TStructIterator< EST_Features, IPointer, EST_TKVI >; friend class EST_TRwIterator< EST_Features, IPointer, EST_TKVI >; friend class EST_TRwStructIterator< EST_Features, IPointer, EST_TKVI >; public: /**@name Iteration */ //@{ typedef EST_TKVI Entry; typedef EST_TStructIterator< EST_Features, IPointer, Entry> Entries; typedef EST_TRwStructIterator< EST_Features, IPointer, Entry> RwEntries; //@} /**@name File I/O */ //@{ /// load features from already opened EST_TokenStream EST_read_status load(EST_TokenStream &ts); /// load features from sexpression, contained in already opened EST_TokenStream EST_read_status load_sexpr(EST_TokenStream &ts); /// save features in already opened ostream EST_write_status save(ostream &outf) const; /// save features as s-expression in already opened ostream EST_write_status save_sexpr(ostream &outf) const; //@} }; inline bool operator == (const EST_Features &a,const EST_Features &b) {(void)a; (void)b; return false;} void merge_features(EST_Features &to,EST_Features &from); EST_String error_name(const EST_Features &a); #endif speech_tools/include/EST_features_aux.h0000644000076400007640000000741410045556421016673 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FEATURES_AUX_H__ #define __EST_FEATURES_AUX_H__ /** Non core feature functionality. * * @author Richard Caley * @version $Id: EST_features_aux.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ //@{ #include "EST_Features.h" class EST_String; class EST_Val; /** Safe feature access functions. * * These functions are guaranteed to return a value even if * there is an otherwise fatal error. */ //@{ /** What happened when we tried to look up a value. */ enum EST_feat_status { /// All OK, value returned. efs_ok=0, /// No value for feature, default returned efs_not_set=1, /// An error occurred and was caught. efs_error=2 }; /// Return the value as an EST_Val. EST_Val getVal(const EST_Features &f, const EST_String name, const EST_Val &def, EST_feat_status &status); /// Return the value as a string. EST_String getString(const EST_Features &f, const EST_String name, const EST_String &def, EST_feat_status &status); /// Return the values as a float. float getFloat(const EST_Features &f, const EST_String name, float def, EST_feat_status &status); /// Return the values as a float. int getInteger(const EST_Features &f, const EST_String name, int def, EST_feat_status &status); //@} VAL_REGISTER_FUNCPTR_DCLS(pointer, void *) //@} #endif speech_tools/include/EST_Featured.h0000644000076400007640000001527410045556420015741 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FEATURED_H__ #define __EST_FEATURED_H__ #include "EST_Features.h" /** A class with the mechanisms needed to give an object features and * access them nicely. Used as a parent class. * * @author Richard Caley * @version $Id: EST_Featured.h,v 1.3 2004/05/04 00:00:16 awb Exp $ */ class EST_Featured { private: EST_Features *p_features; protected: EST_Featured(void); EST_Featured(const EST_Featured &f); ~EST_Featured(void); void init_features(); void copy_features(const EST_Featured &f); void clear_features(); void ensure_features(void) { if (p_features==NULL) p_features= new EST_Features; } public: int f_Int(const char *name, int def) const { return p_features?p_features->I(name, def):def; } int f_Int(const char *name) const { return p_features?p_features->I(name):0; } int f_I(const char *name, int def) const {return f_Int(name, def);} int f_I(const char *name) const {return f_Int(name);} void f_set(const EST_String name, int val) { ensure_features(); p_features->set(name, val); } void f_set_path(const EST_String name, int val) { ensure_features(); p_features->set_path(name, val); } float f_Float(const char *name, float def) const { return p_features?p_features->F(name, def):def; } float f_Float(const char *name) const { return p_features?p_features->F(name):0.0; } float f_F(const char *name, float def) const {return f_Float(name, def);} float f_F(const char *name) const {return f_Float(name);} void f_set(const EST_String name, float val) { ensure_features(); p_features->set(name, val); } void f_set_path(const EST_String name, float val) { ensure_features(); p_features->set_path(name, val); } EST_String f_String(const char *name, const EST_String &def) const { return p_features?p_features->S(name, def):def; } EST_String f_String(const char *name) const { return p_features?p_features->S(name):EST_String::Empty; } EST_String f_S(const char *name, const EST_String &def) const {return f_String(name, def);} EST_String f_S(const char *name) const {return f_String(name);} void f_set(const EST_String name, const char *val) { ensure_features(); p_features->set(name, val); } void f_set_path(const EST_String name, const char *val) { ensure_features(); p_features->set_path(name, val); } const EST_Val &f_Val(const char *name, const EST_Val &def) const; const EST_Val &f_Val(const char *name) const; const EST_Val &f_V(const char *name, const EST_Val &def) const {return f_Val(name, def);} const EST_Val &f_V(const char *name) const {return f_Val(name);} void f_set_val(const EST_String name, EST_Val val) { ensure_features(); p_features->set_val(name, val); } void f_set_path(const EST_String name, EST_Val val) { ensure_features(); p_features->set_path(name, val); } void f_set(const EST_Features &f) { ensure_features(); *p_features = f; } int f_present(const EST_String name) const {return p_features && p_features->present(name); } void f_remove(const EST_String name) { if (p_features) p_features->remove(name); } // iteration protected: struct IPointer_feat { EST_Features::RwEntries i; }; // struct IPointer_feat { EST_TRwStructIterator< EST_Features, EST_Features::IPointer, EST_Features::Entry> i; }; void point_to_first(IPointer_feat &ip) const { if (p_features) ip.i.begin(*p_features);} void move_pointer_forwards(IPointer_feat &ip) const { ++(ip.i); } bool points_to_something(const IPointer_feat &ip) const { return ip.i != 0; } EST_TKVI &points_at(const IPointer_feat &ip) { return *(ip.i); } friend class EST_TIterator< EST_Featured, IPointer_feat, EST_TKVI >; friend class EST_TStructIterator< EST_Featured, IPointer_feat, EST_TKVI >; friend class EST_TRwIterator< EST_Featured, IPointer_feat, EST_TKVI >; friend class EST_TRwStructIterator< EST_Featured, IPointer_feat, EST_TKVI >; public: typedef EST_TKVI FeatEntry; typedef EST_TStructIterator< EST_Featured, IPointer_feat, FeatEntry> FeatEntries; typedef EST_TRwStructIterator< EST_Featured, IPointer_feat, FeatEntry> RwFeatEntries; }; #endif speech_tools/include/EST_TTimeIndex.h0000644000076400007640000000713210127000720016172 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TTIMEINDEX_H__ #define __EST_TTIMEINDEX_H__ #include /** A time index for a container. The container defines how to get an * object and so on, this lets you find a point in the container not * far before the entry you want. * * @author Richard Caley * @version $Id: EST_TTimeIndex.h,v 1.3 2004/09/29 08:24:17 robert Exp $ */ template struct EST_TTI_Entry { float t; CONTAINER::Index i; }; template class EST_TTimeIndex { public: typedef CONTAINER::Index Index; typedef EST_TTI_Entry Entry; protected: CONTAINER *p_container; EST_TVector p_entries; float p_time_step; void initialise(); private: void just_before(float time, void *in) const; public: EST_TTimeIndex(); EST_TTimeIndex(CONTAINER &c, int bunch=10); void index(CONTAINER &c, int bunch=10); void just_before(float time, Index &in) const { just_before(time, &in); } }; template extern int operator !=(const EST_TTI_Entry &e1, const EST_TTI_Entry &e2); template extern ostream& operator <<( ostream &s, const EST_TTI_Entry &e); #endif speech_tools/include/EST_THandle.h0000644000076400007640000001327010457524614015522 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_THANDLE_H__ #define __EST_THANDLE_H__ #include using namespace std; #include "EST_bool.h" /** A `smart' pointer which does reference counting. * * Behaves almost like a pointer as far as naive code is concerned, but * keeps count of how many handles are holding on to the contents * and deletes it when there are none. * * You need to be careful there are no dumb C++ pointers to things which * are being handled this way. * * Things to be handled should implement the same interface as EST_Handleable * (either by taking that as a superclass or by reimplementing it) and in * addition define {\tt object_ptr()}. See EST_TBox for an example. * * There are two parameter types. In most cases the thing which contains the * reference count and the data it represents will be the same object, but * in the case of boxed values it may not be, so you can specify the type * of both independently. * * @see EST_Handleable * @see EST_TBox * @see EST_THandle:example * * @author Richard Caley * @version $Id: EST_THandle.h,v 1.5 2006/07/19 21:52:12 awb Exp $ */ template class EST_THandle { private: BoxT *ptr; public: EST_THandle(void) { ptr = (BoxT *)NULL; } EST_THandle(BoxT *p) { if ((ptr=p)) p->inc_refcount(); } EST_THandle(const EST_THandle &cp) { ptr=cp.ptr; if (ptr) ptr->inc_refcount(); } ~EST_THandle(void) { if (ptr) ptr->dec_refcount(); if (ptr && ptr->is_unreferenced()) delete ptr; } bool null() const { return ptr == NULL; } int shareing(void) const { return ptr?(ptr->refcount() > 1):0; } EST_THandle &operator = (EST_THandle h) { // doing it in this order means self assignment is safe. if (h.ptr) (h.ptr)->inc_refcount(); if (ptr) ptr->dec_refcount(); if (ptr && ptr->is_unreferenced()) delete ptr; ptr=h.ptr; return *this; } // If they manage to get hold of one... // Actually usually used to assign NULL and so (possibly) deallocate // the object currently pointed to. EST_THandle &operator = (BoxT *t_ptr) { // doing it in this order means self assignment is safe. if (t_ptr) t_ptr->inc_refcount(); if (ptr) ptr->dec_refcount(); if (ptr && ptr->is_unreferenced()) delete ptr; ptr=t_ptr; return *this; } operator ObjectT *() { return ptr?(ptr->object_ptr()):(ObjectT *)NULL; } operator const ObjectT *() const { return ptr?(ptr->object_ptr()):(const ObjectT *)NULL; } int operator == (const BoxT *p) const { return ptr == p; } int operator != (const BoxT *p) const { return !(*this == p); } const ObjectT& operator *() const { return *(ptr->object_ptr()); } ObjectT& operator *() { return *(ptr->object_ptr()); } const ObjectT* operator ->() const { return (ptr->object_ptr()); } ObjectT* operator ->() { return (ptr->object_ptr()); } friend int operator == (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > & b) {return a.ptr==b.ptr; } friend int operator != (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > & b) { return !( a==b ); } friend ostream & operator << (ostream &s, const EST_THandle< BoxT, ObjectT > &a) { return s << "HANDLE"; } }; #endif speech_tools/include/EST_Handleable.h0000644000076400007640000000661310127000720016202 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_HANDLABLE_H__ #define __EST_HANDLABLE_H__ /** Reference Counting Interface. * * This simple class does most of the things an object which is to be * manipulated by EST_THandle style smart pointers needs to provide. * * @see EST_THandle * @see EST_TBox * @see EST_TrackMap * @author Richard Caley * @version $Id: EST_Handleable.h,v 1.4 2004/09/29 08:24:17 robert Exp $ */ #include using namespace std; class EST_Handleable { private: int p_refcount; public: # define NOT_REFCOUNTED (INT_MAX) EST_Handleable(void) { p_refcount=NOT_REFCOUNTED; } int refcount(void) const { return p_refcount;} void start_refcounting(int initial=0) {p_refcount=initial;} void inc_refcount(void) {if (p_refcount!=NOT_REFCOUNTED) p_refcount++;} void dec_refcount(void) {if (p_refcount!=NOT_REFCOUNTED) p_refcount--;} int is_unreferenced(void) const {return p_refcount == 0;} int is_refcounted(void) const {return p_refcount!= NOT_REFCOUNTED;} //@} }; #endif speech_tools/include/EST_TBox.h0000644000076400007640000000615007262616577015070 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TBOX_H__ #define __EST_TBOX_H__ /** Box for putting things in. The box and the thing can then be refcounted * as a unit. * * @author Richard Caley * @version $Id: EST_TBox.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #include "EST_Handleable.h" template class EST_TBox : public EST_Handleable { private: T * const p_contents; /// This never happens. EST_TBox(void) : p_contents(NULL) {}; public: EST_TBox(T *c) : p_contents(c) { start_refcounting(); } ~EST_TBox(void) { delete p_contents; } T *object_ptr() { return p_contents; } const T *object_ptr() const { return p_contents; } T *c() { return p_contents; } const T *c() const { return p_contents; } }; #endif speech_tools/include/EST_TIterator.h0000644000076400007640000002315110045556420016110 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ #ifndef __EST_TITERATOR_H__ #define __EST_TITERATOR_H__ /** Template class defining interface to an iterator, i.e an object * which returns elements from a structure one at a time. * * This is template is usually hidden in the declaration of the * container classes with a typedef for Entries providing a more * convenient name for the iterator. However the interface is that * defined here. * * We support two interfaces, a pointer like interface similar to * specialised iteration code elsewhere in the speech tools library * and to the iterators in the C++ standard template library and an * interface similar to that of Enumerations in Java. * * * MyContainer::Entries them; * * for(them.begin(container); them; them++) * { * MyContainer::Entry &it = *them; * // Do Something With it * } * * * MyContainer::Entries them; * * them.begin(container); * while (them.has_more_entries()) * { * MyContainer::Entry &it = them.next_entry(); * // Do Something With it * } * * @author Richard Caley * @version $Id: EST_TIterator.h,v 1.6 2004/05/04 00:00:16 awb Exp $ */ template class EST_TStructIterator; template class EST_TRwIterator; template class EST_TRwStructIterator; template class EST_TIterator { protected: /// The container we are looking at. Container *cont; /// Position in the structure. May or may not be useful. unsigned int pos; /** Structure defined by the container class which contains the * current state of the iteration. */ IPointer pointer; public: /// Name for an iterator like this typedef EST_TIterator Iter; /// Create an iterator not associated with any specific container. EST_TIterator() {cont=NULL;} /// Create an iterator ready to run over the given container. EST_TIterator(const Container &over) { begin(over); } /// Copy an iterator by assignment Iter &operator = (const Iter &orig) { cont=orig.cont; pos=orig.pos; pointer=orig.pointer; return *this;} /// Assigning a container to an iterator sets it ready to start. Iter &operator = (const Container &over) { begin(over); return *this;} /// Set the iterator ready to run over this container. void begin(const Container &over) {cont=((Container *)(void *)&over); beginning();} /// Reset to the start of the container. void beginning() {if (cont) cont->point_to_first(pointer); pos=0;} /**@name End Tests */ //@{ /// True if there are more elements to look at. bool has_more_elements() const {return cont && cont->points_to_something(pointer);} /// True when there are no more. bool at_end() const {return !has_more_elements();} /** Viewing the iterator as an integer (for instance in a test) * sees a non-zero value iff there are elements still to look at. */ operator int() const {return has_more_elements();} //@} /**@name Moving Forward */ //@{ /// Next moves to the next entry. void next() {cont->move_pointer_forwards(pointer); pos++;} /// The increment operator does the same as next. Iter &operator ++() {next(); return *this;} Iter operator ++(int dummy) { (void)dummy; Iter old =*this; next(); return old; } //@} /**@name Access */ //@{ /// Return the element currently pointed to. const Entry& current() const {return cont->points_at(pointer);} /// The * operator returns the current element. const Entry &operator *() const {return current();} #if 0 // This only works for some Entry types. const Entry *operator ->() const {return ¤t();} #endif /// Return the current element and move the pointer forwards. const Entry& next_element() { const Entry &it = cont->points_at(pointer); cont->move_pointer_forwards(pointer); return it; } /// Return the current position unsigned int n() const { return pos; } //@} friend class EST_TStructIterator ; friend class EST_TRwIterator ; friend class EST_TRwStructIterator ; }; template class EST_TStructIterator : public EST_TIterator { public: typedef EST_TIterator Iter; /// Create an iterator not associated with any specific container. EST_TStructIterator() {this->cont=NULL;} /// Copy an iterator by assignment Iter &operator = (const Iter &orig) { this->cont=orig.cont; this->pos=orig.pos; this->pointer=orig.pointer; return *this;} /// Create an iterator ready to run over the given container. EST_TStructIterator(const Container &over) { begin(over); } const Entry *operator ->() const {return &this->current();} }; template class EST_TRwIterator : public EST_TIterator { private: /// Can't access constant containers this way. // EST_TRwIterator(const Container &over) { (void) over; } /// Can't access constant containers this way. // void begin(const Container &over) { (void) over; } public: typedef EST_TIterator Iter; /// Create an iterator not associated with any specific container. EST_TRwIterator() {this->cont=NULL;} /// Copy an iterator by assignment Iter &operator = (const Iter &orig) { this->cont=orig.cont; this->pos=orig.pos; this->pointer=orig.pointer; return *this;} /// Create an iterator ready to run over the given container. EST_TRwIterator(Container &over) { begin(over); } /// Set the iterator ready to run over this container. void begin(Container &over) {this->cont=&over; this->beginning();} /**@name Access */ //@{ /// Return the element currently pointed to. Entry& current() const {return this->cont->points_at(this->pointer);} /// The * operator returns the current element. Entry &operator *() const {return current();} #if 0 Entry *operator ->() const {return ¤t();} #endif /// Return the current element and move the pointer forwards. Entry& next_element() { Entry &it = this->cont->points_at(this->pointer); this->cont->move_pointer_forwards(this->pointer); return it; } //@} }; template class EST_TRwStructIterator : public EST_TRwIterator { public: typedef EST_TIterator Iter; /// Create an iterator not associated with any specific container. EST_TRwStructIterator() {this->cont=NULL;} /// Copy an iterator by assignment Iter &operator = (const Iter &orig) { this->cont=orig.cont; this->pos=orig.pos; this->pointer=orig.pointer; return *this;} /// Create an iterator ready to run over the given container. EST_TRwStructIterator(Container &over) { begin(over); } Entry *operator ->() const {return &this->current();} }; #endif speech_tools/include/EST_kalman.h0000644000076400007640000000677707262605664015471 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : November 1996 */ /*-----------------------------------------------------------------------*/ /* Lattice/Finite State Network */ /* */ /*=======================================================================*/ #ifndef __EST_KALMAN_H__ #define __EST_KALMAN_H__ bool kalman_filter(EST_FVector &x_state, EST_FMatrix &P_estimate_error_covariance, EST_FMatrix &Q_process_noise_covariance, EST_FMatrix &R_measurement_noise_covariance, EST_FMatrix &A_state_time_step_model, EST_FMatrix &H_state_to_measurement_model, EST_FVector &z_measurement); bool kalman_filter_Pinv(EST_FVector &x_state, EST_FMatrix &Pinv_estimate_error_covariance_inverse, EST_FMatrix &Q_process_noise_covariance, EST_FMatrix &Rinv_measurement_noise_covariance_inverse, EST_FMatrix &A_state_time_step_model, EST_FMatrix &H_state_to_measurement_model, EST_FVector &z_measurement); #endif speech_tools/include/EST_TDeque.h0000644000076400007640000000767110457524614015402 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TDEQUE_H__ #define __EST_TDEQUE_H__ #include "EST_TVector.h" #include "instantiate/EST_TDequeI.h" /** Double ended queue. * * @author Richard Caley * @version $Id: EST_TDeque.h,v 1.3 2006/07/19 21:52:12 awb Exp $ */ template class EST_TDeque { private: EST_TVector p_vector; int p_increment; int p_back; int p_front; // Make the structure bigger. void expand(void); public: EST_TDeque(unsigned int capacity, unsigned int increment); EST_TDeque(unsigned int capacity); EST_TDeque(void); /// Used to fill empty spaces when possible. static const T *Filler; /// Empty it out. void clear(void); /// Is there anything to get? bool is_empty(void) const; /// print picture of state. Mostly useful for debugging. ostream &print(ostream &s) const; /**@name stack * * An interface looking like a stack. */ //@{ void push(T &item); T &pop(void); T &nth(int i); //@} /**@name inverse stack * * The other end as a stack. */ //@{ void back_push(T& item); T &back_pop(void); //@} /**@name queue * * An interface looking like a queue. */ //@{ void add(T& item) { push(item); } T &next() { return back_pop(); } T &last() { return pop(); } //@} /**@name perl * * For people who think in perl */ //@{ void unshift(T& item) { back_push(item); } T &shift() { return back_pop(); } //@} friend ostream& operator << (ostream &st, const EST_TDeque< T > &deq) { return deq.print(st); } }; #endif speech_tools/include/EST_model_types.h0000644000076400007640000001153010127000720016501 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : June 1998 */ /*-----------------------------------------------------------------------*/ /* Dynamical models for ASR */ /* */ /*=======================================================================*/ #include #include #include #include "EST.h" #include "EST_Handleable.h" #include "EST_THandle.h" #include "EST_TBox.h" #include "EST_String.h" struct stats_accumulator_HV { EST_DMatrix M1; EST_DMatrix M2; EST_DMatrix covar_y; int points_processed; }; struct stats_accumulator_FW { EST_DMatrix M3; EST_DMatrix M4; EST_DMatrix covar_x_t_plus_1_except_last; int points_processed_except_last; }; typedef EST_TBox Boxed_stats_accumulator_FW; typedef EST_THandle refcounted_stats_accumulator_FW_P; ostream& operator <<(ostream &s, const refcounted_stats_accumulator_FW_P &); typedef EST_TBox Boxed_stats_accumulator_HV; typedef EST_THandle refcounted_stats_accumulator_HV_P; ostream& operator <<(ostream &s, const refcounted_stats_accumulator_HV_P &); /// an accumulator to be owned by every model /// - the underlying HV or FW accumulators are shared via /// pointers to reference counted objects struct stats_accumulator { refcounted_stats_accumulator_HV_P hv; refcounted_stats_accumulator_FW_P fw; }; ostream& operator <<(ostream &s, const stats_accumulator_FW &); ostream& operator <<(ostream &s, const stats_accumulator_HV &); typedef EST_TBox Boxed_EST_DMatrix; typedef EST_THandle refcounted_EST_DMatrixP; ostream& operator <<(ostream &s, const Boxed_EST_DMatrix &); ostream& operator <<(ostream &s, const refcounted_EST_DMatrixP &); //int operator ==(const Boxed_EST_DMatrix &a, // const Boxed_EST_DMatrix &b); int operator ==(const refcounted_EST_DMatrixP &a, const refcounted_EST_DMatrixP &b); typedef EST_TBox Boxed_EST_DVector; typedef EST_THandle refcounted_EST_DVectorP; int operator ==(const refcounted_EST_DVectorP &, const refcounted_EST_DVectorP &); ostream& operator <<(ostream &s, const refcounted_EST_DVectorP &); speech_tools/include/EST_dynamic_model.h0000644000076400007640000001106610127000720016765 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : June 1998 */ /*-----------------------------------------------------------------------*/ /* Dynamical models for ASR */ /* */ /*=======================================================================*/ #include #include #include #include "EST.h" #include "EST_model_types.h" // for now, CSMM means continuous-state Markov model class CSMM { public: refcounted_EST_DMatrixP F; refcounted_EST_DMatrixP H; refcounted_EST_DVectorP u_v; refcounted_EST_DMatrixP Q_v; refcounted_EST_DVectorP u_w; refcounted_EST_DMatrixP Q_w; refcounted_EST_DVectorP mean_initial_x; stats_accumulator stats; }; bool operator ==(const CSMM &, const CSMM &); ostream& operator <<(ostream &s, const CSMM &); /// somewhere to keep the model parameters struct CSMM_parameter_set { EST_TKVL matrix_set; EST_TKVL vector_set; }; /// somewhere to keep the models struct CSMM_set { EST_TKVL model_set; CSMM_parameter_set parameter_set; }; ostream& operator <<(ostream &s, const CSMM_set &ms); bool create_empty_CSMM(EST_String model_name, CSMM_set &model_set, const int model_order, const int observation_order); /// at last, some interesting functions bool E_step(CSMM &model, EST_DMatrix &mean_initial_covar_x, const EST_TrackList &train_data, const bool trace); bool M_step(CSMM &model, const bool trace); bool EM_shared_hidden_space(CSMM_set &models, const int model_order, EST_DMatrix &mean_initial_covar_x, const EST_TrackList &train_data, const int iterations, const bool trace); EST_write_status save_CSMM_set(CSMM_set &model_set, const EST_String &dirname, const EST_String &type); EST_read_status load_CSMM_set(CSMM_set &model_set, const EST_String &dirname); double CSMM_Mahalanobis_distance(const CSMM &model, const EST_Track &t); speech_tools/include/EST_FeatureData.h0000644000076400007640000001517710044502521016361 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* ------------------------------------------------------------------- */ /* EST_Date Class header file */ /* */ /*************************************************************************/ #ifndef __EST_FeatureData_H__ #define __EST_FeatureData_H__ #include "EST_Val.h" #include "EST_TVector.h" #include "EST_TList.h" #include "EST_rw_status.h" #include "EST_types.h" #include "EST_Features.h" typedef EST_TMatrix EST_ValMatrix; typedef EST_TVector EST_ValVector; /** A class for containing arbitrary multi-dimensional feature data. A number of fields are defined in the EST_FeatureData class, each of which represents a measurable quantity, such as height, age or gender. Any number of fields can be defined and each field can take a float, integer or string value. The class holds multiple instances of field values, representing samples taken from a population. Several statistical training, testing and analysis programs use EST_FeatureData as input and output. Member functions exist for comparing fields, extracting given named or numbered fields, can converting appropriate fields to a EST_FMatrix. */ class EST_FeatureSample : public EST_ValVector { private: bool p_sub_fd; void default_vals(); void free_internals(); void alloc_internals(); EST_Features *p_info; EST_FeatureSample ©(const EST_FeatureSample &a); public: EST_FeatureSample(); EST_FeatureSample(const EST_FeatureSample &a); /**@name Information functions */ //@{ /** set number of samples to be held in object and allocate space for storing them */ /* int num_fields() const {return info().num_fields();} //@} EST_Val &a(int field) {return EST_ValVector::a(field);} const EST_Val &a(int field) const {return EST_ValVector::a(field);} EST_Val &a(const EST_String &name) {return EST_ValVector::a(info().field_index(name));} const EST_Val &a(const EST_String &name) const {return EST_ValVector::a(info().field_index(name));} /// const element access operator // const EST_Val &operator () (int sample, const EST_String &field); /// non-const element access operator EST_Val &operator () (const EST_String &field); EST_Val &operator () (int field); EST_FeatureSample &EST_FeatureSample::operator= (const EST_FeatureSample &f); friend ostream& operator << (ostream &st, const EST_FeatureSample &a); //@} */ }; class EST_FeatureData{ private: bool p_sub_fd; void default_vals(); void free_internals(); void alloc_internals(); EST_FeatureData ©(const EST_FeatureData &a); EST_Features info; EST_ValMatrix fd; public: EST_FeatureData(); EST_FeatureData(const EST_FeatureData &a); ~EST_FeatureData(); EST_Features &ginfo() {return info;} int num_samples() const; int num_features() const; void resize(int num_samples, int num_columns, bool preserve = 1); void resize(int num_samples, EST_Features &f, bool preserve = 1); void set_num_samples(int num_samples, bool preserve=1); /* void extract_features(EST_FeatureData &f, const EST_StrList &fields) const; void extract_features(EST_FeatureData &f, EST_IList &fields) const; */ EST_String type(const EST_String &feature_name); EST_StrList values(const EST_String &feature_name); void set_type(EST_String &feature_name, EST_String &type); void set_values(EST_String &feature_name, EST_StrList &values); int update_values(const EST_String &feature_name, int max); int feature_position(const EST_String &feature_name); EST_read_status load(const EST_String &name); EST_write_status save(const EST_String &name, const EST_String &EST_filetype = "") const; EST_Val &a(int sample, int field); EST_Val &a(int sample, const EST_String &name); const EST_Val &a(int sample, int field) const; const EST_Val &a(int sample, const EST_String &name) const; friend ostream& operator << (ostream &st,const EST_FeatureData &a); }; #endif /* __EST_FeatureData_H__ */ speech_tools/include/EST_ServiceTable.h0000644000076400007640000001236507262616577016571 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SERVICETABLE_H__ #define __EST_SERVICETABLE_H__ #include "EST_String.h" #include "EST_rw_status.h" #include "EST_TKVL.h" /** A global table of known services. Used for fringe and festival * servers. * * @author Richard Caley * @version $Id: EST_ServiceTable.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ class EST_ServiceTable { public: /** A service record. * * This is returned by service lookup operations, it contains * enough information to contact the server and authenticate yourself. */ class Entry { public: /// Name of the server. EST_String name; /// Type of server (eg `fringe') EST_String type; /// Human readable hostname. EST_String hostname; /// Numeric IP address (###.###.###.###) EST_String address; /// A random string to send as authorisation. EST_String cookie; /// TCP port number. int port; /// Create an empty entry. Entry(); /// A suitable human readable name for the entry. operator EST_String() const; /// All entries are taken to be different. friend bool operator == (const Entry &a, const Entry &b); /// Print in human readable form. friend ostream & operator << (ostream &s, const Entry &a); }; private: class EntryTable { public: EST_TKVL t; typedef EST_TKVL::Entries Entries; typedef EST_TKVL::KeyEntries KeyEntries; }; /// Table of available Fringe servers. static EntryTable entries; static bool random_init; static void init_random(void); public: /**@name Finding What Services Are Available. * * Servers maintain a per-user file which lists the processes * which are running in server mode by name. These functions read * that table. */ //@{ /// Read the users default table. ~/.estServices static void read_table(void); /// Read a specific table. static void read_table(EST_String socketsFileName); /// Write the users default table. ~/.estServices static void write_table(void); /// Write a specific table. static void write_table(EST_String socketsFileName); /// List the table to given stream static void list(ostream &s, const EST_String type); /// Return a list of server names. static void names(EST_TList &names, const EST_String type=""); //@} /** Return the entry for the server with the given name and type. * If no such entry is found a dummy entry with a port of 0 is returned. */ static const Entry &lookup(const EST_String name, const EST_String type); /** Create an entry for a server of the given name and type which is * listening on the given socket. */ static const Entry &create(const EST_String name, const EST_String type, int socket); }; #endif speech_tools/include/EST_Server.h0000644000076400007640000001626410045556420015450 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SERVER_H__ #define __EST_SERVER_H__ #include "EST_Features.h" #include "EST_ServiceTable.h" /** Client-server interface. * * An EST_Server object represents a server, it can be at either * end of a network connection. That is, a server process has an * EST_Server object representing it's wait-dispatch-answer loop, * while a client process has an EST_Server object which represents * the server process. * * @author Richard Caley * @version $Id: EST_Server.h,v 1.4 2004/05/04 00:00:16 awb Exp $ */ class EST_Server { public: /// What type of server is this. enum Mode { /// Bizarre state sm_unknown = 0, /// Client end of the connection. sm_client = 1, /// Answer one client at a time. sm_sequential = 2, /// Answer requests from several clients, as requests arrive. sm_interleaved =3, /// For off a process for each client. sm_fork = 4, /// Multi-threaded (not implemented) sm_threded = 5 }; typedef EST_Features Args; typedef EST_Features Result; class RequestHandler { public: EST_Server *server; EST_String requestString; EST_String package; EST_String operation; Args args; Result res; RequestHandler(); virtual ~RequestHandler(); virtual EST_String process(void)=0; }; class ResultHandler { public: EST_Server *server; EST_String resString; Result res; ResultHandler(); virtual ~ResultHandler(); virtual void process(void)=0; }; class BufferedSocket { public: int s; int bpos; int blen; char *buffer; BufferedSocket(int socket); ~BufferedSocket(); void ensure(int n); int read_data(void); }; private: /// Then server we are connected to. EST_ServiceTable::Entry p_entry; void *p_serv_addr; int p_socket; BufferedSocket *p_buffered_socket; ostream *p_trace; Mode p_mode; void zero(void); void init(ostream *trace); void initClient(const EST_ServiceTable::Entry &e, ostream *trace); void initClient(EST_String name, EST_String type, ostream *trace); void initClient(EST_String hostname, int port, ostream *trace); void initServer(Mode mode, EST_String name, EST_String type, ostream *trace); protected: void write(BufferedSocket &s, const EST_String string, const EST_String term = ""); EST_String read_data(BufferedSocket &s, const EST_String end, int &eof); bool check_cookie(BufferedSocket &socket); bool process_command(BufferedSocket &socket, EST_String command, RequestHandler &handler); void handle_client(BufferedSocket &socket, RequestHandler &handler); void return_error(BufferedSocket &socket, EST_String err); void return_value(BufferedSocket &socket, Result &res, bool last); void run_sequential(RequestHandler &handler); public: /**@name Client end constructors. */ //@{ /// Create a server connection by name, defaulting to "fringe", the default server name. EST_Server(EST_String name, EST_String type); EST_Server(EST_String name, EST_String type, ostream *trace); /// Create a server connection by explicitly saying where to connect to. EST_Server(EST_String hostname, int port); EST_Server(EST_String hostname, int port, ostream *trace); //@} /**@name Server end constructors */ //@{ EST_Server(Mode mode, EST_String name, EST_String type); EST_Server(Mode mode, EST_String name, EST_String type, ostream *trace); //@} /// Destroy the connection. virtual ~EST_Server(); /**@name information about the server. */ //@{ /// Name of server. const EST_String name(void) const; /// Type of server. const EST_String type(void) const; /// Domain name of the server. const EST_String hostname(void) const; /// Dotted numeric IP address const EST_String address(void) const; /// Domain name or IP number const EST_String servername(void) const; /// Port number int port(void) const; //@} /**@name connection management */ //@{ /// Connect to the server. EST_connect_status connect(void); /// Are we connected at the moment? bool connected(void); /// Disconnect. EST_connect_status disconnect(void); //@} virtual bool parse_command(const EST_String command, EST_String &package, EST_String &operation, Args &arguments); virtual EST_String build_command(const EST_String package, const EST_String operation, const Args &arguments); virtual bool parse_result(const EST_String resultString, Result &res); virtual EST_String build_result(const Result &res); bool execute(const EST_String package, const EST_String operation, const Args &arguments, ResultHandler &handler); bool execute(const EST_String command, ResultHandler &handler); void run(RequestHandler &handler); }; #endif speech_tools/include/EST_FringeServer.h0000644000076400007640000000741607262616577016623 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FRINGE_CLIENT_H__ #define __EST_FRINGE_CLIENT_H__ #include "EST_String.h" #include "EST_rw_status.h" #include "EST_TKVL.h" #include "EST_Server.h" /** A class providing mechanisms to talk to fringe. * * @author Richard Caley * @version $Id: EST_FringeServer.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ class EST_FringeServer : public EST_Server { public: class ResultHandler : public EST_Server::ResultHandler { public: ResultHandler(); virtual void process(void); virtual ~ResultHandler(); }; /// Create a server connection by name, defaulting to "fringe", the default server name. EST_FringeServer(EST_String name="fringe"); EST_FringeServer(EST_String name, ostream *trace); /// Create a server connection by explicitly saying where to connect to. EST_FringeServer(EST_String hostname, int port); EST_FringeServer(EST_String hostname, int port, ostream *trace); /// Destroy the connection. ~EST_FringeServer(); virtual bool parse_command(const EST_String command, EST_String &package, EST_String &operation, Args &arguments); virtual EST_String build_command(const EST_String package, const EST_String operation, const Args &arguments); virtual bool parse_result(const EST_String resultString, Result &res); virtual EST_String build_result(const Result &res); }; #endif speech_tools/include/unix/Makefile0000644000076400007640000000537307262605664015754 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Include Directory Makefile ## ########################################################################### TOP=../.. DIRNAME=include/unix H = EST_defines_unix.h EST_socket_unix.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/ cp -p *.h $(INCDIR)/EST/ speech_tools/include/unix/EST_defines_unix.h0000644000076400007640000000575407262605664017663 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Defines for things which have to be hidden from some compilers. */ /* */ /*************************************************************************/ #if !defined(__EST_DEFINES_UNIX_H__) #define __EST_DEFINES_UNIX_H__ 1 #endif speech_tools/include/unix/EST_socket_unix.h0000644000076400007640000000723510464377357017535 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Defines of things which may not be here on all unixes. */ /* */ /*************************************************************************/ #if !defined(__EST_SOCKET_UNIX_H__) #define __EST_SOCKET_UNIX_H__ 1 #include /* Solaris defines this, linux doesn't */ #if defined(sun) && !defined(SVR4) typedef int ssize_t; #endif #if defined(older_solaris) /* older versions of Solaris don't have this */ typedef int socklen_t; #endif #if defined(__FreeBSD__) && __FreeBSD__ < 4 typedef int socklen_t; #endif #if defined(__APPLE__) #endif #if defined(__CYGWIN__) && __GNUC__ < 3 typedef int socklen_t; #endif #if defined(__osf__) typedef int socklen_t; #endif #if defined(_AIX) #include #endif #define NOT_A_SOCKET(FD) ((FD) <0) #define socket_error() errno #if defined(__cplusplus) extern "C" { #endif int socket_initialise(void); #if defined(__cplusplus) } #endif #endif speech_tools/include/win32/Makefile0000644000076400007640000000544507262605664015733 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Include Directory Makefile ## ########################################################################### TOP=../.. DIRNAME=include/win32 H = EST_defines_win32.h EST_socket_win32.h EST_iostream_win32.h EST_unix_win32.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/ cp -p *.h $(INCDIR)/EST/ speech_tools/include/win32/EST_defines_win32.h0000644000076400007640000000617710127000720017571 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Defines for things which have to be hidden from some compilers. */ /* */ /*************************************************************************/ #if !defined(__EST_DEFINES_WIN32_H__) #define __EST_DEFINES_WIN32_H__ 1 /* #define size_t unsigned int */ #undef DIFFERENCE /* #define M_PI (3.1415926) */ #define isnan(N) 0 #define isnanf(N) 0 #undef min #undef max #endif speech_tools/include/win32/EST_socket_win32.h0000644000076400007640000000640407313632547017462 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Defines to make Winsock more like unix sockets. */ /* */ /*************************************************************************/ #if !defined(__EST_SOCKET_WIN32_H__) #define __EST_SOCKET_WIN32_H__ 1 #define SOCKLEN_CAST (int *) typedef int ssize_t; typedef int socklen_t; #define NOT_A_SOCKET(FD) ((FD) == INVALID_SOCKET) #define socket_error() WSAGetLastError() #if defined(__cplusplus) extern "C" { #endif int socket_initialise(void); #if defined(__cplusplus) } #endif #endif speech_tools/include/win32/EST_iostream_win32.h0000644000076400007640000000616410127000720017773 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Wrapper around iostream includes to avoid aome win32 nasties. */ /* */ /*************************************************************************/ #if !defined(__EST_IOSTREAM_WIN32_H__) # define __EST_IOSTREAM_WIN32_H__ 1 /* This gets incuded from C */ #ifdef __cplusplus #include using namespace std; #undef read #undef write #endif #endif speech_tools/include/win32/EST_unix_win32.h0000644000076400007640000001032410127000720017124 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Sep4th 1997 */ /* -------------------------------------------------------------------- */ /* Define unix things for win32. */ /* */ /*************************************************************************/ #if !defined(__EST_UNIX_WIN32_H__) #define __EST_UNIX_WIN32_H__ 1 /* force this to be loaded first */ #ifdef __cplusplus #include using namespace std; #endif #ifdef __cplusplus static inline int getpid(void) { return (int)GetCurrentProcessId(); } #else # define getpid() GetCurrentProcessId() #endif #ifdef __cplusplus extern "C" { #endif int unix_waitpid(int pid, int *statusp, int flags); int unix_fork(void); #ifdef __cplusplus } #endif #define waitpid(P, SP, FL) unix_waitpid((P), (SP), (FL)) #define WNOHANG 1 #define fork() unix_fork() #define rint(N) ((float)(int)((N)+0.5)) #ifdef __cplusplus extern "C" { #endif int unix_access(const char *file, int mode); #ifdef __cplusplus } #endif #define access(FILE,MODE) unix_access(FILE, MODE) #define F_OK 1 #define W_OK 2 #define R_OK 4 #ifdef __cplusplus extern "C" { #endif int unix_read(HANDLE fd, char *buffer, int n); int unix_write(HANDLE fd, const char *buffer, int n); #ifdef __cplusplus } #endif #define read(FD,B,N) _read((FD),(B),(N)) #ifdef __cplusplus extern "C" { #endif char *unix_getcwd(char *buffer, int maxlength); #ifdef __cplusplus } #endif #define getcwd(P, L) unix_getcwd((P), (L)) #define chdir(D) SetCurrentDirectory(D) #if !defined(memcpy) # define memcpy(DST, SRC, N) CopyMemory((DST), (SRC), (N)) #endif #endif speech_tools/include/sigpr/Makefile0000644000076400007640000000555507262605664016117 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Include Directory Makefile ## ########################################################################### TOP=../.. DIRNAME=include/sigpr H = EST_filter.h EST_fft.h EST_pitchmark.h \ EST_Window.h EST_sigpr_frame.h \ EST_sigpr_utt.h EST_misc_sigpr.h EST_spectrogram.h \ EST_filter_design.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/ cp -p *.h $(INCDIR)/EST/ speech_tools/include/sigpr/EST_filter.h0000644000076400007640000003631610044502521016603 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FILTER_H__ #define __EST_FILTER_H__ #include "EST_Wave.h" #include "EST_FMatrix.h" #include "EST_Track.h" #define DEFAULT_PRE_EMPH_FACTOR 0.95 #define DEFAULT_FILTER_ORDER 199 /**@name FIR filters Finite impulse response (FIR) filters which are useful for band-pass, low-pass and high-pass filtering. FIR filters perform the following operation: \[y_t=\sum_{i=0}^{O-1} c_i \; x_{t-i}\] where \(O\) is the filter order, \(c_i\) are the filter coefficients, \(x_t\) is the input at time \(t\) and \(y_t\) is the output at time \(t\). Functions are provided for designing the filter (i.e. finding the coefficients). */ //@{ /** General purpose FIR filter. This function will filter the waveform {\tt sig} with a previously designed filter, given as {\tt numerator}. The filter coefficients can be designed using one of the designed functions, e.g. \Ref{design_FIR_filter}. @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter, @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ void FIRfilter(EST_Wave &in_sig, const EST_FVector &numerator, int delay_correction=0); /** General purpose FIR filter. This function will filter the waveform {\tt sig} with a previously designed filter, given as {\tt numerator}. The filter coefficients can be designed using one of the designed functions, e.g. \Ref{design_FIR_filter} . @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter, @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ void FIRfilter(const EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator, int delay_correction=0); /** General purpose FIR double (zero-phase) filter. This function will double filter the waveform {\tt sig} with a previously designed filter, given as {\tt numerator}. The filter coefficients can be designed using one of the designed functions, e.g. \Ref{design_FIR_filter}. Double filtering is performed by filtering the signal normally, reversing the waveform, filtering again and reversing the waveform again. Normal filtering will impose a lag on the signal depending on the order of the filter. By filtering the signal forwards and backwards, the lags cancel each other out and the output signal is in phase with the input signal. @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter, @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ void FIR_double_filter(EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator); /** Quick function for one-off low pass filtering. If repeated lowpass filtering is needed, first design the required filter using \Ref{design_lowpass_filter}, and then use \Ref{FIRfilter} to do the actual filtering. @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter, FIRfilter, FIRhighpass_filter, FIRlowpass_filter @param in_sig input waveform, which will be overwritten @param freq @param order number of filter coefficients, eg. 99 */ void FIRlowpass_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off low pass filtering. If repeated lowpass filtering is needed, first design the required filter using \Ref{design_lowpass_filter}, and then use \Ref{FIRfilter} to do the actual filtering. @param in_sig input waveform @param out_sig output waveform @param freq cutoff frequency in Hertz @param order number of filter coefficients , e.g. 99 @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter, FIRfilter, FIRhighpass_filter */ void FIRlowpass_filter(const EST_Wave &in_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off high pass filtering. If repeated lowpass filtering is needed, first design the required filter using design_lowpass_filter, and then use FIRfilter to do the actual filtering. @param in_sig input waveform, which will be overwritten @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ void FIRhighpass_filter(EST_Wave &in_sig, int freq, int order); /** Quick function for one-off high pass filtering. If repeated highpass filtering is needed, first design the required filter using design_highpass_filter, and then use FIRfilter to do the actual filtering. @param in_sig input waveform @param out_sig output waveform @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ void FIRhighpass_filter(const EST_Wave &sigin, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off double low pass filtering. Normal low pass filtering (\Ref{FIRlowpass_filter}) introduces a time delay. This function filters the signal twice, first forward and then backwards, which ensures a zero phase lag. Hence the order parameter need only be half what it is for (\Ref{FIRlowpass_filter} to achieve the same effect. @param in_sig input waveform, which will be overwritten @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see FIRhighpass_filter */ void FIRhighpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off double low pass filtering. Normal low pass filtering (\Ref{FIRlowpass_filter}) introduces a time delay. This function filters the signal twice, first forward and then backwards, which ensures a zero phase lag. Hence the order parameter need only be half what it is for (\Ref{FIRlowpass_filter} to achieve the same effect. @param in_sig input waveform @param out_sig output waveform @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see FIRhighpass_filter */ void FIRhighpass_double_filter(const EST_Wave &int_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off zero phase high pass filtering. Normal high pass filtering (\Ref{FIRhighpass_filter}) introduces a time delay. This function filters the signal twice, first forward and then backwards, which ensures a zero phase lag. Hence the order parameter need only be half what it is for (\Ref{FIRhighpass_filter} to achieve the same effect. @param in_sig input waveform, which will be overwritten @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see FIRlowpass_filter */ void FIRlowpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); /** Quick function for one-off zero phase high pass filtering. Normal high pass filtering (\Ref{FIRhighpass_filter}) introduces a time delay. This function filters the signal twice, first forward and then backwards, which ensures a zero phase lag. Hence the order parameter need only be half what it is for (\Ref{FIRhighpass_filter} to achieve the same effect. @param in_sig input waveform @param out_sig output waveform @param freq cutoff frequency in Hertz @param order number of filter coefficients, eg. 99 @see FIRlowpass_filter */ void FIRlowpass_double_filter(const EST_Wave &in_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); //@} /**@name Linear Prediction filters The linear prediction filters are used for the analysis and synthesis of waveforms according the to linear prediction all-pole model. The linear prediction states that the value of a signal at a given point is equal to a weighted sum of the previous P values, plus a correction value for that point: \[s_{n} = \sum_{i=1}^{P} a_{i}.s_{n-i} + e_{n}\] Given a set of coefficients and the original signal, we can use this equation to work out e, the {\it residual}. Conversely given the coefficients and the residual signal, an estimation of the original signal can be calculated. If a single set of coefficients were used for the entire waveform, the filtering process would be simple. It is usual however to have a different set of coefficients for every frame, and there are many possible ways to switch from one coefficient set to another so as not to cause discontinuities at the frame boundaries. */ //@{ /** Synthesize a signal from a single set of linear prediction coefficients and the residual values. @param sig the waveform to be synthesized @param a a single set of LP coefficients @param res the input residual waveform */ void lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res); /** Filter the waveform using a single set of coefficients so as to produce a residual signal. @param sig the speech waveform to be filtered @param a a single set of LP coefficients @param res the output residual waveform */ void inv_lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res); /** Synthesize a signal from a track of linear prediction coefficients. This function takes a set of LP frames and a residual and produces a synthesized signal. For each frame, the function picks an end point, which is half-way between the current frame's time position and the next frame's. A start point is defined as being the previous frame's end. Using these two values, a portion of residual is extracted and passed to \Ref{lpc_filter} along with the LP coefficients for that frame. This function writes directly into the signal for the values between start and end; @param sig the waveform to be synthesized @param lpc a track of time positioned LP coefficients @param res the input residual waveform */ void lpc_filter_1(EST_Track &lpc, EST_Wave & res, EST_Wave &sig); /** Synthesize a signal from a track of linear prediction coefficients. This function takes a set of LP frames and a residual and produces a synthesized signal. This is functionally equivalent to \Ref{lpc_filter_1} except it reduces the residual by 0.5 before filtering. Importantly it is about three times faster than \Ref{lpc_filter_1} but in doing so uses direct C buffers rather than the neat C++ access function. This function should be regarded as temporary and will be deleted after we restructure the low level classes to give better access. @param sig the waveform to be synthesized @param lpc a track of time positioned LP coefficients @param res the input residual waveform */ void lpc_filter_fast(EST_Track &lpc, EST_Wave & res, EST_Wave &sig); /** Produce a residual from a track of linear prediction coefficients and a signal using an overlap add technique. For each frame, the function estimates the local pitch period and picks a start point one period before the current time position and an end point one period after it. A portion of residual corresponding to these times is then produced using \Ref{inv_lpc_filter}. The resultant section of residual is then overlap-added into the main residual wave object. @param sig the speech waveform to be filtered @param lpc a track of time positioned LP coefficients @param res the output residual waveform */ void inv_lpc_filter_ola(EST_Wave &sig, EST_Track &lpc, EST_Wave &res); //@} /**@name Pre/Post Emphasis filters. These functions adjust the spectral tilt of the input waveform. */ //@{ /** Pre-emphasis filtering. This performs simple high pass filtering with a one tap filter of value {\tt a}. Normal values of a range between 0.95 and 0.99. */ void pre_emphasis(EST_Wave &sig, float a=DEFAULT_PRE_EMPH_FACTOR); /** Pre-emphasis filtering. This performs simple high pass filtering with a one tap filter of value {\tt a}. Normal values of a range between 0.95 and 0.99. */ void pre_emphasis(EST_Wave &sig, EST_Wave &out, float a=DEFAULT_PRE_EMPH_FACTOR); /** Post-emphasis filtering. This performs simple low pass filtering with a one tap filter of value a. Normal values of a range between 0.95 and 0.99. The same values of {\tt a} should be used when pre- and post-emphasizing the same signal. */ void post_emphasis(EST_Wave &sig, float a=DEFAULT_PRE_EMPH_FACTOR); /** Post-emphasis filtering. This performs simple low pass filtering with a one tap filter of value a. Normal values of a range between 0.95 and 0.99. The same values of {\tt a} should be used when pre- and post-emphasizing the same signal. */ void post_emphasis(EST_Wave &sig, EST_Wave &out, float a=DEFAULT_PRE_EMPH_FACTOR); //@} /**@name Miscellaneous filters. Some of these filters are non-linear and therefore don't fit the normal paradigm. */ //@{ /** Filters the waveform by means of median smoothing. This is a sort of low pass filter which aims to remove extreme values. Median smoothing works examining each sample in the wave, taking all the values in a window of size {\tt n} around that sample, sorting them and replacing that sample with the middle ranking sample in the sorted samples. @param sig waveform to be filtered @param n size of smoothing window */ void simple_mean_smooth(EST_Wave &c, int n); //@} #endif /* __EST_FILTER_H__ */ speech_tools/include/sigpr/EST_fft.h0000644000076400007640000001205307262605664016111 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FFT_H__ #define __EST_FFT_H__ #include "EST_Wave.h" #include "EST_Track.h" #include "EST_FMatrix.h" /**@name Fast Fourier Transform functions These are the low level functions where the actual FFT is performed. Both slow and fast implementations are available for historical reasons. They have identical functionality. At this time, vectors of complex numbers are handled as pairs of vectors of real and imaginary numbers. What is a Fourier Transform ? The Fourier transform of a signal gives us a frequency-domain representation of a time-domain signal. In discrete time, the Fourier Transform is called a Discrete Fourier Transform (DFT) and is given by: \[y_k = \sum_{t=0}^{n-1} x_t \; \omega_{n}^{kt} \; ; \; k=0...n-1 \] where \(y = (y_0,y_1,... y_{n-1})\) is the DFT (of order \(n\) ) of the signal \(x = (x_0,x_1,... x_{n-1})\), where \(\omega_{n}^{0},\omega_{n}^{1},... \omega_{n}^{n-1}\) are the n complex nth roots of 1. The Fast Fourier Transform (FFT) is a very efficient implementation of a Discrete Fourier Transform. See, for example "Algorithms" by Thomas H. Cormen, Charles E. Leiserson and Ronald L. Rivest (pub. MIT Press), or any signal processing textbook. */ //@{ /** Basic in-place FFT. There's no point actually using this - use \Ref{fastFFT} instead. However, the code in this function closely matches the classic FORTRAN version given in many text books, so is at least easy to follow for new users. The length of real and imag must be the same, and must be a power of 2 (e.g. 128). @see slowIFFT @see FastFFT */ int slowFFT(EST_FVector &real, EST_FVector &imag); /** Alternate name for slowFFT */ inline int FFT(EST_FVector &real, EST_FVector &imag){ return slowFFT(real, imag); } /** Basic inverse in-place FFT int slowFFT */ int slowIFFT(EST_FVector &real, EST_FVector &imag); /** Alternate name for slowIFFT */ inline int IFFT(EST_FVector &real, EST_FVector &imag){ return slowIFFT(real, imag); } /** Power spectrum using the fastFFT function. The power spectrum is simply the squared magnitude of the FFT. The result real and imaginary parts are both set equal to the power spectrum (you only need one of them !) */ int power_spectrum(EST_FVector &real, EST_FVector &imag); /** Power spectrum using the slowFFT function */ int power_spectrum_slow(EST_FVector &real, EST_FVector &imag); /** Fast FFT An optimised implementation by Tony Robinson to be used in preference to slowFFT */ int fastFFT(EST_FVector &invec); // Auxiliary for fastFFT int fastlog2(int); //@} #endif // __EST_FFT_H__ speech_tools/include/sigpr/EST_pitchmark.h0000644000076400007640000001403510056153700017276 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_PITCHMARK_H__ #define __EST_PITCHMARK_H__ #include "EST_Wave.h" #include "EST_Option.h" #include "EST_Track.h" #include "EST_TBuffer.h" #define LX_LOW_FREQUENCY 400 #define LX_LOW_ORDER 19 #define LX_HIGH_FREQUENCY 40 #define LX_HIGH_ORDER 19 #define DF_LOW_FREQUENCY 1000 #define DF_LOW_ORDER 19 #define MIN_PERIOD 0.003 #define MAX_PERIOD 0.02 #define DEF_PERIOD 0.01 #define PM_END -1.0 /** @name Pitchmarking Functions Pitchmarking involves finding some pre-defined pitch related instant for every pitch period in the speech. At present, only functions for analysing laryngograph waveforms are available - the much harder problem of doing this on actual speech has not been attempted. */ //@{ /** Find pitchmarks in Laryngograph (lx) signal. This high level function places a pitchmark on each positive peak in the voiced portions of the lx signal. Pitchmarks are stored in the time component of a EST_Track object and returned. The function works by high and low pass filtering the signal using forward and backward filtering to remove phase shift. The negative going points in the smoothed differentiated signal, corresponding to peaks in the original are then chosen. @param lx laryngograph waveform @param op options, mainly for filter control: \begin{itemize} \item {\bf lx_low_frequency} low pass cut off for lx filtering : typical value {\tt 400} \item {\bf lx_low_order} order of low pass lx filter: typical value 19 \item {\bf lx_high_frequency} high pass cut off for lx filtering: typical value 40 \item {\bf lx_high_order} order of high pass lx filter: typical value 19 \item {\bf median_order} order of high pass lx filter: typical value 19 \end{itemize} */ EST_Track pitchmark(EST_Wave &lx, EST_Features &op); /** Find pitchmarks in Laryngograph (lx) signal. The function is the same as \Ref{pitchmark} but with more explicit control over the parameters. @param lx laryngograph waveform @param lx_lf low pass cut off for lx filtering : typical value 400 @param lx_fo order of low pass lx filter : typical value 19 @param lx_hf high pass cut off for lx filtering : typical value 40 @param lx_ho : typical value 19 @param mo order of median smoother used to smoother differentiated lx : typical value 19 */ EST_Track pitchmark(EST_Wave &lx, int lx_lf, int lx_lo, int lx_hf, int lx_ho, int df_lf, int df_lo, int mo, int debug=0); /** Find times where waveform cross zero axis in negative direction. @param sig waveform @param pm pitchmark track which stores time positions of negative crossings */ void neg_zero_cross_pick(EST_Wave &lx, EST_Track &pm); /** Produce a set of sensible pitchmarks. Given a set of raw pitchmarks, this function makes sure no pitch period is shorter that {\tt min} seconds and no longer than {\tt max} seconds. Periods that are too short are eliminated. If a period is too long, extra pitchmarks are inserted whose period is {\it approximately} {\tt def} seconds in duration. The approximation is to ensure that the pitch period in the interval, D, is constant, and so the actual pitch period is given by \[T = D / floor(D/def)\] */ void pm_fill(EST_Track &pm, float new_end, float max, float min, float def); /** Remove pitchmarks which are too close together. This doesn't work in a particularly sophisticated way, in that it removes a sequence of too close pitchmarks left to right, and doesn't attempt to find which ones in the sequence are actually spurious. */ void pm_min_check(EST_Track &pm, float min); void pm_to_f0(EST_Track &pm, EST_Track &f0); // for constant shift pitchmarks void pm_to_f0(EST_Track &pm, EST_Track &fz, float shift); //@} #endif /* __EST_PITCHMARK_H__ */ //@} speech_tools/include/sigpr/EST_Window.h0000644000076400007640000002174310127000720016557 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley and Paul Taylor */ /* Date: May 1997, April 98 */ /* ------------------------------------------------------------------- */ /* Class for windowing speech waveforms */ /* */ /************************************************************************/ #ifndef __EST_WINDOW_H__ #define __EST_WINDOW_H__ #include "EST_TBuffer.h" #include "EST_Wave.h" /**@name Function types used for parameters to functions. */ //@{ /// Function which creates a window. typedef void EST_WindowFunc(int size, EST_TBuffer &r_window, int window_centre ); //@} /** The EST_Window class provides functions for the creation and use of signal processing windows. Signal processing algorithms often work by on small sections of the speech waveform known as {\em frames}. A full signal must first be divided into these frames before these algorithms can work. While it would be simple to just "cut out" the required frames from the waveforms, this is usually undesirable as large discontinuities can occur at the frame edges. Instead it is customary to cut out the frame by means of a \{em window} function, which tapers the signal in the frame so that it has high values in the middle and low or zero values near the frame edges. The \Ref{EST_Window} class provides a wrap around for such windowing operations. There are several types of window function, including: \begin{itemize} \item {\bf Rectangular}, which is used to give a simple copy of the the values between the window limits. \[w_{n} = \left\{ \begin{array}{ll} 1 & \mbox{$0 \leq n \leq N$} \\ 0 & \mbox{otherwise} \end{array} \right. \] \item {\bf Hanning}. The rectangular window can cause sharp discontinuities at window edges. The hanning window solves this by ensuring that the window edges taper to 0. \[w_{n} = \left\{ \begin{array}{ll} 0.5 - 0.5 \cos(2\pi n / (N-1)) & \mbox{$0 \leq n \leq N$} \\ 0 & \mbox{otherwise} \end{array} \right. \] \item {\bf Hamming.} The hanning window causes considerable energy loss, which the hamming window attempts to rectify. \[w_{n} = \left\{ \begin{array}{ll} 0.54 - 0.46 \cos(2\pi n / (N-1)) & \mbox{$0 \leq n \leq N$} \\ 0 & \mbox{otherwise} \end{array} \right. \] \end{itemize} The particular choice of window depends on the application. For instance in most speech synthesis applications Hanning windows are the most suitable as they don't have time domain discontinuities. For analysis applications hamming windows are normally used. For example code, see \Ref{Windowing} */ class EST_Window { public: /// A function which creates a window typedef EST_WindowFunc Func; /**@name Functions for making windows. */ //@{ /** Make a Buffer of containing a window function of specified type. If window_centre < 0 (default -1), then a symmetric window is returned. For positive values of the window_centre argument, asymmetric windows are returned. */ static void make_window(EST_TBuffer &window_vals, int size, const char *name, int window_centre); /** Make a EST_FVector containing a window function of specified type. If window_centre < 0 (default -1), then a symmetric window is returned. For positive values of the window_centre argument, asymmetric windows are returned. */ static void make_window(EST_FVector &window_vals, int size, const char *name, int window_centre); /// Return the creation function for the given window type. static Func *creator(const char *name, bool report_error = false); //@} /** @name Performing windowing on a section of speech. */ //@{ /** Window the waveform {\tt sig} starting at point {\tt start} for a duration of {\tt size} samples. The windowing function required is given as a function pointer {\tt *make_window} which has already been created by a function such as \Ref{creator}. The output windowed frame is placed in the buffer {\tt frame} which will have been resized accordingly within the function. */ static void window_signal(const EST_Wave &sig, EST_WindowFunc *make_window, int start, int size, EST_TBuffer &frame); /** Window the waveform {\tt sig} starting at point {\tt start} for a duration of {\tt size} samples. The windowing function required is given as a function pointer {\tt *make_window} which has already been created by a function such as \Ref{creator}. The output windowed frame is placed in the EST_FVector {\tt frame}. By default, it is assumed that this is already the correct size (i.e. {\tt size} samples long), but if resizing is required the last argument should be set to 1. */ static void window_signal(const EST_Wave &sig, EST_WindowFunc *make_window, int start, int size, EST_FVector &frame,int resize=0); /** Window the waveform {\tt sig} starting at point {\tt start} for a duration of {\tt size} samples. The windowing function required is given as a string: this function will make a temporary window of this type. The output windowed frame is placed in the EST_FVector {\tt frame}. By default, it is assumed that this is already the correct size (i.e. {\tt size} samples long), but if resizing is required the last argument should be set to 1. */ static void window_signal(const EST_Wave &sig, const EST_String &window_name, int start, int size, EST_FVector &frame, int resize=0); /** Window the waveform {\tt sig} starting at point {\tt start} for a duration of {\tt size} samples. The window shape required is given as an array of floats. The output windowed frame is placed in the EST_FVector {\tt frame}. By default, it is assumed that this is already the correct size (i.e. {\tt size} samples long), but if resizing is required the last argument should be set to 1. */ static void window_signal(const EST_Wave &sig, EST_TBuffer &window_vals, int start, int size, EST_FVector &frame, int resize=0); //@} /**@name Utility window functions. */ //@{ /// Return the description for a given window type. static EST_String description(const char *name); /// Return a paragraph describing the available windows. static EST_String options_supported(void); /// Return a comma separated list of the available window types. static EST_String options_short(void); //@} }; ///For example code, see \Ref{Windowing}. //@see Windowing mechanisms #endif speech_tools/include/sigpr/EST_sigpr_frame.h0000644000076400007640000002550110044502521017606 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SIGPR_FRAME_H__ #define __EST_SIGPR_FRAME_H__ #include "EST_FMatrix.h" /**@name Linear Prediction functions Including, generation of coefficients from the signal, reflection coefficients, line spectral frequencies, areas. */ //@{ /** Produce the full set of linear prediction coefficients from a frame of speech waveform. @param sig: the frame of input waveform @param acf: the autocorrelation coefficients @param ref: the reflection coefficients @param lpc: the LPC coefficients The order of the lpc analysis is given as the size of the lpc vector - 1. The coefficients are placed in the locations 1 - size, and the energy is placed in location 0. */ void sig2lpc(const EST_FVector &sig, EST_FVector &acf, EST_FVector &ref, EST_FVector &lpc); /** Calculate cepstral coefficients from lpc coefficients. It is possible to calculate a set of cepstral coefficients from lpc coefficients using the relationship: \[c_{k}= a_{k} + \frac{1}{k}\sum_{i=1}^{k-1} i c_{i} a_{k-1}\] The order of the cepstral analysis can be different from the lpc order. If the cepstral order is greater, interpolation is used (FINISH add equation). Both orders are taken from the lengths of the respective vectors. Note that these cepstral coefficients take on the assumptions (and errors) of the lpc model and hence will not be the same as cepstral coefficients calculated using DFT functions. @param lpc: the LPC coefficients (input) @param lpc: the cepstral coefficients (output) */ void lpc2cep(const EST_FVector &lpc, EST_FVector &cep); /** Produce a set linear prediction coefficients from a frame of speech waveform. {\tt sig} is the frame of input waveform, and {\tt lpc} are the LPC coefficients. The {\bf order} of the lpc analysis is given as the size of the {\tt lpc} vector -1. The coefficients are placed in the locations 1 - size, and the energy is placed in location 0. */ void sig2lpc(const EST_FVector &sig, EST_FVector &lpc); /** Produce a set of reflection coefficients from a frame of speech waveform. {\tt sig} is the frame of input waveform, and {\tt ref} are the LPC coefficients. The {\bf order} of the lpc analysis is given as the size of the {\tt lpc} vector -1. The coefficients are placed in the locations 1 - size, and the energy is placed in location 0. */ void sig2ref(const EST_FVector &sig, EST_FVector &ref); /**@name Area Functions Using the analogy of the lossless tube, the cross-sectional areas of the sections of this tube are related to the reflection coefficients and can be calculated from the following relationship: \[\frac{A_{i+1}}{A_{i}} = \frac{i - k_{i}}{1 + k_{i}} \] */ //@{ /** The area according to the formula. */ void ref2truearea(const EST_FVector &ref, EST_FVector &area); /** An approximation of the area is calculate by skipping the denominator in the formula. */ void ref2area(const EST_FVector &ref, EST_FVector &area); /** The logs of the areas. */ void ref2logarea(const EST_FVector &ref, EST_FVector &logarea); //@} /** Calculate the reflection coefficients from the lpc coefficients. Note that in the standard linear prediction analysis, the reflection coefficients are generated as a by-product. @see sig2lpc */ void lpc2ref(const EST_FVector &lpc, EST_FVector &ref); /** Calculate the linear prediction coefficients from the reflection coefficients. Use the equation: \[power=\frac{1}{n}\sum_{i=1}^{n}a_{i}^2\] @see lpc2ref*/ void ref2lpc(const EST_FVector &ref, EST_FVector &lpc); /** Calculate line spectral frequencies from linear prediction coefficients. Use the equation: \[power=\frac{1}{n}\sum_{i=1}^{n}a_{i}^2\] @see lsf2lpc */ void lpc2lsf(const EST_FVector &lpc, EST_FVector &lsf); /** Calculate line spectral frequencies from linear prediction coefficients. Use the equation: \[power=\frac{1}{n}\sum_{i=1}^{n}a_{i}^2\] @see lpc2lsf */ void lsf2lpc(const EST_FVector &lsf, EST_FVector &lpc); //@} void frame_convert(const EST_FVector &in_frame, const EST_String &in_type, EST_FVector &out_frame, const EST_String &out_type); // end of lpc functions /**@name Energy and power frame functions */ //@{ /** Calculate the power for a frame of speech. This is defined as \[power=\frac{1}{n}\sum_{i=1}^{n}a_{i}^2\] */ void sig2pow(EST_FVector &frame, float &power); /** Calculate the root mean square energy for a frame of speech. This is defined as \[energy=\sqrt{\frac{1}{n}\sum_{i=1}^{n}a_{i}^2}\] */ void sig2rms(EST_FVector &frame, float &rms_energy); //@} // end of power and energy /**@name Frame based filter bank and cepstral analysis These functions are \Ref{Frame based signal processing functions}. */ //@{ /** Calculate the (log) energy (or power) in each channel of a Mel scale filter bank for a frame of speech. The filters are triangular, are evenly spaced and are all of equal width, on a Mel scale. The upper and lower cutoffs of each filter are at the centre frequencies of the adjacent filters. The Mel scale is described under {\tt Hz2Mel}. @see Hz2Mel @see sig2fft @see fft2fbank */ void sig2fbank(const EST_FVector &sig, EST_FVector &fbank_frame, const float sample_rate, const bool use_power_rather_than_energy, const bool take_log); /** Calculate the energy (or power) spectrum of a frame of speech. The FFT order is determined by the number of samples in the frame of speech, and is a power of 2. Note that the FFT vector returned corresponds to frequencies from 0 to half the sample rate. Energy is the magnitude of the FFT; power is the squared magnitude. @see fft2fbank @see sig2fbank */ void sig2fft(const EST_FVector &sig, EST_FVector &fft_vec, const bool use_power_rather_than_energy); /** Given a Mel filter bank description, bin the FFT coefficients to compute the output of the filters. The first and last elements of {\tt mel_fbank_frequencies} define the lower and upper bound of the first and last filters respectively and the intervening elements give the filter centre frequencies. That is, {\tt mel_fbank_frequencies} has two more elements than {\tt fbank_vec}. @see fastFFT @see sig2fft @see sig2fbank @see fbank2melcep */ void fft2fbank(const EST_FVector &fft_frame, EST_FVector &fbank_vec, const float Hz_per_fft_coeff, const EST_FVector &mel_fbank_frequencies); /** Compute the discrete cosine transform of log Mel-scale filter bank output to get the Mel cepstral coefficients for a frame of speech. Optional liftering (filtering in the cepstral domain) can be applied to normalise the magnitudes of the coefficients. This is useful because, typically, the higher order cepstral coefficients are significantly smaller than the lower ones and it is often desirable to normalise the means and variances across coefficients. The lifter (cepstral filter) used is: \[c_i' = \{ 1 + \frac{L}{2} sin \frac{\Pi i}{L} \} \; c_i\] A typical value of L used in speech recognition is 22. A value of L=0 is taken to mean no liftering. This is equivalent to L=1. @see sig2fft @see fft2fbank @see sig2fbank */ void fbank2melcep(const EST_FVector &fbank_vec, EST_FVector &mfcc, const float liftering_parameter, const bool include_c0 = false); /** Make a triangular Mel scale filter. The filter is centred at {\tt this_mel_centre} and extends from {\tt this_mel_low} to {\tt this_mel_high}. {\tt half_fft_order} is the length of a power/energy spectrum covering 0Hz to half the sampling frequency with a resolution of {\tt Hz_per_fft_coeff}. The routine returns a vector of weights to be applied to the energy/power spectrum starting at element {\tt fft_index_start}. The number of points (FFT coefficients) covered by the filter is given by the length of the returned vector {\tt filter}. @see fft2fbank @see Hz2Mel @see Mel2Hz */ void make_mel_triangular_filter(const float this_mel_centre, const float this_mel_low, const float this_mel_high, const float Hz_per_fft_coeff, const int half_fft_order, int &fft_index_start, EST_FVector &filter); /**@name Frequency conversion functions These are functions used in \Ref{Filter bank and cepstral analysis}. */ //@{ /** Convert Hertz to Mel. The Mel scale is defined by \[f_{\mbox{Mel}} = 1127 \; log( 1 + \frac{f_{\mbox{Hertz}}}{700} )\] @see Mel2Hz @see Frequency conversion functions */ float Hz2Mel(float frequency_in_Hertz); /** Convert Mel to Hertz. @see Hz2Mel */ float Mel2Hz(float frequency_in_Mel); //@} // end of frequency conversion functions //@} // end of filter bank and cepstral analysis #endif /* __EST_SIGPR_FRAME_H__ */ speech_tools/include/sigpr/EST_sigpr_utt.h0000644000076400007640000004243210044502521017332 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SIGPR_UTT_H__ #define __EST_SIGPR_UTT_H__ #include "sigpr/EST_sigpr_frame.h" #include "sigpr/EST_Window.h" #include "EST_Track.h" #include "EST_Wave.h" #define DEFAULT_WINDOW_NAME "hamming" #define DEFAULT_FRAME_FACTOR 2.0 /* Note: some of these functions deliberately don't have doc++ style comments, mainly because they are, or will be superseded soon. */ /**@name Functions for use with frame based processing In the following functions, the input is a \Ref{EST_Wave} waveform, and the output is a (usually multi-channel) \Ref{EST_Track}. The track must be set up appropriately before hand. This means the track must be resized accordingly with the correct numbers of frame and channels. The positions of the frames are found by examination of the {\bf time} array in the EST_Track, which must be filled prior to the function call. The usual requirement is for fixed frame analysis, where each analysis frame is, say, 10ms after the previous one. A common alternative is to perform pitch-synchronous analysis where the time shift is related to the local pitch period. */ //@{ /** Produce a single set of coefficients from a waveform. The type of coefficient required is given in the argument type. Possible types are: lpclinear predictive coding cepcepstrum coding from lpc coefficients melcepMel scale cepstrum coding via fbank fbankMel scale log filterbank analysis lsfline spectral frequencies refLinear prediction reflection coefficients power f0srpd algorithm energyroot mean square energy The order of the analysis is calculated from the number of channels in fv. The positions of the analysis windows must be given by filling in the track's time array. This function windows the waveform at the intervals given by the track time array. The length of each window is factor * the local time shift. The windowing function is giveb by wf. @param sig: input waveform @param fv: output coefficients. These have been pre-allocated and the number of channels in a indicates the order of the analysis. @param type: the types of coefficients to be produced. "lpc", "cep" etc @param factor: the frame length factor, i.e. the analysis frame length will be this times the local pitch period. @param wf: function for windowing. See \Ref{Windowing mechanisms} */ void sig2coef(EST_Wave &sig, EST_Track &a, EST_String type, float factor = 2.0, EST_WindowFunc *wf = EST_Window::creator(DEFAULT_WINDOW_NAME)); /** Produce multiple coefficients from a waveform by repeated calls to sig2coef. @param sig: input waveform @param fv: output coefficients. These have been pre-allocated and the number of channels in a indicates the order of the analysis. @param op: Features structure containing options for analysis order, frame shift etc. @param slist: list of types of coefficients required, from the set of possible types that sig2coef can take. */ void sigpr_base(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist); /** Calculate the power for each frame of the waveform. @param sig: input waveform @param a: output power track @param factor: the frame length factor, i.e. the analysis frame length will be this times the local pitch period. */ void power(EST_Wave &sig, EST_Track &a, float factor); /** Calculate the rms energy for each frame of the waveform. This function calls \Ref{sig2energy} @param sig input waveform @param a output coefficients @param factor optional: the frame length factor, i.e. the analysis frame length will be this times the local pitch period. */ void energy(EST_Wave &sig, EST_Track &a, float factor); /** Mel scale filter bank analysis. The Mel scale triangular filters are computed via an FFT (see \Ref{fastFFT}). This routine is required for Mel cepstral analysis (see \Ref{melcep}). The analysis of each frame is done by \Ref{sig2fbank}. A typical filter bank analysis for speech recognition might use log energy outputs from 20 filters. @param sig: input waveform @param fbank: the output. The number of filters is determined from the number size of this track. @param factor: the frame length factor, i.e. the analysis frame length will be this times the local pitch period @param wf: function for windowing. See \Ref{Windowing mechanisms} @param up: whether the filterbank analysis should use power rather than energy. @param take_log: whether to take logs of the filter outputs @see sig2fbank @see melcep */ void fbank(EST_Wave &sig, EST_Track &fbank, const float factor, EST_WindowFunc *wf = EST_Window::creator(DEFAULT_WINDOW_NAME), const bool up = false, const bool take_log = true); /** Mel scale cepstral analysis via filter bank analysis. Cepstral parameters are computed for each frame of speech. The analysis requires \Ref{fbank}. The cepstral analysis of the filterbank outputs is performed by \Ref{fbank2melcep}. A typical Mel cepstral coefficient (MFCC) analysis for speech recognition might use 12 cepstral coefficients computed from a 20 channel filterbank. @param sig input: waveform @param mfcc_track: the output @param factor: the frame length factor, i.e. the analysis frame length will be this times the local pitch period @param fbank_order: the number of Mel scale filters used for the analysis @param liftering_parameter: for filtering in the cepstral domain See \Ref{fbank2melcep} @param wf: function for windowing. See \Ref{Windowing mechanisms} @param include_c0: whether the zero'th cepstral coefficient is to be included @param up: whether the filterbank analysis should use power rather than energy. @see fbank @see fbank2melcep */ void melcep(EST_Wave &sig, EST_Track &mfcc_track, float factor, int fbank_order, float liftering_parameter, EST_WindowFunc *wf = EST_Window::creator(DEFAULT_WINDOW_NAME), const bool include_c0 = false, const bool up = false); //@} /**@name Pitch/F0 Detection Algorithm functions These functions are used to produce a track of fundamental frequency (F0) against time of a waveform. */ //@{ /** Top level pitch (F0) detection algorithm. Returns a track containing evenly spaced frames of speech, each containing a F0 value for that point. At present, only the \Rref{srpd} pitch tracker is implemented, so this is always called regardless of what method is set to. @param sig: input waveform @param fz: output f0 contour @param op: parameters for pitch tracker @param method: pda method to be used. */ void pda(EST_Wave &sig, EST_Track &fz, EST_Features &op, EST_String method=""); /** Top level intonation contour detection algorithm. Returns a track containing evenly spaced frames of speech, each containing a F0 for that point. {\tt icda} differs from \Ref{pda} in that the contour is smoothed, and unvoiced portions have interpolated F0 values. @param sig: input waveform @param fz: output f0 contour @param speech: Interpolation is controlled by the speech track. When a point has a positive value in the speech track, it is a candidate for interpolation. @param op: parameters for pitch tracker @param method: pda method to be used. */ void icda(EST_Wave &sig, EST_Track &fz, EST_Track &speech, EST_Option &op, EST_String method = ""); /** Create a set sensible defaults for use in pda and icda. */ void default_pda_options(EST_Features &al); /** Super resolution pitch tracker. srpd is a pitch detection algorithm that produces a fundamental frequency contour from a speech waveform. At present only the super resolution pitch determination algorithm is implemented. See (Medan, Yair, and Chazan, 1991) and (Bagshaw et al., 1993) for a detailed description of the algorithm. Frames of data are read in from sig in chronological order such that each frame is shifted in time from its predecessor by pda_frame_shift. Each frame is analysed in turn. The maximum and minimum signal amplitudes are initially found over the duration of two segments, each of length N_min samples. If the sum of their absolute values is below two times noise_floor, the frame is classified as representing silence and no coefficients are calculated. Otherwise, a cross correlation coefficient is calculated for all n from a period in samples corresponding to min_pitch to a period in samples corresponding to max_pitch, in steps of decimation_factor. In calculating the coefficient only one in decimation_factor samples of the two segments are used. Such down-sampling permits rapid estimates of the coefficients to be calculated over the range N_min <= n <= N_max. This results in a cross-correlation track for the frame being analysed. Local maxima of the track with a coefficient value above a specified threshold form candidates for the fundamental period. The threshold is adaptive and dependent upon the values v2uv_coeff_thresh , min_v2uv_coef_thresh , and v2uv_coef_thresh_rati_ratio. If the previously analysed frame was classified as unvoiced or silent (which is the initial state) then the threshold is set to v2uv_coef_thresh. Otherwise, the previous frame was classified as being voiced, and the threshold is set equal to [\-r] v2uv_coef_thresh_rati_ratio times the cross-correlation coefficient value at the point of the previous fundamental period in the former coefficients track. This product is not permitted to drop below v2uv_coef_thresh. If no candidates for the fundamental period are found, the frame is classified as being unvoiced. Otherwise, the candidates are further processed to identify the most likely true pitch period. During this additional processing, a threshold given by anti_doubling_thres is used. If the peak_tracking flag is set to true, biasing is applied to the cross-correlation track as described in (Bagshaw et al., 1993). @param sig: input waveform @param op: options regarding pitch tracking parameters @param op.min_pitch: minimum permitted F0 value @param op.max_pitch: maximum permitted F0 value @param op.pda_frame_shift: analysis frame shift @param op.pda_frame_length: analysis frame length @param op.lpf_cutoff: cut off frequency for low pass filtering @param op.lpf_order: order of low pass filtering (must be odd) @param op.decimation @param op.noise_floor @param op.min_v2uv_coef_thresh @param op.v2uv_coef_thresh_ratio @param op.v2uv_coef_thresh @param op.anti_doubling_thresh @param op.peak_tracking */ void srpd(EST_Wave &sig, EST_Track &fz, EST_Features &options); /** Smooth selected parts of an f0 contour. Interpolation is controlled by the speech track. When a point has a positive value in the speech track, it is a candidate for interpolation. */ void smooth_phrase(EST_Track &c, EST_Track &speech, EST_Features &options, EST_Track &sm); /** Smooth all the points in an F0 contour*/ void smooth_portion(EST_Track &c, EST_Option &op); //@} /**@name Delta and Acceleration coefficients Produce delta and acceleration coefficients from a set of coefficients or the waveform. */ //@{ /** Produce a set of delta coefficients for a track The delta function is used to produce a set of coefficients which estimate the rate of change of a set of parameters. The output track d must be setup before hand, i.e. it must have the same number of frames and channels as tr. @param tr: input track of base coefficients @param d: output track of delta coefficients. @param regression_length: number of previous frames on which delta estimation is calculated on. */ void delta(EST_Track &tr, EST_Track &d, int regression_length = 3); /** Produce multiple sets of delta coefficients from a waveform. Calculate specified types of delta coefficients. This function is used when the base types of coefficients haven't been calculated. This function calls sig2coef to calculate the base types from which the deltas are calculated, and hence the requirements governing the setup of fv for sig2coef also hold here. @param sig: input waveform @param fv: output coefficients. These have been pre-allocated and the number of channels in a indicates the order of the analysis. @param op: Features structure containing options for analysis order, frame shift etc. @param slist: list of types of delta coefficients required. */ void sigpr_delta(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist); /** Produce multiple sets of acceleration coefficients from a waveform Calculate specified types of acceleration coefficients. This function is used when the base types of coefficient haven't been calculated. This function calls sig2coef to calculate the base types from which the deltas are calculated, and hence the requirements governing the setup of fv for sig2coef also hold here. @param sig: input waveform @param fv: output coefficients. These have been pre-allocated and the number of channels in a indicates the order of the analysis. @param op: Features structure containing options for analysis order, frame shift etc. @param slist: list of types of acceleration coefficients required. The delta function is used to produce a set of coefficients which estimate the rate of change of a set of parameters. */ void sigpr_acc(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist); //@} /* Convert a track containing coefficients of one type to a track containing coefficients of another. @param in_track input set of coefficients @param out_track input set of coefficients @param out_name name of desired output coefficients. @param in_name optional: often it is possible to determine the type of the input coefficients from the channel names. If this is not possible or these names should be ignored, the {\tt in_type} parameter can be used. */ void convert_track(EST_Track &in_track, EST_Track &out_track, const EST_String &out_type, const EST_String &in_type = ""); #endif /* __EST_SIGPR_UTT_H__ */ speech_tools/include/sigpr/EST_misc_sigpr.h0000644000076400007640000000621107262616577017475 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_MISC_SIGPR_H__ #define __EST_MISC_SIGPR_H__ /** Some generally useful things. * * @author Richard Caley * @version $Id: EST_misc_sigpr.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #include "EST_Wave.h" /**@name Miscellaneous Signal Processing Functions. * * Some Functions which deon't fit elsewhere. */ //@{ /**@name Preemphasis * * Used in LPC analysis and spectrogram creation. * These two functions are inverses of one another. */ //@{ /// Pre process to emphasise higher frequencies void EST_pre_emphasis(EST_Wave &signal, EST_Wave &psignal, float a); /// Post process to get the original back (eg after resynthesis). void EST_post_deemphasis(EST_Wave &signal, EST_Wave &dsignal, float a); //@} //@} #endif speech_tools/include/sigpr/EST_spectrogram.h0000644000076400007640000000577507262616577017702 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SPECTROGRAM_H__ #define __EST_SPECTROGRAM_H__ #include "EST_Wave.h" #include "EST_Track.h" #include "EST_Option.h" /**@name Spectrogram generation * * @author Richard Caley * @version $Id: EST_spectrogram.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ /// Compute the power-spectrogram void raw_spectrogram(EST_Track &sp, EST_Wave &sig, float length, float shift, int order, bool slow=0); /// Manipulate the spectrogram to void scale_spectrogram(EST_Track &s, float range, float b, float w); void make_spectrogram(EST_Wave &sig, EST_Track &sp, EST_Features &op); //@} #endif speech_tools/include/sigpr/EST_filter_design.h0000644000076400007640000001110410044502521020120 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FILTER_DESIGN_H__ #define __EST_FILTER_DESIGN_H__ #include "EST_Wave.h" #include "EST_FMatrix.h" #include "EST_Track.h" /**@name Filter Design FIR Filtering is a 2 stage process, first involving design and then the filtering itself. As the design is somewhat costly, it is usually desirable to design a filter outside the main loop. For one off filtering operations, functions are provided which design and filter the waveform in a single go. It is impossible to design an ideal filter, i.e. one which exactly obeys the desired frequency response. The "quality" of a filter is given by the order parameter, with high values indicating good approximations to desired responses. High orders are slower. The default is 199 which gives a pretty good filter, but a value as low as 19 is still usable if speech is important. */ //@{ /** Create an arbitrary filter or order {\tt order} that attempts to give the frequency response given by {\tt freq_response}. The vector {\tt freq_response} should be any size 2**N and contain a plot of the desired frequency response with values ranging between 0.0 and 1.0. The actual filtering is done by \Ref{FIRfilter}. @see design_lowpass_FIR_filter, design_highpass_FIR_filter @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ EST_FVector design_FIR_filter(const EST_FVector &freq_response, int filter_order); /** Design a FIR lowpass filter of order {\tt order} and cut-off frequency {\tt freq}. The filter coefficients are returned in the FVector and should be used in conjunction with \Ref{FIRfilter}. @see design_FIR_filter, design_highpass_FIR_filter, FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ EST_FVector design_lowpass_FIR_filter(int sample_rate, int freq, int order); /** Design a FIR highpass filter of order {\tt order} and cut-off frequency {\tt freq}. The filter coefficients are returned in the FVector and should be used in conjunction with \Ref{FIRfilter} @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter */ EST_FVector design_highpass_FIR_filter(int sample_rate, int freq, int order); //@} #endif /* __EST_FILTER_DESIGN_H__ */ speech_tools/include/ling_class/Makefile0000644000076400007640000000600007262605664017073 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Include Directory Makefile ## ########################################################################### TOP=../.. DIRNAME=include/ling_class H = EST_Utterance.h EST_utterance_aux.h EST_utterance_xml.h \ EST_relation_aux.h EST_relation_compare.h \ EST_Relation.h EST_Relation_tree.h EST_Relation_list.h EST_Relation_mls.h \ EST_Item.h EST_Item_Content.h EST_FeatureFunctionPackage.h \ EST_item_content_aux.h EST_item_aux.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/ cp -p *.h $(INCDIR)/EST/ speech_tools/include/ling_class/EST_Utterance.h0000644000076400007640000001431610067557465020264 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1995 (redone May 1998) */ /*-----------------------------------------------------------------------*/ /* EST_Utterance Class header file */ /* */ /*=======================================================================*/ #ifndef __Utterance_H__ #define __Utterance_H__ #include "EST_String.h" #include "EST_TList.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" #include "EST_Features.h" /** A class that contains EST_Items and EST_Relations between them. Used for holding interrelated linguistic structures. */ class EST_Utterance{ private: void copy(const EST_Utterance &u); int highest_id; public: /**@name Constructor and initialisation Functions */ //@{ /// default constructor EST_Utterance(); EST_Utterance(const EST_Utterance &u) { copy(u); } ~EST_Utterance() {clear();} //@} /// /**@name Utility Functions */ //@{ /// initialise utterance void init(); /// remove everything in utterance void clear(); /// clear the contents of the relations only void clear_relations(); /// set the next id to be n void set_highest_id(int n) {highest_id=n;} /// return the id of the next item int next_id(); //@} /**@name File i/o */ //@{ /** load an utterance from an ascii file */ EST_read_status load(const EST_String &filename); /** load an utterance from a already opened token stream */ EST_read_status load(EST_TokenStream &ts); /** save an utterance to an ascii file */ EST_write_status save(const EST_String &filename, const EST_String &type="est_ascii") const; /** save an utterance to an ostream */ EST_write_status save(ostream &outf,const EST_String &type) const; //@} EST_Utterance &operator=(const EST_Utterance &s); friend ostream& operator << (ostream &s, const EST_Utterance &u); EST_Relation * operator() (const EST_String &name) { return relation(name);} /** Utterance access */ //@{ /// Utterance level features EST_Features f; /// Evaluate all feature functions in utterance void evaluate_all_features(); /// The list of named relations EST_Features relations; /// number of relations in this utterance int num_relations() const { return relations.length(); } /** returns true if utterance contains named relations. {\bf name} can be either a single string or a bracketed list of strings e.g. "(Word Phone Syl)". */ bool relation_present(const EST_String name) const; /** returns true if utterance contains all the relations named in the list {\bf name}. */ bool relation_present(EST_StrList &names) const; /// get relation by name EST_Relation *relation(const char *name,int err_on_not_found=1) const; /// return EST_Item whose id is n. EST_Item *id(const EST_String &n) const; /// create a new relation called n. EST_Relation *create_relation(const EST_String &relname); /// remove the relation called n. void remove_relation(const EST_String &relname); void sub_utterance(EST_Item *i); }; void utt_2_flat_repr( const EST_Utterance &utt, EST_String &flat_repr ); int utterance_merge(EST_Utterance &utt, EST_Utterance &sub_utt, EST_Item *utt_root, EST_Item *sub_root); int utterance_merge(EST_Utterance &utt, EST_Utterance &extra, EST_String feature); void sub_utterance(EST_Utterance &sub,EST_Item *i); #endif speech_tools/include/ling_class/EST_utterance_aux.h0000644000076400007640000000566310045556421021171 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_UTTERANCE_AUX_H__ #define __EST_UTTERANCE_AUX_H__ #include "EST_String.h" #include "EST_types.h" /** Auxiliary operations on utterance structures. * * @author Richard Caley * @version $Id: EST_utterance_aux.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ //@{ EST_String options_utterance_filetypes(void); EST_String options_utterance_filetypes_long(void); void utterance_xml_register_id(const EST_String pattern, const EST_String result); void utterance_xml_registered_ids(EST_StrList &list); //@} #endif speech_tools/include/ling_class/EST_utterance_xml.h0000644000076400007640000000533007262616577021203 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_UTTERANCE_XML_H__ #define __EST_UTTERANCE_XML_H__ /** Export some RXP functionality for use in festival. * * @author Richard Caley * @version $Id: EST_utterance_xml.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #include "rxp/XML_Parser.h" InputSource utterance_xml_try_and_open(Entity ent); #endif speech_tools/include/ling_class/EST_relation_aux.h0000644000076400007640000001443707262605664021026 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1994 */ /* Release: 0.9 */ /*-----------------------------------------------------------------------*/ /* Auxiliary Label Routines header file */ /* */ /*=======================================================================*/ #ifndef __EST_RELATION_AUX_H__ #define __EST_RELATION_AUX_H__ #include "EST_String.h" #include "EST_Track.h" #include "ling_class/EST_Utterance.h" #include "EST_Option.h" #include "EST_THash.h" typedef EST_TList EST_RelationList; typedef EST_TStringHash EST_hashedRelationList; EST_String options_relation_filetypes(void); void convert_to_broad(EST_Relation &seg, EST_StrList &pos_list, EST_String broad_name ="", int polarity = 1); void convert_to_broad_class(EST_Relation &seg, const EST_String &class_type, EST_Option &options); int merge_label(EST_Relation &seg, const EST_String &labtype); void change_label(EST_Relation &seg, const EST_String &oname, const EST_String &nname); void merge_all_label(EST_Relation &seg, const EST_String &labtype); void track_to_label(const EST_Track &tr, EST_Relation &lab, float thresh=0.0); void track_to_pm(const EST_Track &tr, int sample_rate, EST_Relation &lab); void label_to_track(const EST_Relation &lab, const EST_Option &al, const EST_Option &op, EST_Track &tr); void label_to_track(const EST_Relation &lab, EST_Track &tr, float shift, float offset=0.0, float range = 1.0, float req_length = -1.0, const EST_String &pad="low"); void shift_label(EST_Relation &seg, float shift); void label_map(EST_Relation &seg, EST_Option &map); void quantize(EST_Relation &a, float q); int edit_labels(EST_Relation &a, EST_String sedfile); void RelationList_select(EST_RelationList &mlf, EST_StrList filenames, bool exact_match); EST_Relation RelationList_extract(EST_RelationList &mlf, const EST_String &filename, bool base); EST_Relation RelationList_combine(EST_RelationList &mlf); EST_Relation RelationList_combine(EST_RelationList &mlf, EST_Relation &key); int relation_divide(EST_RelationList &mlf, EST_Relation &lab, EST_Relation &keylab, EST_String ext); int relation_divide(EST_RelationList &mlf, EST_Relation &lab, EST_Relation &keylab, EST_StrList &list, EST_String ext); EST_Litem *RelationList_ptr_extract(EST_RelationList &mlf, const EST_String &filename, bool base); void relation_convert(EST_Relation &lab, EST_Option &al, EST_Option &op); EST_read_status load_RelationList(const EST_String &filename, EST_RelationList &plist); EST_write_status save_RelationList(const EST_String& filename, const EST_RelationList &plist); EST_write_status save_RelationList(const EST_String &filename, const EST_RelationList &plist, int time=1, int path = 1); EST_write_status save_ind_RelationList(const EST_String &filename, const EST_RelationList &plist, const EST_String &features, int path); EST_write_status save_WordList(const EST_String &filename, const EST_RelationList &plist, int n); EST_write_status save_SentenceList(EST_String filename, EST_RelationList &plist, int n); EST_read_status read_RelationList(EST_RelationList &mlf, EST_StrList &files, EST_Option &al); float start(EST_Item *n); float duration(EST_Item *n); /// hashed relation lists for super speed void build_RelationList_hash_table(EST_RelationList &mlf, EST_hashedRelationList &hash_table, const bool base); bool hashed_RelationList_extract(EST_Relation* &rel, const EST_hashedRelationList &hash_table, const EST_String &filename, bool base); #endif /* __EST_RELATION_AUX_H__ */ speech_tools/include/ling_class/EST_relation_compare.h0000644000076400007640000001225507262605664021653 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1994 */ /*-----------------------------------------------------------------------*/ /* Label Comparison Routines */ /* */ /*=======================================================================*/ #ifndef __EST_RELATION_COMPARE_H__ #define __EST_RELATION_COMPARE_H__ float label_distance1(EST_Item &ref, EST_Item &test); EST_Item *nthpos(EST_Relation &a, int n); void compare_labels(EST_Relation &reflab, EST_Relation &testlab); void relation_match(EST_Relation &a, EST_Relation &b); void function_match(EST_II_KVL &u, EST_Relation &a, EST_Relation &b); void monotonic_match(EST_II_KVL &a, EST_II_KVL &b); void show_links(EST_Relation &a, EST_Relation &b); int close_enough(EST_Item &a, EST_Item &b); int matrix_deletions(EST_FMatrix &m); int matrix_insertions(EST_FMatrix &m); void matrix_ceiling(EST_FMatrix &m, float max); void minimise_matrix_by_row(EST_FMatrix &m); void minimise_matrix_by_column(EST_FMatrix &m); int lowest_pos(EST_FMatrix &m, int j); float label_distance2(EST_Item &ref, EST_Item &test); void print_results(EST_Relation &ref, EST_Relation &test, EST_FMatrix &m, int tot, int del, int ins, int v); void print_aligned_trans(EST_Relation &ref, EST_Relation &test, EST_FMatrix &m); void pos_only(EST_Relation &a); void print_s_trans(EST_Relation &a, int width=3); int num_b_deletions(EST_FMatrix &m, int last, int current); int num_b_insertions(EST_FMatrix &m, int last, int current); int column_hit(EST_FMatrix &m, int c); int row_hit(EST_FMatrix &m, int r); void print_matrix_scores(EST_Relation &ref, EST_Relation &test, EST_FMatrix &a); void print_i_d_scores(EST_FMatrix &m); void test_labels(EST_Utterance &ref, EST_Utterance &test, EST_Option &op); int commutate(EST_Item *a_ptr, EST_II_KVL &f1, EST_II_KVL &f2, EST_II_KVL &lref, EST_II_KVL <est); void reassign_links(EST_Relation &a, EST_II_KVL &u, EST_String stream_type); void reassign_links(EST_Relation &a, EST_Relation &b, EST_II_KVL &ua, EST_II_KVL &ub); int compare_labels(EST_Utterance &ref, EST_Utterance &test, EST_String name, EST_II_KVL &uref, EST_II_KVL &utest); int insdel(EST_II_KVL &a); void error_location(EST_Relation &e, EST_FMatrix &m, int ref); void multiple_matrix_compare(EST_TList &rmlf, EST_TList &tmlf, EST_FMatrix &m, EST_String rpos, EST_String tpos, int method, float t, int v); EST_FMatrix matrix_compare(EST_Relation &reflab, EST_Relation &testlab, int method, float t, int v); void multiple_labels(EST_Relation &reflab); void threshold_labels(EST_Relation &reflab, float t); #endif //__EST_RELATION_COMPARE_H__ speech_tools/include/ling_class/EST_Relation.h0000644000076400007640000002101310056153700020055 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /* --------------------------------------------------------------------- */ /* another architecture */ /* */ /*************************************************************************/ #ifndef __EST_RELATION_H__ #define __EST_RELATION_H__ #include "EST_String.h" #include "EST_TList.h" #include "EST_TKVL.h" #include "EST_THash.h" #include "EST_Val.h" #include "EST_types.h" #include "EST_Token.h" #include "EST_Features.h" #include "ling_class/EST_Item.h" class EST_Utterance; class EST_Relation_Iterator; /** Relations are a container class for EST_Items. Three types of relation structure are supported: Linear lists Trees Multi-linear structures as used in autosegmental phonology etc */ class EST_Relation { EST_String p_name; EST_Utterance *p_utt; EST_Item *p_head; EST_Item *p_tail; // less meaningful in a tree EST_Item *get_item_from_name(EST_THash &inames,int name); EST_Item *get_item_from_name(EST_TVector< EST_Item * > &inames,int name); EST_write_status save_items(EST_Item *item, ostream &outf, EST_TKVL &contentnames, EST_TKVL &itemnames, int &node_count) const; static void node_tidy_up_val(int &k, EST_Val &v); static void node_tidy_up(int &k, EST_Item *node); EST_read_status load_items(EST_TokenStream &ts, const EST_THash &contents); EST_read_status load_items(EST_TokenStream &ts, const EST_TVector < EST_Item_Content * > &contents ); void copy(const EST_Relation &r); public: /** default constructor */ EST_Relation(); /** Constructor which sets name of relation */ EST_Relation(const EST_String &name); /** Constructor which copies relation r */ EST_Relation(const EST_Relation &r) { copy(r); } /** default destructor */ ~EST_Relation(); /** Features which belong to the relation rather than its items*/ EST_Features f; /** Evaluate the relation's feature functions */ //void evaluate_features(); /** Evaluate the feature functions of all the items in the relation */ void evaluate_item_features(); /** Clear the relation of items */ void clear(); /** Return the EST_Utterance to which this relation belongs */ EST_Utterance *utt(void) { return p_utt; } /** Set the EST_Utterance to which this relation belongs */ void set_utt(EST_Utterance *u) { p_utt = u; } /** Return the name of the relation */ const EST_String &name() const { return (this == 0) ? EST_String::Empty : p_name; } /** Return the head (first) item of the relation */ EST_Item *head() const {return (this == 0) ? 0 : p_head;} /** Return the root item of the relation */ EST_Item *root() const {return head();} /** Return the tail (last) item of the relation */ EST_Item *tail() const {return (this == 0) ? 0 : p_tail;} // This have been replaced by Relation_Tree functions EST_Item *first() const { return head(); } EST_Item *first_leaf() const; EST_Item *last() const { return tail(); } EST_Item *last_leaf() const; /** Return the tail (last) item of the relation */ // EST_Item *id(int i); /** number of items in this relation */ int length() const; // int num_nodes() const; // int num_leafs() const; /** return true if relation does not contain any items */ int empty() const { return p_head == 0; } /** remove EST_Item item from relation */ void remove_item(EST_Item *item); /** remove all occurrences of feature name from relation's items */ void remove_item_feature(const EST_String &name); /** Load relation from file */ EST_read_status load(const EST_String &filename, const EST_String &type="esps"); /** Load relation from already open tokenstream */ // EST_read_status load(EST_TokenStream &ts, // const EST_THash &contents); /** Load relation from already open tokenstream */ EST_read_status load(EST_TokenStream &ts, const EST_TVector < EST_Item_Content * > &contents ); /** Load relation from already open tokenstream */ EST_read_status load(const EST_String &filename, EST_TokenStream &ts, const EST_String &type); /** Save relation to file */ EST_write_status save(const EST_String &filename, bool evaluate_ff = false) const; /** Save relation to file, evaluating all feature functions before hand */ EST_write_status save(const EST_String &filename, const EST_String &type, bool evaluate_ff = false) const; /** Save relation from already open ostream */ EST_write_status save(ostream &outf,EST_TKVL contents) const; /** Save relation from already open ostream */ EST_write_status save(ostream &outf, const EST_String &type, bool evaluate_ff) const; /** Iteration */ typedef EST_Relation_Iterator Iterator; EST_Relation &operator=(const EST_Relation &s); friend ostream& operator << (ostream &s, const EST_Relation &u); EST_Item *append(EST_Item *si); EST_Item *append(); EST_Item *prepend(EST_Item *si); EST_Item *prepend(); friend class EST_Item; }; VAL_REGISTER_CLASS_DCLS(relation,EST_Relation) inline bool operator==(const EST_Relation &a, const EST_Relation &b) { return (&a == &b); } void copy_relation(const EST_Relation &from, EST_Relation &to); EST_Utterance *get_utt(EST_Item *s); class EST_Relation_Iterator { private: const EST_Relation &rel; EST_Item *next; public: EST_Relation_Iterator(const EST_Relation &r) : rel(r), next(NULL) { reset();}; void reset() { next=rel.head(); } bool has_more_elements() { return next != NULL; } EST_Item *next_element(); }; typedef EST_TList EST_RelationList; #endif speech_tools/include/ling_class/EST_Relation_tree.h0000644000076400007640000002101110044502521021066 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /* --------------------------------------------------------------------- */ /* Functions for TREE relations */ /* */ /*************************************************************************/ #ifndef __EST_RELATION_TREE_H__ #define __EST_RELATION_TREE_H__ /**@name Functions for building and traversing tree relations */ //@{ /**@name Tree traversal functions */ //@{ /// return parent of n inline EST_Item *parent(const EST_Item *n) { return n->first()->up(); } /// return first daughter of n inline EST_Item *daughter1(const EST_Item *n) { return n->down(); } /// return second daughter of n inline EST_Item *daughter2(const EST_Item *n) { return n->down()->next(); } /// return nth daughter of n EST_Item *daughtern(const EST_Item *n, int nth); /// return last daughter of n inline EST_Item *daughtern(const EST_Item *n) { return n->down()->last(); } /// return next sibling (sister) of n inline EST_Item *next_sibling(const EST_Item *n) { return n->next(); } /// return previous sibling (sister) of n inline EST_Item *prev_sibling(const EST_Item *n) { return n->prev(); } /// return root node of treeprevious sibling (sister) of n inline EST_Item *root(const EST_Item *n) { return n->top(); } /** return parent of n as seen from relation relname */ inline EST_Item *parent(const EST_Item *n,const char *relname) { return parent(as(n,relname)); } //inline EST_Item *daughters(const EST_Item *n,const char *relname) // { return daughters(as(n,relname)); } /** return first daughter of n as seen from relation relname */ inline EST_Item *daughter1(const EST_Item *n,const char *relname) { return daughter1(as(n,relname)); } /** return second daughter of n as seen from relation relname */ inline EST_Item *daughter2(const EST_Item *n,const char *relname) { return daughter2(as(n,relname)); } /** return last daughter of n as seen from relation relname */ inline EST_Item *daughtern(const EST_Item *n,const char *relname) { return daughtern(as(n,relname)); } /** return next sibling (sister) of n as seen from relation relname */ inline EST_Item *next_sibling(const EST_Item *n,const char *relname) { return next_sibling(as(n,relname)); } /** return previous sibling (sister) of n as seen from relation relname */ inline EST_Item *prev_sibling(const EST_Item *n,const char *relname) { return prev_sibling(as(n,relname)); } /** return root of tree of n as seen from relation relname */ inline EST_Item *root(const EST_Item *n,const char *relname) { return root(as(n,relname)); } // should be deleted. EST_Item *first_leaf_in_tree(const EST_Item *root); // should be deleted. EST_Item *last_leaf_in_tree(const EST_Item *root); /** return the first leaf (terminal node) which is dominated by n. Note that this is different from daughter1 etc as this descends the tree to find the leftmost terminal node (it is like the transitive closure of daughter1). */ inline EST_Item *first_leaf(const EST_Item *n) {return first_leaf_in_tree(n);} /** return the last leaf (terminal node) which is dominated by n. Note that this is different from daughter1 etc as this descends the tree to find the right terminal node (it is like the transitive closure of daughtern). */ inline EST_Item *last_leaf(const EST_Item *n) { return last_leaf_in_tree(n); } /** Return next leaf in tree given n. If n is a terminal node, next_leaf() will return the next leaf in the tree. If n is not terminal, this will return the leftmost terminal node dominated by n. This will return 0 only when the last leaf in the relation has been passed. */ inline EST_Item *next_leaf(const EST_Item *n) { return n->next_leaf(); } /** Return number of leaves (terminal nodes) under n */ int num_leaves(const EST_Item *n); /** Given a node t, return true if c is under it in a tree */ int in_tree(const EST_Item *c,const EST_Item *t); //@} /**@name Tree building functions */ //@{ /** Add a daughter to node n, after any existing daughters, and return the next daughter. If p is 0, make a new node for the daughter, otherwise add p to this relation as n's daughter. */ EST_Item *append_daughter(EST_Item *n, EST_Item *p=0); /** Add a daughter to node n as seen from relation relname, after any existing daughters, and return the next daughter. If p is 0, make a new node for the daughter, otherwise add p to this relation as n's daughter. */ EST_Item *append_daughter(EST_Item *n, const char *relname, EST_Item *p=0); /** Add a daughter to node n, before any existing daughters, and return the next daughter. If p is 0, make a new node for the daughter, otherwise add p to this relation as n's daughter. */ EST_Item *prepend_daughter(EST_Item *n, EST_Item *p=0); /** Add a daughter to node n as seen from relation relname, before any existing daughters, and return the next daughter. If p is 0, make a new node for the daughter, otherwise add p to this relation as n's daughter. */ EST_Item *prepend_daughter(EST_Item *n, const char *relname, EST_Item *p=0); //@} //@} #endif speech_tools/include/ling_class/EST_Relation_list.h0000644000076400007640000001266411465017155021134 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /* --------------------------------------------------------------------- */ /* Functions for LIST relations */ /* */ /*************************************************************************/ #ifndef __EST_RELATION_LIST_H__ #define __EST_RELATION_LIST_H__ #if 0 /**@name Functions for building and traversing list relations */ //@{ /**@name List traversal functions */ //@{ /** return next item of n */ inline EST_Item *next(const EST_Item *n) { return n->next(); } /** return previous item of n */ inline EST_Item *prev(const EST_Item *n) { return n->prev(); } /** return last item in n's relation */ inline EST_Item *last(const EST_Item *n) { return n->last(); } /** return first item in n's relation */ inline EST_Item *first(const EST_Item *n) { return n->first(); } /** return next item of n as seen from relation relname */ inline EST_Item *next(const EST_Item *n,const char *relname) { return next(as(n,relname)); } /** return previous item of n as seen from relation relname */ inline EST_Item *prev(const EST_Item *n,const char *relname) { return prev(as(n,relname)); } /** return first item of n as seen from relation relname */ inline EST_Item *first(const EST_Item *n,const char *relname) { return first(as(n,relname)); } /** return last item of n as seen from relation relname */ inline EST_Item *last(const EST_Item *n,const char *relname) { return last(as(n,relname)); } #endif /** Given a node l, return true if c after it in a list relation. */ int in_list(const EST_Item *c, const EST_Item *l); /** Add a item after node n, and return the new item. If n is the first item in the list, the new item becomes the head of the list, otherwise it is inserted between n and it's previous current item. If p is 0, make a new node for the new item, otherwise add p to this relation as the next item in n's relation. */ EST_Item *add_after(const EST_Item *n, EST_Item *p=0); /** Add a item before node n, and return the new item. If n is the first item in the list, the new item becomes the head of the list, otherwise it is inserted between n and it's previous current item. If p is 0, make a new node for the new item, otherwise add p to this relation as the previous item in n's relation. */ EST_Item *add_before(const EST_Item *n, EST_Item *p=0); /** Remove the given item. */ void remove_item_list(EST_Relation *rel, EST_Item *n); //@} //@} #endif speech_tools/include/ling_class/EST_Relation_mls.h0000644000076400007640000000647707262605664020771 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /* --------------------------------------------------------------------- */ /* Functions for Multi-linear structure relations */ /* */ /*************************************************************************/ #ifndef __EST_RELATION_MLS_H__ #define __EST_RELATION_MLS_H__ inline EST_Item *link1(EST_Item *n) { return n->down()->down()->down(); } inline EST_Item *link2(EST_Item *n) { return n->down()->down()->next()->down(); } inline EST_Item *linkn(EST_Item *n) { return n->down()->down()->last()->down(); } EST_Item *link(int l,EST_Item *n); inline EST_Item *linkedfrom(EST_Item *n) { return n->up()->first()->up()->up(); } int linked(EST_Item *from, EST_Item *to); inline EST_Item *next_link(EST_Item *n) { return n->up()->next()->down(); } void add_link(EST_Item *from, EST_Item *to); void remove_link(EST_Item *from, EST_Item *to); #endif speech_tools/include/ling_class/EST_Item.h0000644000076400007640000004163011463567714017226 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /* --------------------------------------------------------------------- */ /* */ /* General class for representing linguistic information within a */ /* EST_Relation. This consists of two parts, the relation specific */ /* part and the information content part. The information content */ /* part may be shared between multiple EST_Items. */ /* */ /* This is typically used to represent things like words, phones but */ /* more abstract entities like NPs and nodes in metrical trees. */ /* */ /*************************************************************************/ #ifndef __EST_ITEM_H__ #define __EST_ITEM_H__ #include "EST_String.h" #include "EST_Features.h" #include "ling_class/EST_Item_Content.h" typedef EST_Val (*EST_Item_featfunc)(EST_Item *s); extern val_type val_type_featfunc; const EST_Item_featfunc featfunc(const EST_Val &v); EST_Val est_val(const EST_Item_featfunc f); class EST_Relation; class ling_class_init; /** A class for containing individual linguistic objects such as words or phones. These contain two types of information. This first is specific to the \Ref{EST_Relation} we are viewing this ling item from, the second part consists of a set of features. These features may be shared by instances of this ling item in different EST_Relation within the same EST_Utterances The shared part of an EST_Item is represented by the class EST_Item_Content. It should not normally be accessed by the general users as reverse links from the contents to each of the EST_Items it is part of are held ensure the integrity of the structures. Changing these without maintain the appropriate links is unlikely to be stable. We believe this structure is the most efficient for the most natural use we envisage. Traversal of the items .... */ class EST_Item { private: EST_Item_Content *p_contents; EST_Relation *p_relation; // In general (when we need it) // EST_TKVL arcs; // but specifically EST_Item *n; EST_Item *p; EST_Item *u; EST_Item *d; void unref_contents(); void ref_contents(); void copy(const EST_Item &s); // Internal manipulation functions // Get the daughters of node, removing reference to them EST_Item *grab_daughters(void); /* Get the contents, removing reference to them, this doesn't delete the contents if this item is the only reference */ EST_Item_Content *grab_contents(void); protected: static void class_init(void); public: /**@name Constructor Functions */ //@{ /// Default constructor EST_Item(); /// Copy constructor only makes reference to contents EST_Item(const EST_Item &item); /// Includes reference to relation EST_Item(EST_Relation *rel); /// Most common form of construction EST_Item(EST_Relation *rel, EST_Item *si); /// Deletes it and references to it in its contents ~EST_Item(); //@} /**@name Feature access functions. These functions are wrap-around functions to the basic access functions in the \Ref{EST_Features} class. In all these functions, if the optional argument m} is set to 1, an error is thrown if the feature does not exist*/ //@{ /** return the value of the feature name cast as a float */ const float F(const EST_String &name) const {return f(name).Float();} /** return the value of the feature name cast as a float, returning def if not found.*/ const float F(const EST_String &name,float def) const {return f(name,def).Float();} /** return the value of the feature name cast as a EST_String */ const EST_String S(const EST_String &name) const {return f(name).string();} /** return the value of the feature name cast as a EST_String, returning def if not found. */ const EST_String S(const EST_String &name, const EST_String &def) const {return f(name, def).string();} /** return the value of the feature name cast as a int */ const int I(const EST_String &name) const {return f(name).Int();} /** return the value of the feature name cast as a int returning def if not found.*/ const int I(const EST_String &name, int def) const {return f(name, def).Int();} /** return the value of the feature name cast as a EST_Features */ EST_Features &A(const EST_String &name) const {return *feats(f(name));} /** return the value of the feature name cast as a EST_Features, returning def if not found. */ EST_Features &A(const EST_String &name,EST_Features &def) const {EST_Features *ff = new EST_Features(def); return *feats(f(name, est_val(ff)));} //@} /**@name Feature setting functions. A separate function is provided for each permissible value type */ //@{ /** set feature name to val */ void set(const EST_String &name, int ival) { EST_Val pv(ival);features().set_path(name, pv); } /** set feature name to val */ void set(const EST_String &name, float fval) { EST_Val pv(fval); features().set_path(name,pv); } /** set feature name to val */ void set(const EST_String &name, double fval) { EST_Val pv((float)fval);features().set_path(name,pv); } /** set feature name to val */ void set(const EST_String &name, const EST_String &sval) { EST_Val pv(sval);features().set_path(name,pv); } /** set feature name to val */ void set(const EST_String &name, const char *cval) { EST_Val pv(cval);features().set_path(name,pv); } /** set feature name to val, a function registered in the feature function list. */ void set_function(const EST_String &name, const EST_String &funcname) { features().set_function(name,funcname); } /** set feature name to f, a set of features, which is copied into the object. */ void set(const EST_String &name, EST_Features &f) { EST_Features *ff = new EST_Features(f); features().set_path(name, est_val(ff)); } /** set feature name to f, whose type is EST_Val. */ void set_val(const EST_String &name, const EST_Val &sval) { features().set_path(name,sval); } //@} /**@name Utility feature functions */ //@{ /** remove feature name */ void f_remove(const EST_String &name) { features().remove(name); } /** find all the attributes whose values are functions, and replace them with their evaluation. */ void evaluate_features(); /** TRUE if feature is present, FALSE otherwise */ int f_present(const EST_String &name) const {return features().present(name); } // Number of items (including this) until no next item. int length() const; //@} // get contents from item EST_Item_Content *contents() const { return (this == 0) ? 0 : p_contents;} // used by tree manipulation functions void set_contents(EST_Item_Content *li); // These should be deleted. // The item's name const EST_String name() const { return (this == 0) ? EST_String::Empty : f("name",0).string(); } // Set item's name void set_name(const EST_String &name) const { if (this != 0) p_contents->set_name(name); } // Shouldn't normally be needed, except for iteration EST_Features &features() const { return p_contents->f; } const EST_Val f(const EST_String &name) const { EST_Val v; if (this == 0) { EST_error("item is null so has no %s feature",(const char *)name); } else { for (v=p_contents->f.val_path(name); v.type() == val_type_featfunc && featfunc(v) != NULL; v=(featfunc(v))((EST_Item *)(void *)this)); if (v.type() == val_type_featfunc) EST_error("NULL %s function",(const char *)name); } return v; } #if 0 const EST_Val &f(const EST_String &name, const EST_Val &def) const { if (this == 0) return def; else { const EST_Val *v; for (v=&(p_contents->f.val_path(name, def)); v->type() == val_type_featfunc && featfunc(*v) != NULL; v=&(featfunc(*v))((EST_Item *)(void *)this)); if (v->type() == val_type_featfunc) v = &def; return *v; } } #endif const EST_Val f(const EST_String &name, const EST_Val &def) const { if (this == 0) return def; else { EST_Val v; for (v=p_contents->f.val_path(name, def); v.type() == val_type_featfunc && featfunc(v) != NULL; v=(featfunc(v))((EST_Item *)(void *)this)); if (v.type() == val_type_featfunc) v = def; return v; } } /**@name Cross relational access */ //@{ /// View item from another relation (const char *) method EST_Item *as_relation(const char *relname) const { return (this == 0) ? 0 : p_contents->Relation(relname); } /// TRUE if this item is in named relation int in_relation(const EST_String &relname) const { return (this == 0) ? 0 : p_contents->in_relation(relname); } /// Access to the relation links EST_TKVL &relations() {return p_contents->relations;} /// The relation name of this particular item const EST_String &relation_name() const; /// The relation of this particular item EST_Relation *relation(void) const { return (this == 0) ? 0 : p_relation; } /// True if li is the same item ignoring its relation viewpoint int same_item(const EST_Item *li) const { return contents() && li->contents() && (contents() == li->contents()); } //@} // The remaining functions should not be accessed, they are should be // regarded as private member functions // Splice together a broken list. static void splice(EST_Item *a, EST_Item *b) { if(a !=NULL) a->n = b; if (b != NULL) b->p=a; } // Internal traversal - nnot recommended - use relation traversal functions // EST_Item *next() const { return this == 0 ? 0 : n; } // EST_Item *prev() const { return this == 0 ? 0 : p; } // EST_Item *down() const { return this == 0 ? 0 : d; } // EST_Item *up() const { return this == 0 ? 0 : u; } // Last item (most next) at this level EST_Item *last() const; // First item (most prev) at this level EST_Item *first() const; // Highest (most up) EST_Item *top() const; // Lowest (most down) EST_Item *bottom() const; // First item which has no down, within the descendants of this item EST_Item *first_leaf() const; // Next item which has no down, following above this item if necessary EST_Item *next_leaf() const; // Last item which has no down, following above this item if necessary EST_Item *last_leaf() const; // Next item in pre order (root, daughters, siblings) EST_Item *next_item() const; // Insert a new item after this, with li's contents EST_Item *insert_after(EST_Item *li=0); // Insert a new item before this, with li's contents EST_Item *insert_before(EST_Item *li=0); // Insert a new item below this, with li's contents (see tree methods) EST_Item *insert_below(EST_Item *li=0); // Insert a new item above this, with li's contents (see tree methods) EST_Item *insert_above(EST_Item *li=0); // Append a new daughter to this, with li's contents EST_Item *append_daughter(EST_Item *li=0); // Prepend a new daughter to this, with li's contents EST_Item *prepend_daughter(EST_Item *li=0); // Insert a new parent above this, with li's contents EST_Item *insert_parent(EST_Item *li=0); // Delete this item and all its occurrences in other relations void unref_all(); // Verification, double links are consistent (used after reading in) int verify() const; friend int i_same_item(const EST_Item *l1,const EST_Item *l2); friend int move_item(EST_Item *from, EST_Item *to); friend int merge_item(EST_Item *from, EST_Item *to); friend int move_sub_tree(EST_Item *from, EST_Item *to); friend int exchange_sub_trees(EST_Item *from,EST_Item *to); EST_Item &operator=(const EST_Item &s); friend ostream& operator << (ostream &s, const EST_Item &a); friend bool operator !=(const EST_Item &a, const EST_Item &b) { return !i_same_item(&a,&b); } friend bool operator ==(const EST_Item &a, const EST_Item &b) { return i_same_item(&a,&b); } friend class EST_Relation; friend class ling_class_init; }; inline int i_same_item(const EST_Item *l1,const EST_Item *l2) { return l1->contents() && l2->contents() && (l1->contents() == l2->contents()); } inline EST_Item *as(const EST_Item *n,const char *relname) { return n->as_relation(relname); } // Relation structure functions #include "ling_class/EST_Relation_list.h" #include "ling_class/EST_Relation_tree.h" #include "ling_class/EST_Relation_mls.h" inline EST_Item *next_item(const EST_Item *node) { return node->next_item(); } void remove_item(EST_Item *l, const char *relname); void copy_node_tree(EST_Item *from, EST_Item *to); void copy_node_tree_contents(EST_Item *from, EST_Item *to); void evaluate(EST_Item *a,EST_Features &f); #include "ling_class/EST_FeatureFunctionPackage.h" // Feature function support void EST_register_feature_function_package(const char *name, void (*init_fn)(EST_FeatureFunctionPackage &p)); void register_featfunc(const EST_String &name, const EST_Item_featfunc func); const EST_Item_featfunc get_featfunc(const EST_String &name,int must=0); EST_String get_featname(const EST_Item_featfunc func); #define EST_register_feature_functions(PACKAGE) \ do { \ extern void register_ ## PACKAGE ## _feature_functions(EST_FeatureFunctionPackage &p); \ EST_register_feature_function_package( #PACKAGE , register_ ## PACKAGE ## _feature_functions); \ } while(0) #endif speech_tools/include/ling_class/EST_Item_Content.h0000644000076400007640000001260310044502521020671 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* */ /* The shared part of an EST_Item, containing the linguistic */ /* contents, such as part of speech, stress etc. Basically holds a */ /* list of feature value pairs are required. */ /* */ /* This class is effectively private to the EST_Item class and */ /* shouldn't be referenced outside that clase */ /* */ /*=======================================================================*/ #ifndef __EST_ITEM_CONTENT_H__ #define __EST_ITEM_CONTENT_H__ #include "EST_String.h" #include "EST_Features.h" VAL_REGISTER_CLASS_DCLS(icontent,EST_Item_Content) VAL_REGISTER_CLASS_DCLS(item,EST_Item) class EST_Item; /** A class for containing individual linguistic features and references to relations. This class contents the potentially shared part of an \Ref{EST_Item}. It contains a list of features allowing string names to be related to string, floats, ints and arbitrary objects. It also contains a reference list to the \Ref{EST_Item}s indexed by the relation names. This class should not normally be accessed by anyone other than the \Ref{EST_Item}. */ class EST_Item_Content { private: void copy(const EST_Item_Content &x); public: /**@name Constructor Functions */ //@{ /// Default constructor EST_Item_Content() {} /// Copy constructor EST_Item_Content(const EST_Item_Content &content) { copy(content); } /// destructor ~EST_Item_Content(); //@} /// General features for this item EST_Features f; /** return the name of the item, e.g. the name of the phone or the text of the word*/ // this should be changed back to a reference once we figure // out how to do it. const EST_String name() const {return f.S("name");} /// set name void set_name(const EST_String &s) {f.set("name",s);} // Links to ling_items that share this information EST_TKVL relations; EST_Item_Content& operator = (const EST_Item_Content& a); friend ostream& operator << (ostream &s, const EST_Item_Content &a); /**@name Relation related member functions */ //@{ EST_Item *Relation(const char *name) { EST_Item *d = 0; return ::item(relations.val_def(name,est_val(d))); } int in_relation(const EST_String &name) const { return relations.present(name); } // Unreference this ling_content from the named relation int unref_relation(const EST_String &relname); // Unreference this ling_content from all relations and delete int unref_and_delete(); //@} friend class EST_Item; }; #endif speech_tools/include/ling_class/EST_FeatureFunctionPackage.h0000644000076400007640000000655407262616577022717 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FEATUREFUNCTIONPACKAGE_H__ #define __EST_FEATUREFUNCTIONPACKAGE_H__ /** Represents a named collection of named functions. * * @author Richard Caley * @version $Id: EST_FeatureFunctionPackage.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #include "ling_class/EST_Item.h" #include "EST_THash.h" class EST_FeatureFunctionPackage { public: struct Entry { EST_Item_featfunc func; }; private: const EST_String p_name; EST_TStringHash p_entries; public: EST_FeatureFunctionPackage(const EST_String name, int n); EST_FeatureFunctionPackage(const char *name, int n); const EST_String name(void) { return p_name; } void register_func(const EST_String &name, const EST_Item_featfunc func); const Entry &lookup(const EST_String &name, int &found) const; const EST_String lookup(const EST_Item_featfunc func, int &found) const; }; int operator == (const EST_FeatureFunctionPackage::Entry &a, const EST_FeatureFunctionPackage::Entry &b); #endif speech_tools/include/ling_class/EST_item_content_aux.h0000644000076400007640000000726007262616577021702 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_ITEM_CONTENT_AUX_H__ #define __EST_ITEM_CONTENT_AUX_H__ /** Non core feature funtionality. * * @author Richard Caley * @version $Id: EST_item_content_aux.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ #include "EST_features_aux.h" class EST_Item_Content; class EST_String; /** Safe feature access functions. * * These functions are guaranteed to return a value even if * there is an otherwise fatal error. */ //@{ /// Return the value as an EST_Val. EST_Val getVal(const EST_Item_Content &f, const EST_String name, const EST_Val &def, EST_feat_status &s); /// Return the value as a string. EST_String getString(const EST_Item_Content &f, const EST_String name, const EST_String &def, EST_feat_status &s); /// Return the values as a float. float getFloat(const EST_Item_Content &f, const EST_String name, const float &def, EST_feat_status &s); /// Return the values as an integer. int getInteger(const EST_Item &f, const EST_String name, const int &def, EST_feat_status &s); //@} float start(const EST_Item_Content &itemc); float mid(const EST_Item_Content &itemc); float time(const EST_Item_Content &itemc); float end(const EST_Item_Content &itemc); //@} #endif speech_tools/include/ling_class/EST_item_aux.h0000644000076400007640000000732410056153700020124 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_ITEM_AUX_H__ #define __EST_ITEM_AUX_H__ /** Non core feature funtionality. * * @author Richard Caley * @version $Id: EST_item_aux.h,v 1.3 2004/05/24 10:32:30 korin Exp $ */ //@{ #include "EST_features_aux.h" class EST_Item; class EST_String; /** Safe feature access functions. * * These functions are guaranteed to return a value even if * there is an otherwise fatal error. */ //@{ /// Return the value as an EST_Val. EST_Val getVal(const EST_Item &f, const EST_String name, const EST_Val &def, EST_feat_status &s); /// Return the value as a string. EST_String getString(const EST_Item &f, const EST_String name, const EST_String &def, EST_feat_status &s); /// Return the values as a float. float getFloat(const EST_Item &f, const EST_String name, const float &def, EST_feat_status &s); /// Return the values as an integer. int getInteger(const EST_Item &f, const EST_String name, const int &def, EST_feat_status &s); //@} float start(const EST_Item &item); float mid(const EST_Item &item); float time(const EST_Item &item); float end(const EST_Item &item); //@} //Rob's function for jumping around HRG structures more easily EST_Item *item_jump(EST_Item *from, const EST_String &to); #endif speech_tools/include/instantiate/Makefile0000644000076400007640000000631007262605664017304 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Files in this directory define how best to instantiate a template ## ## class. ## ## ## ########################################################################### TOP=../.. DIRNAME=include/instantiate H = EST_TVectorI.h EST_TSimpleVectorI.h EST_TMatrixI.h EST_TSimpleMatrixI.h \ EST_TListI.h EST_TSortableI.h \ EST_TKVLI.h EST_THashI.h EST_TStringHashI.h \ EST_TNamedEnumI.h EST_TDequeI.h EST_TIteratorI.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/instantiate cp -p *.h $(INCDIR)/EST/instantiate speech_tools/include/instantiate/EST_TVectorI.h0000644000076400007640000001001210457524614020214 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TVECTOR_I_H__ #define __EST_TVECTOR_I_H__ /** Instantiate rules for vector template. * * @author Richard Caley * @version $Id: EST_TVectorI.h,v 1.4 2006/07/19 21:52:12 awb Exp $ */ // Instantiation Macros #define Instantiate_TVector_T_MIN(TYPE,TAG) \ template class EST_TVector< TYPE >; #define Instantiate_TVector_T(TYPE,TAG) \ Instantiate_TVector_T_MIN(TYPE,TAG) #define Instantiate_TVector(TYPE) Instantiate_TVector_T(TYPE,TYPE) #define Declare_TVector_T(TYPE,TAG) \ static TYPE const TAG##_vec_def_val_s; \ static TYPE TAG##_vec_error_return_s; \ \ template <> TYPE const *EST_TVector< TYPE >::def_val=&TAG##_vec_def_val_s; \ template <> TYPE *EST_TVector< TYPE >::error_return=&TAG##_vec_error_return_s; #define Declare_TVector_Base_T(TYPE,DEFAULT,ERROR,TAG) \ static TYPE const TAG##_vec_def_val_s=DEFAULT; \ static TYPE TAG##_vec_error_return_s=ERROR; \ \ template <> TYPE const *EST_TVector::def_val=&TAG##_vec_def_val_s; \ template <> TYPE *EST_TVector::error_return=&TAG##_vec_error_return_s; #define Declare_TVector_Class_T(TYPE,DEFAULT,ERROR,TAG) \ static TYPE const TAG##_vec_def_val_s(DEFAULT); \ static TYPE TAG##_vec_error_return_s(ERROR); \ \ template <> TYPE const *EST_TVector::def_val=&TAG##_vec_def_val_s; \ template <> TYPE *EST_TVector::error_return=&TAG##_vec_error_return_s; #define Declare_TVector(TYPE) Declare_TVector_T(TYPE,TYPE) #define Declare_TVector_Base(TYPE,DEFAULT,ERROR) Declare_TVector_Base_T(TYPE,DEFAULT,ERROR,TYPE) #define Declare_TVector_Class(TYPE,DEFAULT,ERROR) Declare_TVector_Class_T(TYPE,DEFAULT,ERROR,TYPE) #endif speech_tools/include/instantiate/EST_TSimpleVectorI.h0000644000076400007640000000552107262616577021411 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TSIMPLEVECTOR_I_H__ #define __EST_TSIMPLEVECTOR_I_H__ /** Instantiate rules for simple-vector template. * * @author Richard Caley * @version $Id: EST_TSimpleVectorI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #define Instantiate_TSimpleVector(TYPE) \ template class EST_TSimpleVector; \ #define Declare_TSimpleVector_T(TYPE,TAG) #define Declare_TSimpleVector(TYPE) Declare_TSimpleVector_T(TYPE,TYPE) #endif speech_tools/include/instantiate/EST_TMatrixI.h0000644000076400007640000000615110457524614020227 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TMATRIX_I_H__ #define __EST_TMATRIX_I_H__ /** Instantiate rules for matrix template. * * @author Richard Caley * @version $Id: EST_TMatrixI.h,v 1.3 2006/07/19 21:52:12 awb Exp $ */ // Instantiation Macros #define Instantiate_TMatrix(TYPE) \ template class EST_TMatrix< TYPE >; #define Declare_TMatrix_T(TYPE,TAG) #define Declare_TMatrix_Base_T(TYPE,DEFAULT,ERROR,TAG) #define Declare_TMatrix_Class_T(TYPE,DEFAULT,ERROR,TAG) #define Declare_TMatrix(TYPE) Declare_TMatrix_T(TYPE,TYPE) #define Declare_TMatrix_Base(TYPE,DEFAULT,ERROR) Declare_TMatrix_Base_T(TYPE,DEFAULT,ERROR,TYPE) #define Declare_TMatrix_Class(TYPE,DEFAULT,ERROR) Declare_TMatrix_Class_T(TYPE,DEFAULT,ERROR,TYPE) #endif speech_tools/include/instantiate/EST_TSimpleMatrixI.h0000644000076400007640000000551707262616577021420 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TSIMPLEMATRIX_I_H__ #define __EST_TSIMPLEMATRIX_I_H__ /** Instantiate rules for simple-matrix template. * * @author Richard Caley * @version $Id: EST_TSimpleMatrixI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #define Instantiate_TSimpleMatrix(TYPE) \ template class EST_TSimpleMatrix; #define Declare_TSimpleMatrix_T(TYPE,TAG) #define Declare_TSimpleMatrix(TYPE) Declare_TSimpleMatrix_T(TYPE,TYPE) #endif speech_tools/include/instantiate/EST_TListI.h0000644000076400007640000001036010457524614017673 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TLIST_I_H__ #define __EST_TLIST_I_H__ /** Instantiate rules for list template. * * @author Richard Caley * @version $Id: EST_TListI.h,v 1.5 2006/07/19 21:52:12 awb Exp $ */ // Instantiation Macros #include using namespace std; #include "instantiate/EST_TIteratorI.h" #define Instantiate_TList_T_MIN(TYPE, TAG) \ template class EST_TList< TLIST_ ## TAG ## _VAL >; \ template class EST_TItem< TLIST_ ## TAG ## _VAL >; \ template const char *error_name(EST_TList< TYPE > val); \ Instantiate_TIterator_T( EST_TList, EST_TList::IPointer, TYPE, TList_ ## TAG ## _itt); #define Instantiate_TList_T(TYPE, TAG) \ Instantiate_TList_T_MIN(TYPE, TAG) #define Instantiate_TList(TYPE) Instantiate_TList_T(TYPE, TYPE) #define Declare_TList_TN(TYPE,MaxFree,TAG) \ typedef TYPE TLIST_ ## TAG ## _VAL; \ template <> EST_TItem< TYPE > * EST_TItem< TYPE >::s_free=NULL; \ template <> unsigned int EST_TItem< TYPE >::s_maxFree=MaxFree; \ template <> unsigned int EST_TItem< TYPE >::s_nfree=0; #define Declare_TList_T(TYPE,TAG) \ Declare_TList_TN(TYPE,0,TAG) #define Declare_TList_Base_TN(TYPE,MaxFree,TAG) \ Declare_TList_TN(TYPE,MaxFree,TAG) #define Declare_TList_Base_T(TYPE,TAG) \ Declare_TList_Base_TN(TYPE,0,TAG) \ #define Declare_TList_Class_TN(TYPE,MaxFree,TAG) \ Declare_TList_TN(TYPE,MaxFree,TAG) #define Declare_TList_Class_T(TYPE,TAG) \ Declare_TList_Class_TN(TYPE,0,TAG) \ #define Declare_TList_N(TYPE,MaxFree) Declare_TList_TN(TYPE,MaxFree,TYPE) #define Declare_TList_Base_N(TYPE,MaxFree) Declare_TList_Base_TN(TYPE,MaxFree,TYPE) #define Declare_TList_Class_N(TYPE,MaxFree) Declare_TList_Class_TN(TYPE,MaxFree,TYPE) #define Declare_TList(TYPE) Declare_TList_N(TYPE,0) #define Declare_TList_Base(TYPE) Declare_TList_Base_N(TYPE,0) #define Declare_TList_Class(TYPE) Declare_TList_Class_N(TYPE,0) #endif speech_tools/include/instantiate/EST_TSortableI.h0000644000076400007640000000735507262616577020557 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TSORTABLE_I_H__ #define __EST_TSORTABLE_I_H__ /** Instantiate rules for sortable template. * * @author Richard Caley * @version $Id: EST_TSortableI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ // Instantiation Macros #define Instantiate_TSortable_T(TYPE, TAG) \ template class EST_TSortable; \ template class EST_TSortable; \ \ template void sort(EST_TList &, bool (*gt)(const EST_UItem *, const EST_UItem *)); \ template void qsort(EST_TList &, bool (*gt)(const EST_UItem *, const EST_UItem *)); \ template void ptr_sort(EST_TList &a); \ template void ptr_qsort(EST_TList &a); \ template void sort_unique(EST_TList &a); \ template void merge_sort_unique(EST_TList &l, EST_TList &m); \ \ template bool operator==(const EST_TList &a, const EST_TList &b); #define Instantiate_TSortable(TYPE) Instantiate_TSortable_T(TYPE, TYPE) #define Declare_TSortable_T(TYPE,TAG) #define Declare_TSortable_Base_T(TYPE,DEFAULT,ERROR,TAG) #define Declare_TSortable_Class_T(TYPE,DEFAULT,ERROR,TAG) #define Declare_TSortable(TYPE) Declare_TSortable_T(TYPE,TYPE) #define Declare_TSortable_Base(TYPE,DEFAULT,ERROR) Declare_TSortable_Base_T(TYPE,DEFAULT,ERROR,TYPE) #define Declare_TSortable_Class(TYPE,DEFAULT,ERROR) Declare_TSortable_Class_T(TYPE,DEFAULT,ERROR,TYPE) #endif speech_tools/include/instantiate/EST_TKVLI.h0000644000076400007640000001315110457524614017415 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_KVL_I_H__ #define __EST_KVL_I_H__ /** Instantiate rules for list template. * * @author Richard Caley * @version $Id: EST_TKVLI.h,v 1.4 2006/07/19 21:52:12 awb Exp $ */ #include "instantiate/EST_TListI.h" #include "instantiate/EST_TIteratorI.h" // Instantiation Macros // the typedef is purely to get the type name through the following macro. #define Instantiate_KVL_T(KEY, VAL, TAG) \ template class EST_TKVL; \ template class EST_TKVI; \ Instantiate_TIterator_T(KVL_ ## TAG ## _t, KVL_ ## TAG ## _t::IPointer_k, KEY, KVL_ ## TAG ##_kitt) \ Instantiate_TStructIterator_T(KVL_ ## TAG ## _t, KVL_ ## TAG ## _t::IPointer, KVI_ ## TAG ## _t, KVL_ ## TAG ##_itt) \ Instantiate_TIterator_T(KVL_ ## TAG ## _t, KVL_ ## TAG ## _t::IPointer, KVI_ ## TAG ## _t, KVL_ ## TAG ##_itt) \ Instantiate_TList(KVI_ ## TAG ## _t) // template ostream & operator<<(ostream &s, EST_TKVI const &i); #define Instantiate_KVL(KEY, VAL) \ Instantiate_KVL_T(KEY, VAL, KEY ## VAL) #define Declare_KVL_TN(KEY, VAL, MaxFree, TAG) \ typedef EST_TKVI KVI_ ## TAG ## _t; \ typedef EST_TKVL KVL_ ## TAG ## _t; \ \ static VAL TAG##_kv_def_val_s; \ static KEY TAG##_kv_def_key_s; \ \ template <> VAL *EST_TKVL< KEY, VAL >::default_val=&TAG##_kv_def_val_s; \ template <> KEY *EST_TKVL< KEY, VAL >::default_key=&TAG##_kv_def_key_s; \ \ Declare_TList_N(KVI_ ## TAG ## _t, MaxFree) #define Declare_KVL_T(KEY, VAL, TAG) \ Declare_KVL_TN(KEY, VAL, 0, TAG) #define Declare_KVL_Base_TN(KEY, VAL, DEFV, DEFK, MaxFree, TAG) \ typedef EST_TKVI KVI_ ## TAG ## _t; \ typedef EST_TKVL KVL_ ## TAG ## _t; \ \ static VAL TAG##_kv_def_val_s=DEFV; \ static KEY TAG##_kv_def_key_s=DEFK; \ \ template <> VAL *EST_TKVL< KEY, VAL >::default_val=&TAG##_kv_def_val_s; \ template <> KEY *EST_TKVL< KEY, VAL >::default_key=&TAG##_kv_def_key_s; \ \ Declare_TList_N(KVI_ ## TAG ## _t, MaxFree) #define Declare_KVL_Base_T(KEY, VAL, DEFV, DEFK, TAG) \ Declare_KVL_Base_TN(KEY, VAL, DEFV, DEFK, 0, TAG) #define Declare_KVL_Class_TN(KEY, VAL, DEFV, DEFK, MaxFree, TAG) \ typedef EST_TKVI KVI_ ## TAG ## _t; \ typedef EST_TKVL KVL_ ## TAG ## _t; \ \ static VAL TAG##_kv_def_val_s(DEFV); \ static KEY TAG##_kv_def_key_s(DEFK); \ \ template <> VAL *EST_TKVL< KEY, VAL >::default_val=&TAG##_kv_def_val_s; \ template <> KEY *EST_TKVL< KEY, VAL >::default_key=&TAG##_kv_def_key_s; \ \ Declare_TList_N(KVI_ ## TAG ## _t, MaxFree) #define Declare_KVL_Class_T(KEY, VAL, DEFV, DEFK,TAG) \ Declare_KVL_Class_TN(KEY, VAL, DEFV, DEFK, 0, TAG) #define Declare_KVL_N(KEY, VAL, MaxFree) \ Declare_KVL_TN(KEY, VAL, MaxFree, KEY ## VAL) #define Declare_KVL(KEY, VAL) \ Declare_KVL_N(KEY, VAL, 0) #define Declare_KVL_Base_N(KEY, VAL, DEFV, DEFK, MaxFree) \ Declare_KVL_Base_TN(KEY, VAL, DEFV, DEFK, , MaxFree, KEY ## VAL) #define Declare_KVL_Base(KEY, VAL, DEFV, DEFK) \ Declare_KVL_Base_N(KEY, VAL, DEFV, DEFK, 0) #define Declare_KVL_Class_N(KEY, VAL, DEFV, DEFK, MaxFree) \ Declare_KVL_Class_TN(KEY, VAL, DEFV, DEFK, MaxFree, KEY ## VAL) #define Declare_KVL_Class(KEY, VAL, DEFV, DEFK) \ Declare_KVL_Class_N(KEY, VAL, DEFV, DEFK, 0) #endif speech_tools/include/instantiate/EST_THashI.h0000644000076400007640000001163410045556421017642 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_THASH_I_H__ #define __EST_THASH_I_H__ #include "EST_system.h" #include "instantiate/EST_TIteratorI.h" /** Instantiate rules for hash template. * * @author Richard Caley * @version $Id: EST_THashI.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ // Instantiation Macros #define Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IP, IPK) \ typedef EST_THash< KEY, VAL > HASH_ ## TAG ## _t; \ typedef EST_Hash_Pair< KEY, VAL > HASHPAIR_ ## TAG ## _t; \ Instantiate_TStructIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IP, HASHPAIR_ ## TAG ## _t, HASH_ ## TAG ## _itt) \ Instantiate_TIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IP, HASHPAIR_ ## TAG ## _t, HASH_ ## TAG ## _itt) \ Instantiate_TIterator_T(HASH_ ## TAG ## _t, HASH_ ## TAG ## _t:: IPK, KEY, HASH_ ## TAG ## _itt) #if defined(VISUAL_CPP) # define Instantiate_THash_T_IT(KEY, VAL, TAG) \ Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IPointer_s, IPointer_k_s) #else # define Instantiate_THash_T_IT(KEY, VAL, TAG) \ Instantiate_THash_T_IT_IP(KEY, VAL, TAG, IPointer, IPointer_k) #endif #define Instantiate_THash_T_MIN(KEY, VAL, TAG) \ template class EST_Hash_Pair< KEY, VAL >; \ template class EST_THash< KEY, VAL >; #define Instantiate_THash_T(KEY, VAL, TAG) \ Instantiate_THash_T_MIN(KEY, VAL, TAG) \ Instantiate_THash_T_IT(KEY, VAL, TAG) #define Instantiate_THash(KEY, VAL) Instantiate_THash_T(KEY, VAL, KEY ## VAL) #define Instantiate_THash_MIN(KEY, VAL) Instantiate_THash_T_MIN(KEY, VAL, KEY ## VAL) #define Instantiate_THash_IT(KEY, VAL, IP) \ Instantiate_THash_T_IT(KEY, VAL, KEY ## VAL, IP) /* disabled. it's INVALID !!! #define Declare_THash_T(KEY, VAL, TAG) \ VAL EST_THash< KEY, VAL >::Dummy_Value; \ KEY EST_THash< KEY, VAL >::Dummy_Key; \ EST_THash< KEY, VAL > TAG ## _hash_dummy(0); */ #define Declare_THash_Base_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR,TAG) \ template <> KEY EST_THash< KEY, VAL >::Dummy_Key=DEFAULTK; \ template <> VAL EST_THash::Dummy_Value=DEFAULT; #define Declare_THash_Class_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR,TAG) \ template <> KEY EST_THash< KEY, VAL >::Dummy_Key(DEFAULTK); \ template <> VAL EST_THash::Dummy_Value(DEFAULT); #define Declare_THash(KEY, VAL) Declare_THash_T(KEY, VAL, KEY ## VAL) #define Declare_THash_Base(KEY, VAL, DEFAULTK, DEFAULT, ERROR) \ Declare_THash_Base_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR, KEY ## VAL) #define Declare_THash_Class(KEY, VAL, DEFAULTK, DEFAULT, ERROR) \ Declare_THash_Class_T(KEY, VAL, DEFAULTK, DEFAULT, ERROR, KEY ## VAL) #endif speech_tools/include/instantiate/EST_TStringHashI.h0000644000076400007640000000763207262616577021054 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TSTRINGHASH_I_H__ #define __EST_TSTRINGHASH_I_H__ /** Instantiate rules for hash template. * * @author Richard Caley * @version $Id: EST_TStringHashI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ // Instantiation Macros #define Instantiate_TStringHash_T_IT(VAL, TAG, IP) \ Instantiate_THash_T_IT(EST_String, VAL, TAG, IP) #define Instantiate_TStringHash_T_MIN(VAL, TAG) \ template class EST_TStringHash< VAL >; \ Instantiate_THash_T_MIN(EST_String,VAL,TAG) #define Instantiate_TStringHash_T(VAL, TAG) \ template class EST_TStringHash< VAL >; \ Instantiate_THash_T(EST_String,VAL,TAG) #define Instantiate_TStringHash(VAL) Instantiate_TStringHash_T(VAL, KEY ## VAL) #define Instantiate_TStringHash_MIN(VAL) Instantiate_TStringHash_T_MIN(VAL, KEY ## VAL) #define Instantiate_TStringHash_IT(VAL, IP) Instantiate_TStringHash_T_IT(VAL, KEY ## VAL, IP) #define Declare_TStringHash_T(VAL, TAG) \ Declare_THash_T(EST_String, VAL, TAG) #define Declare_TStringHash_Base_T(VAL, DEFAULT, ERROR,TAG) \ Declare_THash_Base_T(EST_String, VAL, "DUMMY", DEFAULT, ERROR,TAG) #define Declare_TStringHash_Class_T(VAL, DEFAULT, ERROR,TAG) \ Declare_THash_Class_T(EST_String, VAL, "DUMMY", DEFAULT, ERROR,TAG) #define Declare_TStringHash(VAL) Declare_TStringHash_T(VAL, VAL) #define Declare_TStringHash_Base(VAL, DEFAULT, ERROR) \ Declare_TStringHash_Base_T(VAL, DEFAULT, ERROR, VAL) #define Declare_TStringHash_Class(VAL, DEFAULT, ERROR) \ Declare_TStringHash_Class_T(VAL, DEFAULT, ERROR, VAL) #endif speech_tools/include/instantiate/EST_TNamedEnumI.h0000644000076400007640000001446207262616577020652 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TNamedEnum_I_H__ #define __EST_TNamedEnum_I_H__ /** Instantiate rules for named enum template. * * @author Richard Caley * @version $Id: EST_TNamedEnumI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ // Instantiation Macros #define Instantiate_TValuedEnumI_T(ENUM, VAL, INFO, TAG) \ template class EST_TValuedEnumI< ENUM, VAL, INFO >; \ #define Instantiate_TValuedEnum_T(ENUM, VAL, TAG) \ Instantiate_TValuedEnumI_T(ENUM, VAL, NO_INFO, TAG) #define Instantiate_TNamedEnumI_T(ENUM, INFO, TAG) \ template class EST_TNamedEnumI< ENUM, INFO >; \ Instantiate_TValuedEnumI_T(ENUM, const char *, INFO, TAG) #define Instantiate_TNamedEnum_T(ENUM, TAG) \ Instantiate_TValuedEnumI_T(ENUM, const char *, NO_INFO, TAG) \ template class EST_TNamedEnum< ENUM >; \ template class EST_TNamedEnumI< ENUM, NO_INFO >; #define Instantiate_TValuedEnumI(ENUM, VAL, INFO) \ Instantiate_TValuedEnumI_T(ENUM, VAL, INFO, ENUM ## VAL ## INFO ) #define Instantiate_TValuedEnum(ENUM, VAL) \ template class EST_TValuedEnum< ENUM, VAL >; \ Instantiate_TValuedEnum_T(ENUM, VAL, ENUM ## VAL) #define Instantiate_TNamedEnumI(ENUM, INFO) \ Instantiate_TNamedEnumI_T(ENUM, INFO, ENUM ## INFO) #define Instantiate_TNamedEnum(ENUM) \ Instantiate_TNamedEnum_T(ENUM, ENUM) \ // declaration macros. NULL at the moment. #define Declare_TValuedEnumI_T(ENUM, VAL, INFO, TAG) \ /* EMPTY */ #define Declare_TValuedEnum_T(ENUM, VAL, TAG) \ Declare_TValuedEnumI_T(ENUM, VAL, NO_INFO, TAG) #define Declare_TNamedEnumI_T(ENUM, INFO, TAG) \ Declare_TValuedEnumI_T(ENUM, const char *, INFO, TAG) #define Declare_TNamedEnum_T(ENUM, TAG) \ Declare_TNamedEnumI_T(ENUM, NO_INFO, TAG) #define Declare_TValuedEnumI(ENUM, VAL, INFO) \ Declare_TValuedEnumI_T(ENUM, VAL, INFO, ENUM ## VAL ## INFO ) #define Declare_TValuedEnum(ENUM, VAL) \ Declare_TValuedEnum_T(ENUM, VAL, ENUM ## VAL) #define Declare_TNamedEnumI(ENUM, INFO) \ Declare_TNamedEnumI_T(ENUM, INFO, ENUM ## INFO) #define Declare_TNamedEnum(ENUM) \ Declare_TNamedEnum_T(ENUM, ENUM) // Actual table declaration macros #define Create_TValuedEnumDefinition(ENUM, VAL, INFO, TAG) \ static EST_TValuedEnumDefinition< ENUM, VAL, INFO> TAG ## _names[] #define Create_TNamedEnumDefinition(ENUM, INFO, TAG) \ Create_TValuedEnumDefinition(ENUM, const char *, INFO, TAG) #define Start_TValuedEnumI_T(ENUM, VAL, INFO, NAME, TAG) \ Create_TValuedEnumDefinition(ENUM, VAL, INFO, TAG) = { #define End_TValuedEnumI_T(ENUM, VAL, INFO, NAME, TAG) \ }; \ EST_TValuedEnumI< ENUM, VAL, INFO > NAME (TAG ## _names); #define Start_TNamedEnumI_T(ENUM, INFO, NAME, TAG) \ Create_TValuedEnumDefinition(ENUM, const char *, INFO, TAG) = { #define End_TNamedEnumI_T(ENUM, INFO, NAME, TAG) \ }; \ EST_TNamedEnumI< ENUM, INFO > NAME (TAG ## _names); #define Start_TValuedEnumI(ENUM, VAL, INFO, NAME) \ Start_TValuedEnumI_T(ENUM, VAL, INFO, NAME, NAME) #define End_TValuedEnumI(ENUM, VAL, INFO, NAME) \ End_TValuedEnumI_T(ENUM, VAL, INFO, NAME, NAME) #define Start_TNamedEnumI(ENUM, INFO, NAME) \ Start_TNamedEnumI_T(ENUM, INFO, NAME, NAME) #define End_TNamedEnumI(ENUM, INFO, NAME) \ End_TNamedEnumI_T(ENUM, INFO, NAME, NAME) #define Start_TValuedEnum_T(ENUM, VAL, NAME, TAG) \ Create_TValuedEnumDefinition(ENUM, VAL, NO_INFO, TAG) = { #define End_TValuedEnum_T(ENUM, VAL, NAME, TAG) \ }; \ EST_TValuedEnum< ENUM, VAL > NAME (TAG ## _names); #define Start_TNamedEnum_T(ENUM, NAME, TAG) \ Create_TValuedEnumDefinition(ENUM, const char *, NO_INFO, TAG) = { #define End_TNamedEnum_T(ENUM, NAME, TAG) \ }; \ EST_TNamedEnum< ENUM > NAME (TAG ## _names); #define Start_TValuedEnum(ENUM, VAL, NAME) \ Start_TValuedEnum_T(ENUM, VAL, NAME, NAME) #define End_TValuedEnum(ENUM, VAL, NAME) \ End_TValuedEnum_T(ENUM, VAL, NAME, NAME) #define Start_TNamedEnum(ENUM, NAME) \ Start_TNamedEnum_T(ENUM, NAME, NAME) #define End_TNamedEnum(ENUM, NAME) \ End_TNamedEnum_T(ENUM, NAME, NAME) #endif speech_tools/include/instantiate/EST_TDequeI.h0000644000076400007640000000663110457524614020031 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TDEQ_I_H__ #define __EST_TDEQ_I_H__ /** Instantiate rules for list template. * * @author Richard Caley * @version $Id: EST_TDequeI.h,v 1.4 2006/07/19 21:52:12 awb Exp $ */ // Instantiation Macros // the typedef is purely to get the type name through the following macro. #define Instantiate_TDEQ_T(T, TAG) \ template class EST_TDeque; #define Instantiate_TDEQ(T) Instantiate_TDEQ_T(T, T) #define Declare_TDEQ_T(T, TAG) \ template <> const T *EST_TDeque< T >::Filler=NULL; #define Declare_TDEQ_Base_T(T, FILLER ,TAG) \ const T TAG ## _deq_filler=FILLER; \ template <> const T *EST_TDeque< T >::Filler=& TAG ## _deq_filler; #define Declare_TDEQ_Class_T(T, FILLER,TAG) \ const T TAG ## _deq_filler(FILLER); \ template <> const T *EST_TDeque< T >::Filler=& TAG ## _deq_filler; #define Declare_TDEQ(T) Declare_TDEQ_T(T, T) #define Declare_TDEQ_Base(T, FILLER) Declare_TDEQ_Base_T(T, FILLER, T) #define Declare_TDEQ_Class(T, FILLER) Declare_TDEQ_Class_T(T, FILLER, T) #endif speech_tools/include/instantiate/EST_TIteratorI.h0000644000076400007640000000613207262616577020565 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_TITERATORI_H__ #define __EST_TITERATORI_H__ /** Instantiate an iterator. * * @author Richard Caley * @version $Id: EST_TIteratorI.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #define Instantiate_TIterator_T(CONTAINER, IP, ENTRY, TAG) \ template class EST_TIterator; \ template class EST_TRwIterator; #define Declare_TIterator_T(CONTAINER, IP, ENTRY, TAG)\ /* EMPTY */ #define Instantiate_TStructIterator_T(CONTAINER, IP, ENTRY, TAG) \ template class EST_TStructIterator; \ template class EST_TRwStructIterator; #define Declare_TIterator_T(CONTAINER, IP, ENTRY, TAG)\ /* EMPTY */ #endif speech_tools/include/rxp/Makefile0000644000076400007640000000624607262605664015602 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Include files from the RXP package. ## ## ## ########################################################################### TOP=../.. DIRNAME=include/rxp H = XML_Parser.h rxp.h \ charset.h dtd.h stdio16.h system.h xmlparser.h \ ctype16.h input.h string16.h url.h FILES = Makefile $(H) INSTALL = install_incs include $(TOP)/config/common_make_rules install_incs: mkdir -p $(INCDIR)/EST/rxp cp -p *.h $(INCDIR)/EST/rxp speech_tools/include/rxp/XML_Parser.h0000644000076400007640000002225110045556421016246 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __XML_PARSER_H__ #define __XML_PARSER_H__ #if !defined(CHAR_SIZE) # define CHAR_SIZE 8 #endif #if (CHAR_SIZE!=8) # error EST can only handle 8 bit characters #endif #include "EST_String.h" #include "EST_Regex.h" #include "EST_TKVL.h" #include "EST_THash.h" #include "EST_TDeque.h" #include "EST_TList.h" #include "rxp/rxp.h" // We only use types and functions from rxp.h, so we can throw away // some of the macros which cause problems. #undef get /**@name XML Parser * Recursive descent parsing skeleton with hooks for processing. * A C++ wrapper around the rxp parser. * * @author Richard Caley * @version $Id: XML_Parser.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ //@{ class XML_Parser; class XML_Parser_Class; /// Nice name for list of attribute-value pairs. typedef EST_TStringHash XML_Attribute_List; /** A Class of parsers, All parsers share callbacks and a * list of known public IDs. */ class XML_Parser_Class { private: /** Map PUBLIC and SYSTEM IDs to places on the local system. */ EST_TKVL known_ids; protected: /** Do any necessary remappings and open a stream which reads the given * entity. */ static InputSource open_entity(Entity ent, void *arg); /**@name The callbacks. * * These methods can be overridden in a subclass to create a class * of parsers to do whatever you want. */ //@{ /** Called when starting a document. */ virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); /** Called at the end of a document. */ virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); /** Called when an element starts. */ virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); /** Called when an element ends. */ virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); /** Called for empty elements. * * Defaults to element_open(...) followed by element_closed(...). */ virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); /** Called for parsed character data sequences. */ virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); /** Called for unparsed character data sequences. */ virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); /** Called for processing directives. */ virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); /** Called when there is an error in parsing. */ virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); //@} /** This can be called from any of the callbacks to present "message" * as an error through the error callback, thus getting filename and * line information into the message. */ void error(XML_Parser_Class &c, XML_Parser &p, void *data, EST_String message); /// Get the error message for the last error. const char *get_error(XML_Parser &p); public: /** Create an object representing the class of parsers. */ XML_Parser_Class(); virtual ~XML_Parser_Class() { } /** Add a mapping from entity ID (SYSTEM or PUBLIC) to filename. * * The string can contain escapes like \2 which are replaced by * the text matching the Nth bracketed part of the regular expression. */ void register_id(EST_Regex id_pattern, EST_String directory); /** Fill in the list with the known entity ID mappings. */ void registered_ids(EST_TList &list); /**@name Creating a parser * * Each of these methods creates a one-shot parser which will run over the * indicated text. */ //@{ /// Create a parser for the RXP InputSource. XML_Parser *make_parser(InputSource source, void *data); /// Create a parser for the RXP InputSource. XML_Parser *make_parser(InputSource source, Entity initial_entity, void *data); /// Create a parser for a stdio input stream. XML_Parser *make_parser(FILE *input, void *data); /** Create a parser for a stdio input stream, giving a description for * use in errors. */ XML_Parser *make_parser(FILE *input, const EST_String desc, void *data); // Create a parser for the named file. XML_Parser *make_parser(const EST_String filename, void *data); //@} /** Utility which tries to open an entity called ID at places * specified in the mapping of this parser class. */ InputSource try_and_open(Entity ent); /** XML_Parser defines the behaviour of an individual one-shot * parser. */ friend class XML_Parser; }; /** An actual parser. Each such instance parses just one stream which is * given when the parser is created. * * The behaviour of the parser is given by the class to which it belongs. */ class XML_Parser { private: /// Last error message from the parser. EST_String p_error_message; /// Set true when context is being remembered. bool p_track_context; /// Set true when contents is being remembered. (not yet implemented) bool p_track_contents; protected: /** The class to which this parser belongs. Defines the behaviour of * the parser. */ XML_Parser_Class *pclass; /// The piece of markup being processed. XBit current_bit; /// Where we are reading from. InputSource source; /** The entity we started from. May need to be freed at the end of the * parse. */ Entity initial_entity; /// Arbitrary data which can be used by callbacks. void *data; /// The RXP parser object. Parser p; /// If context is being tracked, this is a stack of element names. EST_TDeque p_context; /// Creator used by XML_Parser_Class::make_parser() XML_Parser(XML_Parser_Class &parent, InputSource source, Entity initial_entity, void *data); /// Open. Asks the parser class to do the work. InputSource open(Entity ent); /// Get the error message for the last error. const char *get_error(); public: /// Destructor, may close input if required. ~XML_Parser(); /** Request that parser keep track of the currently open elements. * * These are recorded on a atsck. Use context() to access the information. */ void track_context(bool flag); /** Keep track of the content of open elements. * * Not yet implemented. */ void track_contents(bool flag); /** Get the name of the nth enclosing element. * * context(0) is the element we are directly inside. */ EST_String context(int n); /// Run the parser. void go(); friend class XML_Parser_Class; }; //@} #endif speech_tools/include/rxp/rxp.h0000644000076400007640000000236507262605664015122 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #if defined(__cplusplus) extern "C" { #endif #include "charset.h" #include "string16.h" #include "dtd.h" #include "input.h" #include "xmlparser.h" #include "stdio16.h" #if defined(__cplusplus) } #endif speech_tools/include/rxp/charset.h0000644000076400007640000000554607262605664015746 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef CHARSET_H #define CHARSET_H #ifndef FOR_LT #define STD_API #endif STD_API void init_charset(void); /* * We'd like char8 to be unsigned char, but it causes too many problems. * For example: * char8 name; ...; return name ? name : "" * produces a warning with many compilers if char8 is unsigned. */ typedef char char8; typedef unsigned short char16; typedef unsigned int char32; #if !defined(CHAR_SIZE) # error CHAR_SIZE not defined #endif #if CHAR_SIZE == 8 typedef char8 Char; #elif CHAR_SIZE == 16 typedef char16 Char; #else #error CHAR_SIZE must be 8 or 16 #endif /* Character encodings */ enum character_encoding { CE_unknown, CE_unspecified_ascii_superset, CE_UTF_8, CE_ISO_646, CE_ISO_8859_1, CE_ISO_8859_2, CE_ISO_8859_3, CE_ISO_8859_4, CE_ISO_8859_5, CE_ISO_8859_6, CE_ISO_8859_7, CE_ISO_8859_8, CE_ISO_8859_9, CE_UTF_16B, CE_UTF_16L, CE_ISO_10646_UCS_2B, CE_ISO_10646_UCS_2L, CE_enum_count }; typedef enum character_encoding CharacterEncoding; extern STD_API CharacterEncoding InternalCharacterEncoding; extern STD_API const char8 *CharacterEncodingName[CE_enum_count]; extern STD_API const char8 *CharacterEncodingNameAndByteOrder[CE_enum_count]; struct character_encoding_alias {const char8 *name; CharacterEncoding enc;}; extern STD_API struct character_encoding_alias CharacterEncodingAlias[]; extern STD_API const int CE_alias_count; STD_API int EncodingIsAsciiSuperset(CharacterEncoding enc); STD_API int EncodingsCompatible(CharacterEncoding enc1, CharacterEncoding enc2, CharacterEncoding *enc3); STD_API CharacterEncoding FindEncoding(char8 *name); /* Translation tables for Latin-N - do this right sometime! XXX */ extern STD_API int iso_to_unicode[8][256]; extern STD_API int iso_max_val[8]; extern STD_API char8 *unicode_to_iso[8]; #endif /* CHARSET_H */ speech_tools/include/rxp/dtd.h0000644000076400007640000002220707262616577015066 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef DTD_H #define DTD_H #ifndef FOR_LT #define XML_API #endif #include "charset.h" /* Typedefs */ typedef struct dtd *Dtd; typedef struct entity *Entity; typedef struct element_definition *ElementDefinition; typedef struct attribute_definition *AttributeDefinition; AttributeDefinition NextAttributeDefinition(ElementDefinition element, AttributeDefinition previous); typedef struct notation_definition *NotationDefinition; /* DTDs */ struct dtd { const Char *name; /* The doctype name */ Entity internal_part, external_part; Entity entities; Entity parameter_entities; Entity predefined_entities; #ifdef FOR_LT NSL_Doctype_I *doctype; #else ElementDefinition elements; #endif NotationDefinition notations; }; /* Entities */ enum entity_type {ET_external, ET_internal}; typedef enum entity_type EntityType; enum markup_language {ML_xml, ML_nsl, ML_unspecified}; typedef enum markup_language MarkupLanguage; enum standalone_declaration { /* NB must match NSL's rmdCode */ SDD_unspecified, SDD_no, SDD_yes, SDD_enum_count }; typedef enum standalone_declaration StandaloneDeclaration; extern const char8 *StandaloneDeclarationName[SDD_enum_count]; struct entity { /* All entities */ const Char *name; /* The name in the entity declaration */ EntityType type; /* ET_external or ET_internal */ const char8 *base_url; /* If different from expected */ struct entity *next; /* For chaining a document's entity defns */ CharacterEncoding encoding; /* The character encoding of the entity */ Entity parent; /* The entity in which it is defined */ const char8 *url; /* URL of entity */ /* Internal entities */ const Char *text; /* Text of the entity */ int line_offset; /* Line offset of definition */ int line1_char_offset; /* Char offset on first line */ int matches_parent_text; /* False if might contain expanded PEs */ /* External entities */ const char8 *systemid; /* Declared public ID */ const char8 *publicid; /* Declared public ID */ NotationDefinition notation; /* Binary entity's declared notation */ MarkupLanguage ml_decl; /* XML, NSL or not specified */ const char8 *version_decl; /* XML declarations found in entity, if any */ CharacterEncoding encoding_decl; StandaloneDeclaration standalone_decl; const char8 *ddb_filename; /* filename in NSL declaration */ }; /* Elements */ enum content_type { /* NB this must match NSL's ctVals */ CT_mixed, CT_any, CT_bogus1, CT_bogus2, CT_empty, CT_element, CT_enum_count }; typedef enum content_type ContentType; extern XML_API const char8 *ContentTypeName[CT_enum_count]; struct element_definition { const Char *name; /* The element name */ int namelen; int tentative; #ifdef FOR_LT NSL_Doctype_I *doctype; NSL_ElementSummary_I *elsum; #else ContentType type; /* The declared content */ Char *content; /* Element content */ AttributeDefinition attributes; struct element_definition *next; #endif }; /* Attributes */ enum default_type { /* NB this must match NSL's NSL_ADefType */ DT_required, DT_bogus1, DT_implied, DT_bogus2, DT_none, DT_fixed, DT_enum_count }; typedef enum default_type DefaultType; extern XML_API const char8 *DefaultTypeName[DT_enum_count]; enum attribute_type { /* NB this must match NSL's NSL_Attr_Dec_Value */ AT_cdata, AT_bogus1, AT_bogus2, AT_nmtoken, AT_bogus3, AT_entity, AT_idref, AT_bogus4, AT_bogus5, AT_nmtokens, AT_bogus6, AT_entities, AT_idrefs, AT_id, AT_notation, AT_enumeration, AT_enum_count }; typedef enum attribute_type AttributeType; extern XML_API const char8 *AttributeTypeName[AT_enum_count]; struct attribute_definition { #ifdef FOR_LT /* NB this must match NSL's AttributeSummary */ /* We never really have one of these structures; only an AttributeSummary cast to this type. We need to be able to access the type, so that we can normalise if appropriate. We need to be able to refer to the default_type and default_value, but these don't need to work since we will never have ReturnDefaultedAttributes true in NSL. */ int a, b, c; short d; char type, default_type; /* This had better never be accessed! */ Char *default_value; #else const Char *name; /* The attribute name */ int namelen; AttributeType type; /* The declared type */ Char **allowed_values; /* List of allowed values, argv style */ DefaultType default_type; /* The type of the declared default */ const Char *default_value; /* The declared default value */ struct attribute_definition *next; #endif }; /* Notations */ struct notation_definition { const Char *name; /* The notation name */ int tentative; const char8 *systemid; /* System identifier */ const char8 *publicid; /* Public identifier */ struct notation_definition *next; }; /* Public functions */ XML_API Dtd NewDtd(void); XML_API void FreeDtd(Dtd dtd); XML_API Entity NewExternalEntityN(const Char *name, int namelen, const char8 *publicid, const char8 *systemid, NotationDefinition notation, Entity parent); XML_API Entity NewInternalEntityN(const Char *name, int namelen, const Char *text, Entity parent, int line_offset, int line1_char_offset, int matches_parent_text); XML_API void FreeEntity(Entity e); XML_API const char8 *EntityURL(Entity e); XML_API const char8 *EntityDescription(Entity e); XML_API void EntitySetBaseURL(Entity e, const char8 *url); XML_API const char8 *EntityBaseURL(Entity e); XML_API Entity DefineEntity(Dtd dtd, Entity entity, int pe); XML_API Entity FindEntityN(Dtd dtd, const Char *name, int namelen, int pe); #define NewExternalEntity(name, pub, sys, nnot, parent) \ NewExternalEntityN(name, name ? Strlen(name) : 0, pub, sys, nnot, parent) #define NewInternalEntity(name, test, parent, l, l1, mat) \ NewInternalEntityN(name, name ? Strlen(name) : 0, test, parent, l, l1, mat) #define FindEntity(dtd, name, pe) FindEntityN(dtd, name, Strlen(name), pe) XML_API ElementDefinition DefineElementN(Dtd dtd, const Char *name, int namelen, ContentType type, Char *content); XML_API ElementDefinition TentativelyDefineElementN(Dtd dtd, const Char *name, int namelen); XML_API ElementDefinition RedefineElement(ElementDefinition e, ContentType type, Char *content); XML_API ElementDefinition FindElementN(Dtd dtd, const Char *name, int namelen); XML_API void FreeElementDefinition(ElementDefinition e); #define DefineElement(dtd, name, type, content) \ DefineElementN(dtd, name, Strlen(name), type, content) #define TentativelyDefineElement(dtd, name) \ TentativelyDefineElementN(dtd, name, Strlen(name)) #define FindElement(dtd, name) FindElementN(dtd, name, Strlen(name)) XML_API AttributeDefinition DefineAttributeN(ElementDefinition element, const Char *name, int namelen, AttributeType type, Char **allowed_values, DefaultType default_type, const Char *default_value); XML_API AttributeDefinition FindAttributeN(ElementDefinition element, const Char *name, int namelen); XML_API void FreeAttributeDefinition(AttributeDefinition a); #define DefineAttribute(element, name, type, all, dt, dv) \ DefineAttributeN(element, name, Strlen(name), type, all, dt, dv) #define FindAttribute(element, name) \ FindAttributeN(element, name, Strlen(name)) XML_API NotationDefinition DefineNotationN(Dtd dtd, const Char *name, int namelen, const char8 *publicid, const char8 *systemid); XML_API NotationDefinition TentativelyDefineNotationN(Dtd dtd, const Char *name, int namelen); XML_API NotationDefinition RedefineNotation(NotationDefinition n, const char8 *publicid, const char8 *systemid); XML_API NotationDefinition FindNotationN(Dtd dtd, const Char *name, int namelen); XML_API void FreeNotationDefinition(NotationDefinition n); #define DefineNotation(dtd, name, pub, sys) \ DefineNotationN(dtd, name, Strlen(name), pub, sys) #define TentativelyDefineNotation(dtd, name) \ TentativelyDefineNotationN(dtd, name, Strlen(name)) #define FindNotation(dtd, name) FindNotationN(dtd, name, Strlen(name)) #endif /* DTD_H */ speech_tools/include/rxp/stdio16.h0000644000076400007640000000510407262605664015574 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef STDIO16_H #define STDIO16_H #ifndef FOR_LT #define STD_API #endif #include #include #ifdef HAVE_LIBZ #include "zlib.h" #endif #include "charset.h" typedef struct _FILE16 FILE16; extern STD_API FILE16 *Stdin, *Stdout, *Stderr; STD_API FILE16 *MakeFILE16FromFILE(FILE *f, const char *type); STD_API FILE16 *MakeFILE16FromString(void *buf, long size, const char *type); #ifdef WIN32 #ifdef SOCKETS_IMPLEMENTED STD_API FILE16 *MakeFILE16FromWinsock(int sock, const char *type); #endif #endif #ifdef HAVE_LIBZ STD_API FILE16 *MakeFILE16FromGzip(gzFile file, const char *type); #endif STD_API int Readu(FILE16 *file, unsigned char *buf, int max_count); STD_API int Writeu(FILE16 *file, unsigned char *buf, int count); STD_API int Fclose(FILE16 *file); STD_API int Fflush(FILE16 *file); STD_API int Fseek(FILE16 *file, long offset, int ptrname); STD_API FILE *GetFILE(FILE16 *file); STD_API void SetCloseUnderlying(FILE16 *file, int cu); STD_API void SetFileEncoding(FILE16 *file, CharacterEncoding encoding); STD_API CharacterEncoding GetFileEncoding(FILE16 *file); STD_API int Fprintf(FILE16 *file, const char *format, ...); STD_API int Vfprintf(FILE16 *file, const char *format, va_list args); STD_API int Printf(const char *format, ...); STD_API int Vprintf(const char *format, va_list args); STD_API int Sprintf(void *buf, CharacterEncoding enc, const char *format, ...); STD_API int Vsprintf(void *buf, CharacterEncoding enc, const char *format, va_list args); STD_API void init_stdio16(void); #endif /* STDIO16_H */ speech_tools/include/rxp/system.h0000644000076400007640000000251507262605664015632 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ void *Malloc(int bytes); void *Realloc(void *mem, int bytes); void Free(void *mem); #ifndef SEEK_SET #define SEEK_SET 0 #endif #ifndef SEEK_CUR #define SEEK_CUR 1 #endif #ifndef SEEK_END #define SEEK_END 2 #endif #define SOCKETS_IMPLEMENTED #ifdef SYSTEM_IS_WIN32 #define WIN32 1 #endif speech_tools/include/rxp/xmlparser.h0000644000076400007640000001246007262616577016330 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ /* $Id: xmlparser.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #ifndef XMLPARSER_H #define XMLPARSER_H #include "dtd.h" #include "input.h" /* Typedefs */ typedef struct parser_state *Parser; typedef struct attribute *Attribute; typedef struct content_particle *ContentParticle; typedef struct xbit *XBit; typedef void CallbackProc(XBit bit, void *arg); typedef InputSource EntityOpenerProc(Entity e, void *arg); /* Bits */ enum xbit_type { XBIT_dtd, XBIT_start, XBIT_empty, XBIT_end, XBIT_eof, XBIT_pcdata, XBIT_pi, XBIT_comment, XBIT_cdsect, XBIT_xml, XBIT_error, XBIT_warning, XBIT_none, XBIT_enum_count }; typedef enum xbit_type XBitType; extern XML_API const char8 *XBitTypeName[XBIT_enum_count]; struct attribute { AttributeDefinition definition; /* The definition of this attribute */ Char *value; /* The (possibly normalised) value */ int quoted; /* Was it quoted? */ struct attribute *next; /* The next attribute or null */ }; enum cp_type { CP_pcdata, CP_name, CP_seq, CP_choice }; typedef enum cp_type CPType; struct content_particle { enum cp_type type; int repetition; Char *name; int nchildren; struct content_particle **children; }; struct xbit { Entity entity; int byte_offset; enum xbit_type type; char8 *s1, *s2; Char *S1, *S2; int i1, i2; Attribute attributes; ElementDefinition element_definition; #ifndef FOR_LT int nchildren; struct xbit *parent; struct xbit **children; #endif }; #define pcdata_chars S1 #define pi_name S1 #define pi_chars S2 #define comment_chars S1 #define cdsect_chars S1 #define xml_version s1 #define xml_encoding_name s2 #define xml_standalone i1 #define xml_encoding i2 #define error_message s1 /* Parser flags */ enum parser_flag { ExpandCharacterEntities, ExpandGeneralEntities, XMLPiEnd, XMLEmptyTagEnd, XMLPredefinedEntities, ErrorOnUnquotedAttributeValues, NormaliseAttributeValues, NormalizeAttributeValues, ErrorOnBadCharacterEntities, ErrorOnUndefinedEntities, ReturnComments, CaseInsensitive, ErrorOnUndefinedElements, WarnOnUndefinedElements, ErrorOnUndefinedAttributes, WarnOnUndefinedAttributes, WarnOnRedefinitions, TrustSDD, XMLExternalIDs, ReturnDefaultedAttributes, MergePCData, XMLMiscWFErrors, XMLStrictWFErrors, AllowMultipleElements, CheckEndTagsMatch, IgnoreEntities, XMLLessThan }; typedef enum parser_flag ParserFlag; /* Parser */ enum parse_state {PS_prolog1, PS_prolog2, PS_body, PS_epilog, PS_end, PS_error}; struct element_info { ElementDefinition definition; Entity entity; }; struct parser_state { enum parse_state state; Entity document_entity; int have_dtd; /* True if dtd has been processed */ StandaloneDeclaration standalone; struct input_source *source; Char *name, *pbuf; int namelen, pbufsize, pbufnext; struct xbit xbit; int peeked; Dtd dtd; /* The document's DTD */ CallbackProc *dtd_callback; CallbackProc *warning_callback; EntityOpenerProc *entity_opener; unsigned int flags; struct element_info *element_stack; int element_stack_alloc; int element_depth; void *callback_arg; int external_pe_depth; /* To keep track of whether we're in the */ /* internal subset: 0 <=> yes */ }; XML_API int ParserInit(void); XML_API Parser NewParser(void); XML_API void FreeParser(Parser p); XML_API Entity ParserRootEntity(Parser p); XML_API InputSource ParserRootSource(Parser p); XML_API XBit ReadXBit(Parser p); XML_API XBit PeekXBit(Parser p); XML_API void FreeXBit(XBit xbit); #ifndef FOR_LT XBit ReadXTree(Parser p); void FreeXTree(XBit tree); #endif XML_API XBit ParseDtd(Parser p, Entity e); XML_API void ParserSetWarningCallback(Parser p, CallbackProc cb); XML_API void ParserSetDtdCallback(Parser p, CallbackProc cb); XML_API void ParserSetEntityOpener(Parser p, EntityOpenerProc opener); XML_API void ParserSetCallbackArg(Parser p, void *arg); XML_API int ParserPush(Parser p, InputSource source); XML_API void ParserPop(Parser p); XML_API void ParserSetFlag(Parser p, ParserFlag flag, int value); #define ParserGetFlag(p, flag) ((p)->flags & (1 << (flag))) XML_API void ParserPerror(Parser p, XBit bit); #endif /* XMLPARSER_H */ speech_tools/include/rxp/ctype16.h0000644000076400007640000000425507262605664015604 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef CTYPE16_H #define CTYPE16_H #ifndef FOR_LT #define STD_API #endif /* XML character types */ STD_API void init_ctype16(void); STD_API int Toupper(int c); STD_API int Tolower(int c); extern STD_API unsigned char xml_char_map[]; #define xml_legal 0x01 #define xml_namestart 0x02 #define xml_namechar 0x04 #define xml_whitespace 0x08 #if CHAR_SIZE == 8 /* And with 0xff so that it works if char is signed */ #define is_xml_legal(c) (xml_char_map[(int)(c) & 0xff] & xml_legal) #define is_xml_namestart(c) (xml_char_map[(int)(c) & 0xff] & xml_namestart) #define is_xml_namechar(c) (xml_char_map[(int)(c) & 0xff] & xml_namechar) #define is_xml_whitespace(c) (xml_char_map[(int)(c) & 0xff] & xml_whitespace) #else /* Note! these macros evaluate their argument more than once! */ #define is_xml_legal(c) (c < 0x110000 && (c >= 0x10000 || (xml_char_map[c] & xml_legal))) #define is_xml_namestart(c) (c < 0x10000 && (xml_char_map[c] & xml_namestart)) #define is_xml_namechar(c) (c < 0x10000 && (xml_char_map[c] & xml_namechar)) #define is_xml_whitespace(c) (c < 0x10000 && (xml_char_map[c] & xml_whitespace)) #endif #endif /* CTYPE16_H */ speech_tools/include/rxp/input.h0000644000076400007640000000542607262605664015451 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef INPUT_H #define INPUT_H #ifndef FOR_LT #define XML_API #endif #include #include "charset.h" #include "stdio16.h" #include "dtd.h" /* Typedefs */ typedef struct input_source *InputSource; typedef struct stream_ops *StreamOps; typedef int ReadProc(StreamOps ops, unsigned char *buf, int max_count); typedef int WriteProc(StreamOps ops, unsigned char *buf, int count); typedef void CloseProc(StreamOps ops); typedef int SeekProc(StreamOps ops, int offset); /* Input sources */ XML_API InputSource SourceFromStream(const char8 *description, FILE *file); XML_API InputSource EntityOpen(Entity e); XML_API InputSource NewInputSource(Entity e, FILE16 *f16); XML_API int SourceTell(InputSource s); XML_API int SourceSeek(InputSource s, int offset); XML_API int SourceLineAndChar(InputSource s, int *linenum, int *charnum); XML_API void SourcePosition(InputSource s, Entity *entity, int *char_number); XML_API int get_with_fill(InputSource s); XML_API void determine_character_encoding(InputSource s); struct input_source { Entity entity; /* The entity from which the source reads */ FILE16 *file16; Char *line; int line_alloc, line_length; int next; int seen_eoe; int complicated_utf8_line; int bytes_consumed; int bytes_before_current_line; int line_end_was_cr; int line_number; int not_read_yet; struct input_source *parent; int nextin; int insize; unsigned char inbuf[4096]; }; /* EOE used to be -2, but that doesn't work if Char is signed char */ #define XEOE (-999) #define at_eol(s) ((s)->next == (s)->line_length) #define get(s) (at_eol(s) ? get_with_fill(s) : (s)->line[(s)->next++]) #define unget(s) ((s)->seen_eoe ? (s)->seen_eoe= 0 : (s)->next--) #endif /* INPUT_H */ speech_tools/include/rxp/string16.h0000644000076400007640000000747507262605664015775 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifndef STRING16_H #define STRING16_H #ifndef FOR_LT #define STD_API #define WIN_IMP #endif #include "charset.h" #include /* for size_t */ /* String functions */ #include #if 0 /* Don't want to include string.h while testing */ int strcmp(const char *, const char *); WIN_IMP int strncmp(const char *, const char *, size_t); int strcasecmp(const char *, const char *); size_t strlen(const char *); WIN_IMP char *strchr(const char *, int); char *strcpy(char *, const char *); WIN_IMP char *strncpy(char *, const char *, size_t); char *strcat(char *, const char *); WIN_IMP char *strstr(const char *, const char *); int memcmp(const void *, const void *, size_t); #ifndef memcpy void *memcpy(void *, const void *, size_t); #endif void *memset(void *, int, size_t); WIN_IMP size_t strspn(const char *, const char *); WIN_IMP size_t strcspn(const char *, const char *); #endif STD_API char8 *strdup8(const char8 *s); #define strchr8(s, c)strchr((s), c) #define strlen8(s) strlen((s)) #define strcmp8(s1, s2) strcmp((s1), (s2)) #define strncmp8(s1, s2, n) strncmp((s1), (s2), n) #define strcpy8(s1, s2) strcpy((s1), (s2)) #define strncpy8(s1, s2, n) strncpy((s1), (s2), n) #define strcat8(s1, s2) strcat((s1), (s2)) STD_API int strcasecmp8(const char8 *, const char8 *); STD_API int strncasecmp8(const char8 *, const char8 *, size_t); #define strstr8(s1, s2) strstr(s1, s2) STD_API char16 *strdup16(const char16 *s); STD_API char16 *strchr16(const char16 *, int); STD_API size_t strlen16(const char16 *); STD_API int strcmp16(const char16 *, const char16 *); STD_API int strncmp16(const char16 *, const char16 *, size_t); STD_API char16 *strcpy16(char16 *, const char16 *); STD_API char16 *strncpy16(char16 *, const char16 *, size_t); STD_API char16 *strcat16(char16 *, const char16 *); STD_API int strcasecmp16(const char16 *, const char16 *); STD_API int strncasecmp16(const char16 *, const char16 *, size_t); STD_API char16 *strstr16(const char16 *, const char16 *); STD_API char16 *char8tochar16(const char8 *s); STD_API char8 *char16tochar8(const char16 *s); #if CHAR_SIZE == 8 #define Strdup strdup8 #define Strchr strchr8 #define Strlen strlen8 #define Strcmp strcmp8 #define Strncmp strncmp8 #define Strcpy strcpy8 #define Strncpy strncpy8 #define Strcat strcat8 #define Strcasecmp strcasecmp8 #define Strncasecmp strncasecmp8 #define Strstr strstr8 #define char8toChar(x) (x) #define Chartochar8(x) (x) #else #define Strdup strdup16 #define Strchr strchr16 #define Strlen strlen16 #define Strcmp strcmp16 #define Strncmp strncmp16 #define Strcpy strcpy16 #define Strncpy strncpy16 #define Strcat strcat16 #define Strcasecmp strcasecmp16 #define Strncasecmp strncasecmp16 #define Strstr strstr16 #define char8toChar char8tochar16 #define Chartochar8 char16tochar8 #endif #endif /* STRING16_H */ speech_tools/include/rxp/url.h0000644000076400007640000000316707262616577015121 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ /* url.h -- Henry Thompson * * $Header: /home/CVS/speech_tools/include/rxp/url.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ #ifndef _URL_H #define _URL_H #ifndef FOR_LT #define STD_API #define EXPRT #endif #include #include "stdio16.h" #include "charset.h" extern STD_API char8 * EXPRT url_merge(const char8 *url, const char8 *base, char8 **scheme, char8 **host, int *port, char8 **path); extern STD_API FILE16 *url_open(const char8 *url, const char8 *base, const char8 *type, char8 **merged_url); extern STD_API char8 *EXPRT default_base_url(void); #endif speech_tools/audio/gen_audio.cc0000644000076400007640000002670611332265736015246 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : March 95 */ /*-----------------------------------------------------------------------*/ /* Generalised playback function */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_system.h" #include "EST_socket.h" #include "EST_Option.h" #include "EST_Wave.h" #include "EST_io_aux.h" #include "audioP.h" #include "EST_audio.h" #include "EST_wave_aux.h" static int play_sunau_wave(EST_Wave &inwave, EST_Option &al); static int play_socket_wave(EST_Wave &inwave, EST_Option &al); static int play_aucomm_wave(EST_Wave &inwave, EST_Option &al); static int record_sunau_wave(EST_Wave &wave, EST_Option &al); int play_wave(EST_Wave &inwave, EST_Option &al) { EST_String protocol; EST_Wave wtmp; EST_Wave *toplay; char *quality; char *sr; if ((sr = getenv("NA_PLAY_HOST")) != NULL) if (!al.present("-display")) al.add_item("-display", sr); if ((quality = getenv("NA_PLAY_QUALITY")) != NULL) if (!al.present("-quality")) al.add_item("-quality", quality); if (al.present("-p")) protocol = al.val("-p"); else if ((sr=getenv("NA_PLAY_PROTOCOL")) != NULL) protocol = sr; else if (protocol == "") { if (nas_supported) protocol = "netaudio"; // the default protocol else if (esd_supported) protocol = "esdaudio"; else if (sun16_supported) protocol = "sun16audio"; else if (freebsd16_supported) protocol = "freebsd16audio"; else if (linux16_supported) protocol = "linux16audio"; else if (irix_supported) protocol = "irixaudio"; else if (macosx_supported) protocol = "macosxaudio"; else if (win32audio_supported) protocol = "win32audio"; else if (mplayer_supported) protocol = "mplayeraudio"; else protocol = "sunaudio"; } // OS X can handle multichannel audio, don't know about other systems. if (inwave.num_channels() > 1 && upcase(protocol) != "MACOSXAUDIO" ) { wave_combine_channels(wtmp,inwave); toplay = &wtmp; } else toplay = &inwave; if (upcase(protocol) == "NETAUDIO") return play_nas_wave(*toplay,al); else if (upcase(protocol) == "ESDAUDIO") return play_esd_wave(*toplay,al); else if (upcase(protocol) == "SUNAUDIO") return play_sunau_wave(*toplay,al); else if (upcase(protocol) == "SUN16AUDIO") return play_sun16_wave(*toplay,al); else if ((upcase(protocol) == "FREEBSD16AUDIO") || (upcase(protocol) == "LINUX16AUDIO")) return play_linux_wave(*toplay,al); else if (upcase(protocol) == "IRIXAUDIO") return play_irix_wave(*toplay,al); else if (upcase(protocol) == "MACOSXAUDIO") return play_macosx_wave(*toplay,al); else if (upcase(protocol) == "MPLAYERAUDIO") return play_mplayer_wave(*toplay,al); else if (upcase(protocol) == "WIN32AUDIO") return play_win32audio_wave(*toplay,al); else if (upcase(protocol) == "AUDIO_COMMAND") return play_aucomm_wave(*toplay,al); else if (upcase(protocol) == "SOCKET") return play_socket_wave(*toplay,al); else { cerr << "Unknown audio server protocol " << protocol << endl; return -1; } } static int play_socket_wave(EST_Wave &inwave, EST_Option &al) { // Send inwave down the given fd (a socket) SOCKET_FD fd; EST_String otype; EST_String tmpfile = make_tmp_filename(); if (al.present("socket_fd")) fd = al.ival("socket_fd"); else { cerr << "Socket audio mode: no socket_fd specified" << endl; return -1; } if (al.present("socket_otype")) otype = al.val("socket_otype"); // file type to send to client else otype = "riff"; inwave.save(tmpfile,otype); // Because the client may receive many different types of file // I send WV\n to it before the file itself send(fd,"WV\n",3,0); socket_send_file(fd,tmpfile); unlink(tmpfile); return 0; } static int play_aucomm_wave(EST_Wave &inwave, EST_Option &al) { // Play wave by specified command EST_String usrcommand, otype; char tmpfile[2048]; char pref[2048]; if (al.present("-command")) usrcommand = al.val("-command"); else if (getenv("NA_PLAY_COMMAND") != NULL) usrcommand = getenv("NA_PLAY_COMMAND"); else { cerr << "Audio protocol set to COMMAND but no command specified\n"; return -1; } sprintf(tmpfile,"/tmp/audiofile_%05ld",(long)getpid()); if (al.present("-rate")) inwave.resample(al.ival("-rate")); if (al.present("-otype")) otype = al.val("-otype"); else otype = "raw"; if (inwave.save(tmpfile,otype) != write_ok) { cerr << "Audio writing file \"" << tmpfile << "\" in type \"" << otype << " failed " << endl; return -1; } sprintf(pref,"FILE=%s;SR=%d;",tmpfile,inwave.sample_rate()); system((EST_String)pref+usrcommand.unquote('"')); unlink(tmpfile); // so we don't fill up /tmp return 0; } static int play_sunau_wave(EST_Wave &inwave, EST_Option &al) { // Play wave through /dev/audio using 8K ulaw encoding // works for Suns as well as Linux and FreeBSD machines int rcode; const char *audiodevice; inwave.resample(8000); if (al.present("-audiodevice")) audiodevice = al.val("-audiodevice"); else audiodevice = "/dev/audio"; // Should really do something cute about checking if /dev/audio // is not in use rcode = inwave.save(audiodevice,"ulaw"); return rcode; } EST_String options_supported_audio(void) { // returns list of supported audio types EST_String audios = ""; audios += "sunaudio"; // we always support this in spite of the hardware audios += " audio_command"; if (nas_supported) audios += " netaudio"; else if (esd_supported) audios += " esdaudio"; if (sun16_supported) audios += " sun16audio"; if (freebsd16_supported) audios += " freebsd16audio"; if (linux16_supported) audios += " linux16audio"; if (irix_supported) audios += " irixaudio"; if (mplayer_supported) audios += " mplayeraudio"; if (macosx_supported) audios += "macosxaudio"; if (win32audio_supported) audios += " win32audio"; if (os2audio_supported) audios += " os2audio"; return audios; } int record_wave(EST_Wave &wave, EST_Option &al) { // Record wave from audio device char *sr; EST_String protocol; // For archaic reasons, if you are using NAS use DISPLAY or // AUDIOSERVER if ((sr = getenv("NA_PLAY_HOST")) != NULL) if (!al.present("-display")) al.add_item("-display", sr); if (al.present("-p")) protocol = al.val("-p"); else if ((sr=getenv("NA_PLAY_PROTOCOL")) != NULL) protocol = sr; else if (protocol == "") { if (nas_supported) protocol = "netaudio"; // the default protocol else if (esd_supported) protocol = "esdaudio"; // the default protocol else if (sun16_supported) protocol = "sun16audio"; else if (freebsd16_supported) protocol = "freebsd16audio"; else if (linux16_supported) protocol = "linux16audio"; else if (irix_supported) protocol = "irixaudio"; else if (win32audio_supported) protocol = "win32audio"; else if (mplayer_supported) protocol = "mplayeraudio"; else protocol = "sunaudio"; } if (upcase(protocol) == "NETAUDIO") return record_nas_wave(wave,al); else if (upcase(protocol) == "ESDAUDIO") return record_esd_wave(wave,al); else if (upcase(protocol) == "SUN16AUDIO") return record_sun16_wave(wave,al); else if ((upcase(protocol) == "FREEBSD16AUDIO") || (upcase(protocol) == "LINUX16AUDIO")) return record_linux_wave(wave,al); else if (upcase(protocol) == "SUNAUDIO") return record_sunau_wave(wave,al); else { cerr << "NA_RECORD: \"" << protocol << "\" EST current has no record support" << endl; return -1; } } static int record_sunau_wave(EST_Wave &wave, EST_Option &al) { int num_samples,i,r,n; int audio; unsigned char *ulawwave; short *waveform; const int AUDIOBUFFSIZE = 256; const char *audiodevice; if (al.present("-audiodevice")) audiodevice = al.val("-audiodevice"); else audiodevice = "/dev/audio"; if ((audio = open(audiodevice, O_RDONLY)) == -1) { cerr << "SUN16: can't open " << audiodevice << " for reading" << endl; return -1; } num_samples = (int)(8000*al.fval("-time")); ulawwave = walloc(unsigned char,num_samples); for (r=i=0; i < num_samples; i+= r) { if (num_samples > i+AUDIOBUFFSIZE) n = AUDIOBUFFSIZE; else n = num_samples-i; r = read(audio,&ulawwave[i], n); if (r <= 0) { cerr << "sunaudio: failed to read from audio device" << endl; close(audio); wfree(ulawwave); return -1; } } wave.resize(num_samples); wave.set_sample_rate(8000); waveform = wave.values().memory(); ulaw_to_short(ulawwave,waveform,num_samples); wave.resample(al.ival("-sample_rate")); close(audio); wfree(ulawwave); return 0; } speech_tools/audio/nas.cc0000644000076400007640000001430610127000717014051 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor & Alan Black */ /* Date : April 1995 & 96 */ /*-----------------------------------------------------------------------*/ /* Playback function for NCD's NAS server (formerly called netaudio) */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_Wave.h" #include "EST_Option.h" #include "audioP.h" #include "EST_io_aux.h" #ifdef SUPPORT_NAS #include \n\n\n"); fprintf(stdout,"%s\n\n", (const char *)t.string()); if ((ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "")) { // must strip of the angle brackets to make SGML atype = ts.get().string(); atype.gsub("<",""); atype.gsub(">",""); fprintf(stdout,"%s\n", (const char *) atype); } if ((ts.peek().string() == "{")) { // a default value ts.get(); fprintf(stdout," \" {%s}\"",(const char *)ts.get().string()); ts.get(); } if (!ts.peek().whitespace().contains("\n")) fprintf(stdout,"\n"); in_options = TRUE; } else if (in_options) { if (t.whitespace().contains("\n")) fprintf(stdout,"\n"); fprintf(stdout,"%s ",(const char *)t.string()); } } if (in_options) fprintf(stdout,"\n\n\n"); } static void output_sgml_synopsis(char **argv, const EST_String &usage) { EST_TokenStream ts; EST_Token t; EST_String atype; int in_options = FALSE; ts.open_string(usage); ts.set_SingleCharSymbols("{}[]|"); ts.set_PunctuationSymbols(""); ts.set_PrePunctuationSymbols(""); EST_Pathname full(argv[0]); fprintf(stdout,"%s", (const char *)full.filename()); fprintf(stdout, (const char *)ts.get_upto_eoln().string()); while (!ts.eof()) { t = ts.get(); if ((t.string().contains("-",0)) && (t.whitespace().contains("\n"))) { // An argument if (in_options) fprintf(stdout,"\n"); fprintf(stdout,"%s ", (const char *)t.string()); if ((ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "") || (ts.peek().string() == "")) { // must strip of the angle brackets to make SGML atype = ts.get().string(); atype.gsub("<",""); atype.gsub(">",""); fprintf(stdout,"%s", (const char *) atype); } if ((ts.peek().string() == "{")) { // a default value ts.get(); fprintf(stdout," \" {%s}\"",(const char *)ts.get().string()); ts.get(); } in_options = TRUE; } } fprintf(stdout,"\n\n"); } EST_String options_general(void) { // The standard waveform input options return EST_String("")+ "-o output file" + "-otype output file type\n"; } void option_override(EST_Features &op, EST_Option al, const EST_String &option, const EST_String &arg) { if (al.present(arg)) op.set(option, al.val(arg)); } speech_tools/utils/util_io.cc0000644000076400007640000002164511465017156015012 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1994 */ /*-----------------------------------------------------------------------*/ /* File i/o utility functions */ /* */ /*=======================================================================*/ #include #include #include #include #include #include #include "EST_types.h" #include "EST_String.h" #include "EST_Pathname.h" #include "EST_io_aux.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_Token.h" EST_String make_tmp_filename() { // returns tmp filename char *tname = cmake_tmp_filename(); EST_String cname = tname; wfree(tname); return cname; } int readable_file(char *filename) { // Returns TRUE if this is file is readable, FALSE otherwise if (streq(filename,"-")) return TRUE; else if (access(filename,R_OK) == 0) return TRUE; else return FALSE; } int writable_file(char *filename) { // Returns TRUE if this is afile is writable or creatable, FALSE // otherwise // Note this is *not* guaranteed to work, if the file doesn't // exist the directory is checked if its writable but it can // lie, esp. with ro file systems and NFS. if (streq(filename,"-")) return TRUE; else if (access(filename,W_OK) == 0) return TRUE; else if ((access(filename,F_OK) == -1) && // doesn't exists (access(EST_Pathname(filename).directory(),W_OK) == 0)) return TRUE; // probably; else return FALSE; } EST_String stdin_to_file() { /* Copy stding to a file and return the name of that tmpfile */ EST_String tmpname = make_tmp_filename(); char buff[1024]; FILE *fd; unsigned int n; if ((fd = fopen(tmpname,"wb")) == NULL) { cerr << "Write access failed for temporary file\n"; return tmpname; } while ((n=fread(buff,1,1024,stdin)) > 0) if (fwrite(buff,1,n,fd) != n) { cerr << "Write error on temporary file"; return tmpname; } fclose(fd); return tmpname; } int Stringtoi(EST_String s, int success) { char *a; int d; d = strtol(s, &a, 0); success = (*a == '\0') ? 0: 1; return d; } int Stringtoi(EST_String s) { int success; char *a; int d; d = strtol(s, &a, 0); success = (*a == '\0') ? 0: 1; return d; } EST_String itoString(int n) { char tmp[1000]; sprintf(tmp, "%d", n); return EST_String(tmp); } EST_String ftoString(float n, int pres, int width, int right_justify) { (void)right_justify; EST_String val; char tmp[1000]; char spec[10]; strcpy(spec, "%"); if (width != 0) strcat(spec, itoString(width)); strcat(spec, "."); strcat(spec, itoString(pres)); strcat(spec, "f"); sprintf(tmp, spec, n); val = tmp; return val; } // Carry out equivalent of Bourne shell basename command, i.e. strip of // leading path and optionally remove extension. It assumes directories // are separated by a forward "/". This wont work on deviant OSs. EST_String basename(EST_String full, EST_String ext) { if (full.contains("/")) { full= full.after(full.index("/", -1)); // full= full.after("/"); //- don't know why this was here } if (ext == "*") { if (full.contains(".")) full = full.before(".", -1); // everything apart from last extension } else if (ext == "?") { if (full.contains(".")) full = full.before("."); // everything up to first extension } else if (ext != "") full = full.before(ext); return full; } void strip_quotes(EST_String &s, const EST_String quote_char) { // if s is has quote_char as first and/or last char, strip them if (s == "") return; if (quote_char(0) == s(0)) s = s.after(0); if (quote_char(0) == s(s.length()-1)) s = s.before((int)(s.length()-1)); } // uncompression via temporary file EST_String uncompress_file_to_temporary(const EST_String &filename, const EST_String &prog_name) { EST_String new_filename = make_tmp_filename(); EST_String sysstr = prog_name + " " + filename + " > " + new_filename; //cerr << "Uncompressing file : " << sysstr << endl; int stat = system(sysstr); if(stat != 0) { (void)delete_file(new_filename); new_filename = ""; } return new_filename; } int compress_file_in_place(const EST_String &filename, const EST_String &prog_name) { return system(prog_name + " " + filename); } int compress_file(const EST_String &filename, const EST_String &new_filename, const EST_String &prog_name) { EST_String sysstr; if(new_filename == "-") sysstr = prog_name + " " + filename; else sysstr = prog_name + " " + filename + " > " + new_filename; return system(sysstr); } /* EST_read_status load_TList_of_StrVector(EST_TList &w, const EST_String &filename, const int vec_len) { EST_TokenStream ts; EST_String s; EST_StrVector v; int c; if(ts.open(filename) != 0){ cerr << "Can't open EST_TList file " << filename << endl; return misc_read_error; } v.resize(vec_len); // ts.set_SingleCharSymbols(""); // ts.set_PunctuationSymbols(""); c=0; while (!ts.eof()) { s = ts.get().string(); if(s != "") { if(c == vec_len) { cerr << "Too many points in line - expected " << vec_len << endl; return wrong_format; } else v[c++] = s; } if(ts.eoln()) { if(c != vec_len) { cerr << "Too few points in line - got " << c << ", expected " << vec_len << endl; return wrong_format; } else { w.append(v); c=0; } } } ts.close(); return format_ok; } int ilist_member(const EST_IList &l,int i) { EST_Litem *p; for (p = l.head(); p != 0; p = p->next()) if (l.item(p) == i) return TRUE; return FALSE; } int ilist_index(const EST_IList &l,int i) { EST_Litem *p; int j=0; for (p = l.head(); p != 0; p = p->next()) { if (l.item(p) == i) return j; j++; } return -1; } int strlist_member(const EST_StrList &l,const EST_String &s) { EST_Litem *p; for (p = l.head(); p != 0; p = p->next()) if (l.item(p) == s) return TRUE; return FALSE; } int strlist_index(const EST_StrList &l,const EST_String &s) { EST_Litem *p; int j=0; for (p = l.head(); p != 0; p = p->next()) { if (l.item(p) == s) return j; j++; } return -1; } */ speech_tools/utils/filetrans.cc0000644000076400007640000001324010127000721015305 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black */ /* Date : December 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* File transfer over open file descriptors. Uses key stuffing */ /* to allow transfer of any file over an open link (usually a socket) */ /* */ /*=======================================================================*/ #include "EST_unix.h" #include #include "EST_String.h" #include "EST_io_aux.h" // The following key is used when stuffing files down a socket. // This key in when received denotes the end of file. Any occurrence // of key in the file with have X inserted in it, and the receiving end // with remove that X in the file. This is a technique I learned from // HDLC network protocols which guarantees 0x7e (6 bits) starts a header. // This allows transfer of files even if they include the stuff key. const char *file_stuff_key = "ft_StUfF_key"; static int getc_unbuffered(SOCKET_FD fd) { // An attempted to get rid of the buffering char c; int n; #ifdef WIN32 n = recv(fd,&c,1,0); #else n = read(fd,&c,1); #endif if (n == 0) // this isn't necessarily eof return EOF; else return c; // and this might be -1 (EOF) } int socket_receive_file(SOCKET_FD fd,const EST_String &filename) { // Copy the file from fd to filename using the 7E stuff key // mechanism so binary files may pass through the socket // without signals or eof. FILE *outfd; int k,i,c; if ((outfd=fopen(filename,"wb")) == NULL) { cerr << "socket_receive_file: can't find file \"" << filename << "\"\n"; return -1; } k=0; while (file_stuff_key[k] != '\0') { c = getc_unbuffered(fd); if (file_stuff_key[k] == c) k++; else if ((c == 'X') && (file_stuff_key[k+1] == '\0')) { for (i=0; i < k; i++) putc(file_stuff_key[i],outfd); k=0; // omit the stuffed 'X' } else { for (i=0; i < k; i++) putc(file_stuff_key[i],outfd); k=0; putc(c,outfd); } } fclose(outfd); return 0; } int socket_send_file(SOCKET_FD fd,const EST_String &filename) { // Send file down fd using the 7E end stuffing technique. // This guarantees the binary transfer without any other // signals eof etc #ifndef WIN32 FILE *ffd = fdopen(dup(fd),"wb"); // use some buffering #endif FILE *infd; int k,c; if ((infd=fopen(filename,"rb")) == NULL) { cerr << "socket_send_file: can't find file \"" << filename << "\"\n"; return -1; } k=0; while ((c=getc(infd)) != EOF) { if (file_stuff_key[k] == c) k++; else k=0; if (file_stuff_key[k] == '\0') { #ifdef WIN32 const char filler='X'; send(fd,&filler,1,0); #else putc('X',ffd); // stuff filler #endif k=0; } #ifdef WIN32 send(fd,(const char *)&c,1,0); #else putc(c,ffd); #endif } for (k=0; file_stuff_key[k] != '\0'; k++) #ifdef WIN32 send(fd,file_stuff_key+k,1,0); #else putc(file_stuff_key[k],ffd); // stuff whole key as its the end fflush(ffd); fclose(ffd); #endif fclose(infd); return 0; } speech_tools/utils/cmd_line_aux.cc0000644000076400007640000000630210127000721015746 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor/Alan W Black */ /* Date : April 1997 */ /*-----------------------------------------------------------------------*/ /* A separate file for an override function that may optionally be */ /* provided by the main program. */ /*=======================================================================*/ #include #include "EST_String.h" #include "EST_Token.h" #include "EST_cutils.h" #include "EST_TList.h" #include "EST_string_aux.h" #include "EST_cmd_line.h" // This *must* be in a separate file to ensure it is only linked // when the user's program doesn't defined it. void override_lib_ops(EST_Option &a_list, EST_Option &al) { (void)a_list; (void)al; } speech_tools/utils/EST_swapping.cc0000644000076400007640000000771407262605664015721 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* General byte swapping routines */ /*************************************************************************/ #include "EST_cutils.h" /* For endian tests */ int est_endian_loc = 1; void swapdouble(double *d) { int *ii = (int *)d; int t; t = SWAPINT(ii[0]); ii[0] = SWAPINT(ii[1]); ii[1] = t; } void swapfloat(float *f) { int *ii = (int *)f; ii[0] = SWAPINT(ii[0]); } void swap_bytes_float(float *data, int length) { /* Swap floats in an array */ int i; for (i=0; i #include "EST_unix.h" #include "EST_TKVL.h" #include "EST_ServiceTable.h" #include "EST_Server.h" #include "EST_Pathname.h" #include "EST_error.h" #include "EST_Token.h" #include #include static EST_Regex ipnum("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); static EST_String cookie_term = "\n"; static EST_String command_term = "\n//End//\n"; static EST_String result_term = "\n//End//"; static EST_String status_term = "\n"; EST_Server::RequestHandler::RequestHandler() { } EST_Server::RequestHandler::~RequestHandler() { } EST_Server::ResultHandler::ResultHandler() { } EST_Server::ResultHandler::~ResultHandler() { } EST_Server::BufferedSocket::BufferedSocket(int socket) { s = socket; bpos=0; blen=100; buffer=walloc(char, 100); } EST_Server::BufferedSocket::~BufferedSocket() { if (buffer != NULL) { wfree(buffer); buffer=NULL; } } void EST_Server::BufferedSocket::ensure(int n) { if (n > blen) { buffer= wrealloc(buffer, char, n+100); blen = n+100; } } int EST_Server::BufferedSocket::read_data(void) { return ::read(s, buffer+bpos, blen-bpos); } EST_Server::EST_Server(Mode mode, EST_String name, EST_String type, ostream *trace) { zero(); if (mode == sm_client) initClient(name, type, trace); else initServer(mode, name, type, trace); } EST_Server::EST_Server(EST_String name, EST_String type, ostream *trace) { zero(); initClient(name, type, trace); } EST_Server::EST_Server(Mode mode, EST_String name, EST_String type) { zero(); if (mode == sm_client) initClient(name, type, NULL); else initServer(mode, name, type, NULL); } EST_Server::EST_Server(EST_String name, EST_String type) { zero(); initClient(name, type, NULL); } EST_Server::EST_Server(EST_String hostname, int port, ostream *trace) { zero(); initClient(hostname, port, trace); } EST_Server::EST_Server(EST_String hostname, int port) { zero(); initClient(hostname, port, NULL); } EST_Server::~EST_Server() { if (connected()) disconnect(); // if (p_serv_addr) // delete p_serv_addr; if (p_buffered_socket) delete p_buffered_socket; } void EST_Server::zero() { p_serv_addr = NULL; p_socket = -1; p_mode = sm_unknown; p_trace = NULL; } void EST_Server::initClient(EST_String name, EST_String type, ostream *trace) { const EST_ServiceTable::Entry &entry = EST_ServiceTable::lookup(name, type); // if (&entry == EST_ServiceTable::EntryTable::default_val) if (entry.port == 0) EST_error("no %s called '%s' listed", (const char *)type, (const char *)name); initClient(entry, trace); } void EST_Server::initClient(EST_String hostname, int port, ostream *trace) { EST_ServiceTable::Entry tmp; tmp.name=""; if (hostname.matches(ipnum)) { tmp.hostname=""; tmp.address=hostname; } else { tmp.address=""; tmp.hostname=hostname; } tmp.port=port; initClient(tmp, trace); } void EST_Server::init(ostream *trace) { p_trace=trace; if (!socket_initialise()) EST_sys_error("Can't Initialise Network Code"); if (connected()) disconnect(); if (p_serv_addr != NULL) { // delete p_serv_addr; p_serv_addr = NULL; } } void EST_Server::initClient(const EST_ServiceTable::Entry &entry, ostream *trace) { init(trace); p_mode = sm_client; p_entry = entry; struct sockaddr_in *serv_addr = new sockaddr_in; p_serv_addr = serv_addr; struct hostent *serverhost; memset(serv_addr, 0, sizeof(serv_addr)); if (p_entry.address != "") { if (p_trace != NULL) *p_trace << "Using address " << entry.address << "\n"; serv_addr->sin_addr.s_addr = inet_addr(entry.address); } else { if (p_trace != NULL) *p_trace << "Using domain name " << entry.hostname << "\n"; serverhost = gethostbyname(entry.hostname); if (serverhost == (struct hostent *)0) EST_error("lookup of host '%s' failed", (const char *)entry.hostname); memmove(&(serv_addr->sin_addr),serverhost->h_addr, serverhost->h_length); } if (p_trace != NULL) *p_trace << "Server is at " << inet_ntoa(serv_addr->sin_addr) << "\n"; serv_addr->sin_family = AF_INET; serv_addr->sin_port = htons(entry.port); } void EST_Server::initServer(Mode mode, EST_String name, EST_String type, ostream *trace) { init(trace); p_mode = mode; int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (NOT_A_SOCKET(s)) EST_sys_error("Can't create socket"); struct sockaddr_in serv_addr; memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(0); serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(s, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) EST_sys_error("bind failed"); if (listen(s, 5) != 0) EST_sys_error("listen failed"); p_entry = EST_ServiceTable::create(name, type, s); p_socket = s; } const EST_String EST_Server::name(void) const { return p_entry.name; } const EST_String EST_Server::type(void) const { return p_entry.type; } const EST_String EST_Server::hostname(void) const { return p_entry.hostname; } const EST_String EST_Server::address(void) const { return p_entry.address; } const EST_String EST_Server::servername(void) const { if (p_entry.hostname != "") return p_entry.hostname; else if (p_entry.address != "") return p_entry.address; return ""; } int EST_Server::port(void) const { return p_entry.port; } EST_connect_status EST_Server::connect(void) { if (connected()) EST_error("Already Connected"); if (p_mode != sm_client) EST_error("Connect is not a legal action on server end connections"); struct sockaddr_in *serv_addr = (struct sockaddr_in *) p_serv_addr; p_socket = socket(serv_addr->sin_family, SOCK_STREAM, IPPROTO_TCP); if (NOT_A_SOCKET(p_socket)) return connect_system_error; if (p_trace != NULL) *p_trace << "Connect to " << inet_ntoa(serv_addr->sin_addr) << ":" << ntohs(serv_addr->sin_port) << "\n"; if (::connect(p_socket, (struct sockaddr *)serv_addr, sizeof(*serv_addr)) != 0) { int t_errno=errno; // save this so it isn't changed by close() close(p_socket); p_socket=-1; errno=t_errno; if ( #if !defined(SYSTEM_IS_WIN32) t_errno == ECONNREFUSED || #endif t_errno == EACCES ) return connect_not_allowed_error; if ( #if !defined(SYSTEM_IS_WIN32) t_errno == ENETUNREACH || t_errno == EADDRNOTAVAIL || #endif t_errno == ENOENT ) return connect_not_found_error; } p_buffered_socket = new BufferedSocket(p_socket); if (p_entry.cookie != "" && p_entry.cookie != "none") write(*p_buffered_socket, "//"+p_entry.cookie, cookie_term); return connect_ok; } bool EST_Server::connected(void) { return p_socket >=0; } EST_connect_status EST_Server::disconnect(void) { if (!connected()) EST_error("Not Connected"); if (p_trace) { if (p_mode == sm_client) *p_trace << "Disconnect from " << p_entry.name << "\n"; else *p_trace << "Close down service " << p_entry.name << "\n"; } if (p_buffered_socket) { delete p_buffered_socket; p_buffered_socket = NULL; } close(p_socket); p_socket=-1; return connect_ok; } bool EST_Server::parse_command(const EST_String command, EST_String &package, EST_String &operation, EST_Server::Args &arguments) { (void)command; (void)package; (void)operation; (void)arguments; return false; } EST_String EST_Server::build_command(const EST_String package, const EST_String operation, const EST_Server::Args &arguments) { (void)package; (void)operation; (void)arguments; return ""; } bool EST_Server::parse_result(const EST_String resultString, EST_Server::Result &res) { res.set("STRING", resultString); return false; } EST_String EST_Server::build_result(const EST_Server::Result &res) { (void)res; return ""; } bool EST_Server::execute(const EST_String package, const EST_String operation, const EST_Server::Args &args, EST_Server::ResultHandler &handler) { EST_String command = build_command(package, operation, args); return execute(command, handler); } static int server_died; static void server_died_fn(int x) { (void)x; server_died=1; } void EST_Server::write(BufferedSocket &s, const EST_String string, const EST_String term) { EST_String termed; const char *data; int l, p=0, n; if (term != "") { termed = EST_String::cat(string, term); data = termed; l = termed.length(); } else { data = string; l = string.length(); } server_died=0; #if !defined(SYSTEM_IS_WIN32) void (*old)(int) = signal(SIGPIPE, server_died_fn); #endif while(l>0) if ((n=::write(s.s, data+p, l))>0) { if (p_trace) *p_trace << "wrote " << n << " chars\n"; l -= n; p += n; } else { #if !defined(SYSTEM_IS_WIN32) signal(SIGPIPE, old); #endif EST_sys_error("Failed while writing to %s", (const char *)p_entry.type); } #if !defined(SYSTEM_IS_WIN32) signal(SIGPIPE, old); #endif if (server_died) EST_error("Failed while writing to %s", (const char *)p_entry.type); } EST_String EST_Server::read_data(BufferedSocket &sock, const EST_String end, int &eof) { EST_String result(sock.buffer, 0, sock.bpos); int endpos; eof=0; sock.bpos=0; while ((endpos=result.index(end, 0))<0 && 1==1) { int n=sock.read_data(); if ( n== 0 ) { eof=1; return "EOF"; } if (n<0) EST_sys_error("Failed to read from %s %d", (const char *)p_entry.type, errno); EST_String bit(sock.buffer, 0, n+sock.bpos); if (p_trace) *p_trace << "read " << n << " chars '" << bit << "'\n"; result += bit; sock.bpos=0; } sock.ensure(result.length()-endpos); memcpy(sock.buffer, (const char *)result+endpos+end.length(), result.length()-endpos-end.length()); sock.bpos=result.length()-endpos-end.length(); result=result.at(0, endpos); if (p_trace) *p_trace << "Got '" << result << "'\n" << "Left '" << EST_String(sock.buffer, 0, sock.bpos) << "'\n"; return result; } bool EST_Server::execute(const EST_String command, EST_Server::ResultHandler &handler) { if (!connected()) EST_error("Must connect to %s before calling execute.", (const char *)p_entry.type); handler.server=this; Result &res = handler.res; if (p_trace) *p_trace << "Sending command " << command << " to " << p_entry.type << "\n"; write(*p_buffered_socket, command, command_term); int eof; EST_String result = read_data(*p_buffered_socket, result_term, eof); if (eof) { res.set("ERROR", "server closed connection"); handler.resString=result; handler.process(); return FALSE; } EST_String status = read_data(*p_buffered_socket, status_term, eof); if (eof) { res.set("ERROR", "server closed connection"); handler.resString=result; handler.process(); return FALSE; } if (status == "ERROR") { res.set("ERROR", result); handler.resString=result; handler.process(); return FALSE; } else if (!parse_result(result, res)) { res.set("ERROR", "Server returned bad result '"+result+"'"); handler.resString=result; handler.process(); return FALSE; } handler.resString=result; handler.process(); return TRUE; } void EST_Server::run(EST_Server::RequestHandler &handler) { if (!connected()) EST_error("Server disconnected", (const char *)p_entry.type); handler.server=this; switch(p_mode) { case sm_sequential: run_sequential(handler); break; default: EST_error("Server type %d not yet implemented", (int)p_mode); break; } } void EST_Server::run_sequential(EST_Server::RequestHandler &handler) { int csocket=0; struct sockaddr_in sin; socklen_t sin_size = sizeof(sin); while (connected() && (csocket = accept(p_socket, (struct sockaddr *) &sin, &sin_size))>=0) { if (p_trace) *p_trace << "connection " << csocket << "\n"; BufferedSocket bs(csocket); if (!check_cookie(bs)) { close(csocket); continue; } handle_client(bs, handler); close(csocket); if (p_trace) *p_trace << "Client " << csocket << " disconnected\n"; } EST_sys_error("error accepting connections"); } bool EST_Server::check_cookie(BufferedSocket &socket) { if (p_entry.cookie == "" || p_entry.cookie == "none") return TRUE; int eof; EST_String cookie = read_data(socket, cookie_term, eof); if (eof || cookie.at(0, 2) != "//" || cookie.after(0,2) != p_entry.cookie) { EST_warning("Bad cookie '%s'", (const char *)cookie.after(0,2)); return FALSE; } return TRUE; } bool EST_Server::process_command(BufferedSocket &socket, EST_String command, RequestHandler &handler) { handler.requestString=command; if (!parse_command(command, handler.package, handler.operation, handler.args)) { EST_warning("Bad Command '%s'", (const char *)command); return FALSE; } EST_String error_message = handler.process(); if (error_message != "") return_error(socket, error_message); else return_value(socket, handler.res, TRUE); return TRUE; } void EST_Server::handle_client(BufferedSocket &socket, RequestHandler &handler) { while (1==1) { int eof; EST_String command=read_data(socket, command_term, eof); if (eof) break; if (p_trace) *p_trace << "Got command " << command << "\n"; if (!process_command(socket, command, handler)) break; } } void EST_Server::return_error(BufferedSocket &socket, EST_String err) { if (p_trace) *p_trace << "error in processing: " << err << "\n"; write(socket, err, result_term); write(socket, "ERROR", status_term); } void EST_Server::return_value(BufferedSocket &socket, Result &res, bool final) { EST_String resultString = build_result(res); if (p_trace) *p_trace << "Result: " << resultString << "\n"; write(socket, resultString, result_term); write(socket, final?"OK":"VAL", status_term); } speech_tools/utils/EST_FringeServer.cc0000644000076400007640000001334710127000721016442 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Code to talk to a running fringe. */ /* */ /*************************************************************************/ #include "EST_system.h" #include "EST_socket.h" #include #include "EST_unix.h" #include "EST_TKVL.h" #include "EST_ServiceTable.h" #include "EST_FringeServer.h" #include "EST_Pathname.h" #include "EST_error.h" #include "EST_Token.h" #include #include static EST_Regex ipnum("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); EST_FringeServer::ResultHandler::ResultHandler() { } EST_FringeServer::ResultHandler::~ResultHandler() { } void EST_FringeServer::ResultHandler::process(void) { } EST_FringeServer::EST_FringeServer(EST_String name, ostream *trace) : EST_Server(name, "fringe", trace) { } EST_FringeServer::EST_FringeServer(EST_String name) : EST_Server(name, "fringe") { } EST_FringeServer::EST_FringeServer(EST_String hostname, int port, ostream *trace) : EST_Server(hostname, port, trace) { } EST_FringeServer::EST_FringeServer(EST_String hostname, int port) : EST_Server(hostname, port) { } EST_FringeServer::~EST_FringeServer() { } static void setup_command_tokenstream(EST_TokenStream &toks) { toks.set_SingleCharSymbols("(){}[]="); toks.set_PunctuationSymbols(""); toks.set_PrePunctuationSymbols(""); toks.set_quotes('"', '\\'); } bool EST_FringeServer::parse_command(const EST_String command, EST_String &package, EST_String &operation, EST_FringeServer::Args &arguments) { EST_TokenStream toks; EST_Token tok; int i; toks.open_string(command); setup_command_tokenstream(toks); if (toks.eof()) return FALSE; tok=toks.get(); EST_String op = tok.String(); if ((i = op.index(".", -1)) >= 0) { package = op.before(i,1); operation = op.after(i,1); } else { package = ""; operation = op; } while (!toks.eof()) { tok=toks.get(); if (tok.String() == "") break; EST_String key=tok.String(); EST_String val; tok = toks.peek(); if (tok.String() == "=") { // swallow '=' toks.get(); if (toks.eof()) return FALSE; tok=toks.get(); if (tok.String() == "") return FALSE; val=tok.String(); } else { val=key; key=""; } arguments.set(key,val); } toks.close(); return TRUE; } EST_String EST_FringeServer::build_command(const EST_String package, const EST_String operation, const EST_Server::Args &arguments) { EST_String c=""; if (package != "") c += package + "."; c += operation; EST_FringeServer::Args::Entries argp; for (argp.begin(arguments); argp != 0; ++argp) { c += " "; if (argp->k != "") c += argp->k + "="; c += argp->v.String().quote_if_needed('"'); } return c; } bool EST_FringeServer::parse_result(const EST_String resultString, EST_Server::Result &res) { res.set("STRING", resultString); return TRUE; } EST_String EST_FringeServer::build_result(const EST_Server::Result &res) { (void)res; return ""; } speech_tools/utils/est_file.cc0000644000076400007640000001554310044502521015123 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* File functions for EST type files */ /* */ /*=======================================================================*/ #include "EST_FileType.h" #include "EST_TNamedEnum.h" #include "EST_Token.h" #include "EST_Option.h" #include "EST_Features.h" static EST_TValuedEnumDefinition estfile_names[] = { { est_file_none, { "None" }}, { est_file_track, { "Track", "track" }}, { est_file_wave, { "wave" }}, { est_file_label, { "label" }}, { est_file_utterance, { "utterance" }}, { est_file_fmatrix, { "fmatrix" }}, { est_file_fvector, { "fvector" }}, { est_file_dmatrix, { "dmatrix" }}, { est_file_dvector, { "dvector" }}, { est_file_feature_data, { "feature_data" }}, { est_file_fst, { "fst" }}, { est_file_ngram, { "ngram" }}, { est_file_index, { "index" }}, { est_file_f_catalogue, { "f_catalogue" }}, { est_file_unknown, { "unknown" }}, { est_file_none, { "None" }}, }; EST_TNamedEnum EstFileEnums(estfile_names); #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" template class EST_TNamedEnum; template class EST_TNamedEnumI; template class EST_TValuedEnum; template class EST_TValuedEnumI; #endif /** Read and parse the header of an EST_File - interim version returning features rather than EST_Option */ EST_read_status read_est_header(EST_TokenStream &ts, EST_Features &hinfo, bool &ascii, EST_EstFileType &t) { EST_String k, v; char magic_number[9]; int pos; // read initial file type identifier, can't use peek or get // as that could read *way* too far if it's binary so just read // the first n bytes to change the magic number pos = ts.tell(); if ((ts.fread(magic_number,sizeof(char),8) != 8) || (strncmp(magic_number,"EST_File",8) != 0)) { ts.seek(pos); return wrong_format; } v = ts.get().string(); t = EstFileEnums.token(v); if (t == est_file_none) { // Its not a standardly defined type but did have EST_File on // it so accept it but set FileType in the header info t = est_file_unknown; hinfo.set("FileType", v); } while ((!ts.eof()) && (ts.peek().string() != "EST_Header_End")) { // note this *must* be done using temporary variables k = ts.get().string(); v = ts.get_upto_eoln().string(); if (v.contains(RXwhite, 0)) v = v.after(RXwhite); hinfo.set(k, v); } if (ts.eof()) { cerr << "Unexpected end of EST_File" << endl; return misc_read_error; } ts.get().string(); // read control EST_Header_End // If it explicitly says binary it is, otherwise its ascii if (hinfo.S("DataType") == "binary") ascii = false; else ascii = true; return format_ok; } EST_read_status read_est_header(EST_TokenStream &ts, EST_Option &hinfo, bool &ascii, EST_EstFileType &t) { EST_String k, v; char magic_number[9]; int pos; // read initial file type identifier, can't use peek or get // as that could read *way* too far if it's binary so just read // the first n bytes to change the magic number pos = ts.tell(); if ((ts.fread(magic_number,sizeof(char),8) != 8) || (strncmp(magic_number,"EST_File",8) != 0)) { ts.seek(pos); return wrong_format; } v = ts.get().string(); t = EstFileEnums.token(v); if (t == est_file_none) { // Its not a standardly defined type but did have EST_File on // it so accept it but set FileType in the header info t = est_file_unknown; hinfo.add_item("FileType",v); } while ((!ts.eof()) && (ts.peek().string() != "EST_Header_End")) { // note this *must* be done using temporary variables k = ts.get().string(); v = ts.get_upto_eoln().string(); if (v.contains(RXwhite, 0)) v = v.after(RXwhite); hinfo.add_item(k, v); } if (ts.eof()) { cerr << "Unexpected end of EST_File" << endl; return misc_read_error; } ts.get().string(); // read control EST_Header_End // If it explicitly says binary it is, otherwise its ascii if (hinfo.sval("DataType",0) == "binary") ascii = false; else ascii = true; return format_ok; } speech_tools/utils/EST_ServiceTable.cc0000644000076400007640000002255110625275170016425 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Table of known services. */ /* */ /*************************************************************************/ #include #include #include #include using namespace std; #include "EST_Pathname.h" #include "EST_socket.h" #include "EST_error.h" #include "EST_Token.h" #include "EST_ServiceTable.h" #if defined(SYSTEM_IS_WIN32) # define seed_random() srand((unsigned)time(NULL)) # define get_random() rand() #else # define seed_random() srandom(time(NULL)); # define get_random() random() #endif #if defined(__sun__) && defined(__sparc__) && defined(__svr4__) /* Solaris */ extern "C" { long random(); #if defined(older_solaris) int srandom( unsigned seed); int gethostname(char *name, int namelen); #endif } #endif EST_ServiceTable::EntryTable EST_ServiceTable::entries; bool EST_ServiceTable::random_init=FALSE; void EST_ServiceTable::init_random(void) { if (!random_init) { random_init=TRUE; seed_random(); } } bool operator == (const EST_ServiceTable::Entry &a, const EST_ServiceTable::Entry &b) { return &a == &b; } EST_ServiceTable::Entry::Entry() { name=""; type=""; hostname=""; address=""; cookie=""; port=0; } EST_ServiceTable::Entry::operator EST_String() const { return EST_String::cat("{ ServiceTable entry ", type, ":", name, " }"); } void EST_ServiceTable::read_table(EST_String socketsFileName) { EST_TokenStream str; FILE *sfile; if ((sfile = fopen(socketsFileName, "r"))==NULL) return; if (str.open(sfile, 1)) EST_sys_error("Can't access fringe file '%s'", (const char *)socketsFileName); str.set_SingleCharSymbols("(){}[]#=."); while(!str.eof()) { EST_Token tok = str.get(); if (tok == "#") { str.get_upto_eoln(); continue; } EST_String name = tok; str.must_get("."); tok = str.get(); EST_String type = tok; str.must_get("="); EST_Token val = str.get_upto_eoln(); if (!entries.t.present(name)) { Entry newent; newent.name=name; entries.t.add_item(name, newent); } Entry &entry = entries.t.val(name); if (type=="host") entry.hostname=(EST_String)val; else if (type=="address") entry.address=(EST_String)val; else if (type=="type") entry.type=(EST_String)val; else if (type=="port") entry.port=val; else if (type=="cookie") entry.cookie=(EST_String)val; else EST_warning("Unknown entry field '%s' at %s", (const char *)type, (const char *)str.pos_description()); } str.close(); } void EST_ServiceTable::write_table(EST_String filename) { FILE *f; if ((f=fopen(filename, "w"))==NULL) EST_sys_error("can't write serice file"); fprintf(f, "#Services\n"); EntryTable::Entries p; for(p.begin(entries.t); p ; ++p) { const EST_String &name = p->k; const Entry &entry = p->v; fprintf(f, "%s.type=%s\n", (const char *)name, (const char *)entry.type); fprintf(f, "%s.cookie=%s\n", (const char *)name, (const char *)entry.cookie); fprintf(f, "%s.host=%s\n", (const char *)name, (const char *)entry.hostname); fprintf(f, "%s.address=%s\n", (const char *)name, (const char *)entry.address); fprintf(f, "%s.port=%d\n", (const char *)name, entry.port); } fclose(f); } void EST_ServiceTable::read_table() { EST_Pathname socketsFileName(getenv("HOME")?getenv("HOME"):"/"); socketsFileName += ".estServices"; read_table(socketsFileName); } void EST_ServiceTable::write_table() { EST_Pathname socketsFileName(getenv("HOME")?getenv("HOME"):"/"); socketsFileName += ".estServices"; write_table(socketsFileName); } void EST_ServiceTable::list(ostream &s, const EST_String type) { EntryTable::KeyEntries keys(entries.t); char buff[31]; s << "Known names:"; while(keys.has_more_elements()) { EST_String key = keys.next_element(); s << " " << key; } s << "\n\n"; if (type != "") s << "Entries of type " << type << ":\n"; EntryTable::Entries them; //fmtflags old=s.flags(); s.setf(ios::left); // (problems with iomanip in gcc-2.95.1 require oldfashioned solutions) s << " "; sprintf(buff,"%10s","Name"); s << buff; sprintf(buff,"%30s"," Hostname"); s << buff; sprintf(buff,"%20s"," IP Address"); s << buff; sprintf(buff,"%5s\n","Port"); s << buff; for(them.begin(entries.t); them; them++) { const Entry &entry = them->v; if (type != "" && entry.type != type) continue; s << " "; sprintf(buff,"%10s",(const char *)entry.name); s << buff; sprintf(buff,"%30s",(const char *)entry.hostname); s << buff; sprintf(buff,"%20s",(const char *)entry.address); s << buff; s << entry.port << "\n"; } // s.flags(old); } void EST_ServiceTable::names(EST_TList &names, const EST_String type) { names.clear(); EntryTable::Entries them; for(them.begin(entries.t); them; them++) if (type=="" || type == them->v.name) names.append(them->k); } const EST_ServiceTable::Entry &EST_ServiceTable::lookup(const EST_String name, const EST_String type) { if (entries.t.present(name)) { Entry &entry = entries.t.val(name); if (entry.type == type) return entry; } return *(entries.t.default_val); } const EST_ServiceTable::Entry &EST_ServiceTable::create(const EST_String name, const EST_String type, int socket) { init_random(); Entry entry; long cookie = get_random(); struct sockaddr_in sin; socklen_t size=sizeof(struct sockaddr_in); // This only gets the port number if (getsockname(socket, (struct sockaddr *)&sin, &size) != 0) EST_sys_error("Can't find my address"); // We have to get an address by looking ourselves up. char myname[100]; gethostname(myname, 100); struct hostent *hent = gethostbyname(myname); if (hent == NULL) EST_sys_error("Can't look up my address"); // Arbitrarily choose the first address. if (hent->h_addr_list != NULL) memcpy(&(sin.sin_addr.s_addr),hent->h_addr_list[0], sizeof (sin.sin_addr.s_addr)); EST_String address= inet_ntoa(sin.sin_addr); entry.name = name; entry.type = type; entry.cookie = EST_String::Number(cookie); entry.port = ntohs(sin.sin_port); entry.address = address; entry.hostname = hent->h_name; entries.t.add_item(name, entry); return entries.t.val(name); } Declare_KVL_T(EST_String, EST_ServiceTable::Entry, EST_String_ST_entry) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" #include "../base_class/EST_TKVL.cc" Instantiate_KVL_T(EST_String, EST_ServiceTable::Entry, EST_String_ST_entry) #endif speech_tools/utils/EST_cutils.c0000644000076400007640000001176411060241417015210 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black and Paul Taylor */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* Various Low level C utilities */ /* */ /*=======================================================================*/ #include #include #include #include "EST_unix.h" #include #include "EST_cutils.h" #define _S_S_S(S) #S #define STRINGIZE(S) _S_S_S(S) const char * const est_tools_version = STRINGIZE(ESTVERSION) ":" STRINGIZE(ESTSTATE) " " STRINGIZE(ESTDATE) ; const char * const est_name = STRINGIZE(ESTNAME); #ifdef ESTLIBDIRC # define ESTLIBDIR STRINGIZE(ESTLIBDIRC) #endif #ifndef ESTLIBDIR #define ESTLIBDIR "/usr/local/lib/speech_tools" #endif const char * const est_libdir = ESTLIBDIR; const char * const est_ostype = STRINGIZE(ESTOSTYPE); char *cmake_tmp_filename() { char *tdir; char fname[1024]; static int n=0; char *t1; int i,j; if (((tdir=getenv("TMPDIR")) == NULL) && ((tdir=getenv("TEMP")) == NULL) && ((tdir=getenv("TMP")) == NULL)) tdir = "/tmp"; t1 = wstrdup(tdir); /* If it contains a double quote there might be a security hole */ for (j=i=0; t1[i] != '\0'; i++) if (t1[i] != '"') t1[j++]=t1[i]; sprintf(fname,"%s/est_%05ld_%05d",t1,(long)getpid(),n++); return wstrdup(fname); } enum EST_bo_t str_to_bo(const char *boname) { /* EST_String to byte order */ if ((streq(boname,"hilo")) || (streq(boname,"big")) || (streq(boname,"MSB")) || (streq(boname,"big_endian"))) return bo_big; else if ((streq(boname,"lohi")) || (streq(boname,"little")) || (streq(boname,"LSB")) || (streq(boname,"little_endian"))) return bo_little; else if ((streq(boname,"native")) || (streq(boname,"mine"))) return (EST_BIG_ENDIAN ? bo_big : bo_little); else if ((streq(boname,"nonnative")) || (streq(boname,"other")) || (streq(boname,"wrong")) || (streq(boname,"swap")) || (streq(boname,"swapped"))) return (EST_BIG_ENDIAN ? bo_little : bo_big); else { fprintf(stderr,"Unknown byte swap format: \"%s\" assuming native\n", boname); return (EST_BIG_ENDIAN ? bo_big : bo_little); } } const char *bo_to_str(enum EST_bo_t bo) { /* byte order to str */ switch (bo) { case bo_big: return "hilo"; case bo_little: return "lohi"; default: fprintf(stderr,"Unrecognized byte order %d\n",bo); return "unrecognized"; } } speech_tools/utils/EST_error.c0000644000076400007640000001550207262616600015041 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Thu Aug 14 1997 */ /* -------------------------------------------------------------------- */ /* Fatal error calls. */ /* */ /*************************************************************************/ #include #include #include #include #include "EST_error.h" const char * EST_error_where=NULL; static char EST_error_message_buf[MAX_ERROR_MESSAGE_LENGTH]; char *EST_error_message = EST_error_message_buf; void EST_default_bug_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; if (EST_error_stream==NULL) EST_error_stream = stderr; fprintf(EST_error_stream, "-=-=-=-=-=- EST Bug! -=-=-=-=-=-\n"); if (EST_error_where) fprintf(EST_error_stream," %s\n", EST_error_where); va_start(ap, format); vsprintf(p, format, ap); va_end(ap); fprintf(EST_error_stream, "%s\n", p); fprintf(EST_error_stream, "Please report this in as much detail as possible\n to festival@cstr.ed.ac.uk\n"); putc('\n', EST_error_stream); fprintf(EST_error_stream, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); est_error_throw(); } void EST_default_error_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; if (EST_error_stream==NULL) EST_error_stream = stderr; fprintf(EST_error_stream, "-=-=-=-=-=- EST Error -=-=-=-=-=-\n"); if (EST_error_where) fprintf(EST_error_stream," %s\n", EST_error_where); va_start(ap, format); vsprintf(p, format, ap); va_end(ap); fprintf(EST_error_stream, "%s\n", p); fprintf(EST_error_stream, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); est_error_throw(); } void EST_quiet_error_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; va_start(ap, format); vsprintf(p, format, ap); va_end(ap); est_error_throw(); } void EST_default_warning_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; if (EST_warning_stream==NULL) EST_warning_stream = stderr; fprintf(EST_warning_stream, "-=-=-=-=-=- EST Warning -=-=-=-=-=-\n"); if (EST_error_where) fprintf(EST_warning_stream," %s\n", EST_error_where); va_start(ap, format); vsprintf(p, format, ap); va_end(ap); fprintf(EST_warning_stream, "%s\n", p); fprintf(EST_warning_stream, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); } void EST_quiet_warning_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; va_start(ap, format); vsprintf(p, format, ap); va_end(ap); } void EST_default_sys_error_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; const char *msg = strerror(errno); if (EST_error_stream==NULL) EST_error_stream = stderr; fprintf(EST_error_stream, "-=-=-=-=-=- EST IO Error -=-=-=-=-\n"); if (EST_error_where) fprintf(EST_error_stream," %s\n", EST_error_where); va_start(ap, format); vsprintf(p, format, ap); va_end(ap); fprintf(EST_error_stream, "%s - %s\n", p, msg); fprintf(EST_error_stream, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); est_error_throw(); } void EST_quiet_sys_error_fn(const char *format, ...) { va_list ap; char *p=EST_error_message; const char *msg = strerror(errno); va_start(ap, format); vsprintf(p, format, ap); va_end(ap); while (*p) ++p; strcat(p, " - "); p+=3; strcat(p, msg); est_error_throw(); } void EST_errors_default() { EST_bug_func = EST_default_bug_fn; EST_error_func = EST_default_error_fn; EST_sys_error_func = EST_default_sys_error_fn; } void EST_errors_quiet() { EST_bug_func = EST_default_bug_fn; EST_error_func = EST_quiet_error_fn; EST_sys_error_func = EST_quiet_sys_error_fn; } EST_error_handler EST_bug_func = EST_default_bug_fn; EST_error_handler EST_error_func = EST_default_error_fn; EST_error_handler EST_sys_error_func = EST_default_sys_error_fn; EST_error_handler EST_warning_func = EST_default_warning_fn; EST_error_handler old_error_function; EST_error_handler old_sys_error_function; FILE *EST_error_stream=NULL; FILE *EST_warning_stream=NULL; jmp_buf *est_errjmp = 0; long errjmp_ok=0; speech_tools/utils/walloc.c0000644000076400007640000001156110272257650014460 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Apr 9 1997 */ /************************************************************************/ /* */ /* Allocation routines which check for errors. */ /* */ /************************************************************************/ #include #include #include #include "EST_unix.h" #include #include "EST_cutils.h" /* #define CST_DEBUG_MALLOC 1 */ #ifdef CST_DEBUG_MALLOC /* use the debug malloc in flite */ #include "cst_alloc.h" void *safe_walloc(int size) { return cst_safe_alloc(size); } void *safe_wrealloc(void *ptr, int size) { return cst_safe_realloc(ptr,size); } void *safe_wcalloc(int size) { return cst_safe_calloc(size); } void wfree(void *p) { cst_free(p); return; } char *wstrdup(const char *s) { char *t = cst_alloc(char,strlen(s)+1); strcpy(t,s); return t; } void debug_memory_summary(void) { cst_alloc_debug_summary(); } #else void *safe_walloc(int size) { char *p; if (size == 0) /* Some mallocs return NULL for size 0, which means you can't tell if it failed or not. So we'll avoid that problem by never asking for 0 bytes */ p = calloc(1,1); else p = calloc(size,1); if (p == NULL) { fprintf(stderr,"WALLOC: failed to malloc %d bytes\n",size); exit(-1); /* I'd rather not do this but this is the only safe */ /* thing to do */ } return p; } void *safe_wrealloc(void *ptr, int size) { char *p; if (ptr == 0) p = safe_walloc(size); else if (size == 0) /* Some mallocs return NULL for size 0, which means you can't tell if it failed or not. So we'll avoid that problem by never asking for 0 bytes */ p = realloc(ptr, 1); else p = realloc(ptr, size); if ((p == NULL) && (size != 0)) { fprintf(stderr,"WREALLOC: failed to malloc %d bytes\n",size); exit(-1); /* I'd rather not do this but this is the only safe */ /* thing to do */ } return p; } void *safe_wcalloc(int size) { char *p = safe_walloc(size); memset(p,0,size); return p; } char *wstrdup(const char *s) { char *t = walloc(char,strlen(s)+1); strcpy(t,s); return t; } void wfree(void *p) { if (p != NULL) free(p); } #endif speech_tools/utils/system_specific_unix.c0000644000076400007640000000470607262605664017445 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #include "EST_system.h" int socket_initialise(void) { return 1; } speech_tools/utils/Makefile0000644000076400007640000000653710326713734014502 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for utility classes # # # #=========================================================================# TOP=.. DIRNAME=utils LOCAL_DEFAULT_LIBRARY = estbase H = TSRCS = est_file.cc EST_ServiceTable.cc CSRCS = EST_cutils.c EST_error.c walloc.c system_specific_unix.c CPPSRCS = cmd_line.cc util_io.cc filetrans.cc cmd_line_aux.cc \ EST_swapping.cc EST_Server.cc EST_FringeServer.cc $(TSRCS) SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) OBJS_eststring = walloc.o FILES = $(SRCS) $(H) Makefile system_specific_win32.c LOCAL_INCLUDES = ALL = .buildlibs include $(TOP)/config/common_make_rules EST_cutils.o: EST_cutils.c $(CC_COMMAND) -DESTNAME='$(PROJECT_NAME)' -DESTDATE='$(PROJECT_DATE)' -DESTVERSION='$(PROJECT_VERSION)' -DESTLIBDIRC='$(EST_HOME)/lib' -DESTSTATE='$(PROJECT_STATE)' -DESTOSTYPE='$(SYSTEM_TYPE)' EST_cutils.c speech_tools/utils/system_specific_win32.c0000644000076400007640000001013307610567674017420 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* functions which mimic unix system calls */ #include #include #include "EST_unix.h" #include "EST_socket.h" int unix_access(const char *file, int mode) { DWORD flags = GetFileAttributes(file); if (flags == 0xffffffff) { if (ERROR_FILE_NOT_FOUND == GetLastError()) return -1; else return 1; } if (mode==F_OK) return 0; if (mode==R_OK) return 0; if (mode==W_OK) { /* When referring to a directory, FILE_ATTRIBUTE_READONLY means the directory can't be deleted. It does not mean a file can't be written to the directory. */ if (flags|FILE_ATTRIBUTE_DIRECTORY) return 0; else return (flags|FILE_ATTRIBUTE_READONLY) != 0; } return 1; } int unix_read(HANDLE fd, char *buffer, int n) { int howmany; if (ReadFile(fd, buffer, n, &howmany, NULL)) return howmany; return -1; } char *unix_getcwd(char *buffer, int maxlength) { static char lbuffer[1024]; if (buffer==NULL) { buffer = lbuffer; maxlength=1023; } if (GetCurrentDirectory(maxlength, buffer) >=0) return buffer; return NULL; } int unix_waitpid(int pid, int *statusp, int flags) { fprintf(stderr, "waitpid not yet implemented\n"); return 0; } int unix_fork(void) { fprintf(stderr," FORK NOT YET IMPLEMENTED\n"); return -1; } static int sockets_initialised =0; int socket_initialise(void) { WORD wVersionRequested; WSADATA wsaData; int err; if (sockets_initialised) return 1; wVersionRequested = MAKEWORD( 2, 0 ); err = WSAStartup( wVersionRequested, &wsaData ); if ( err != 0 ) { printf("Socket Initialisation failed\n"); return 0; } sockets_initialised=1; return 1; } speech_tools/base_class/EST_UList.cc0000644000076400007640000002533611465017154016057 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997,1998 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Mon Jul 21 1997 */ /* -------------------------------------------------------------------- */ /* Untyped list used as the basis of the TList class */ /* */ /*************************************************************************/ #include void EST_UList::clear_and_free(void (*item_free)(EST_UItem *p)) { EST_UItem *q, *np; for (q=head(); q != 0; q = np) { np=q->next(); if (item_free) item_free(q); else delete q; } h = t = 0; } int EST_UList::length() const { EST_UItem *ptr; int n = 0; for (ptr = head(); ptr != 0; ptr = ptr->next()) ++n; return n; } int EST_UList::index(EST_UItem *item) const { EST_UItem *ptr; int n = 0; for (ptr = head(); ptr != 0; ptr = ptr->next(), ++n) if (item == ptr) return n; return -1; } EST_UItem *EST_UList::nth_pointer(int n) const { EST_UItem *ptr; int i; for (i = 0, ptr = head(); ptr != 0; ptr = ptr->next(), ++i) if (i == n) return ptr; cerr << "Requested item #" << n << " off end of list" << endl; return head(); } EST_UItem * EST_UList::remove(EST_UItem *item, void (*free_item)(EST_UItem *item)) { if (item == 0) return 0; EST_UItem *prev = item->p; if (item->p == 0) // at start h = item->n; else item->p->n = item->n; if (item->n == 0) // at end t = item->p; else item->n->p = item->p; if (free_item) free_item(item); else delete item; return prev; } EST_UItem * EST_UList::remove(int n, void (*item_free)(EST_UItem *item)) { return remove(nth_pointer(n), item_free); } // This should check if the incoming prev_item actually is in the list EST_UItem *EST_UList::insert_after(EST_UItem *prev_item, EST_UItem *new_item) { if (new_item == 0) return new_item; if (prev_item == 0) // insert it at start of list { new_item->n = h; h = new_item; } else { new_item->n = prev_item->n; prev_item->n = new_item; } new_item->p = prev_item; if (new_item->n == 0) t = new_item; else new_item->n->p = new_item; return new_item; } EST_UItem *EST_UList::insert_before(EST_UItem *next_item, EST_UItem *new_item) { if (new_item == 0) return new_item; if (next_item == 0) // put it on the end of the list { new_item->p = t; t = new_item; } else { new_item->p = next_item->p; next_item->p = new_item; } new_item->n = next_item; if (new_item->p == 0) h = new_item; else new_item->p->n = new_item; return next_item; } void EST_UList::exchange(EST_UItem *a, EST_UItem *b) { if (a==b) return; if ((a==0) || (b==0)) { cerr << "EST_UList:exchange: can't exchange NULL items" << endl; return; } // I know this isn't very readable but there are eight pointers // that need to be changed, and half of them are trivial back pointers // care need only be taken when b and a are adjacent, this actual // sets p and n twice if they are adjacent but still gets the right answer EST_UItem *ap=a->p,*an=a->n,*bn=b->n,*bp=b->p; a->n = bn == a ? b : bn; if (a->n) a->n->p = a; a->p = bp == a ? b : bp; if (a->p) a->p->n = a; b->n = an == b ? a : an; if (b->n) b->n->p = b; b->p = ap == b ? a : ap; if (b->p) b->p->n = b; // Fix t and h if (a == h) h = b; else if (b == h) h = a; else if (a == t) t = b; else if (b == t) t = a; } void EST_UList::exchange(int i, int j) { EST_UItem *p; EST_UItem *a=0,*b=0; int k; for (k=0,p = head(); p != 0; p = p->next(),k++) { if(i==k) a = p; if(j==k) b = p; } if ((a==0) || (b==0)) { cerr << "EST_UList:exchange: can't exchange items " << i << " and " << j << " (off end of list)" << endl; return; } exchange(a,b); } void EST_UList::reverse() { EST_UItem *p,*q; for (p=head(); p != 0; p=q) { q = p->n; p->n = p->p; p->p = q; } q = h; h = t; t = q; } void EST_UList::append(EST_UItem *new_item) { if (new_item == 0) return; new_item->n = 0; new_item->p = t; if (t == 0) h = new_item; else t->n = new_item; t = new_item; } void EST_UList::prepend(EST_UItem *new_item) { if (new_item == 0) return; new_item->p = 0; new_item->n = h; if (h == 0) t = new_item; else h->p = new_item; h = new_item; } bool EST_UList::operator_eq(const EST_UList &a, const EST_UList &b, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2)) { EST_UItem *p,*q; q=b.head(); for (p = a.head(); p != NULL; p = p->next()){ if(q == NULL) return false; if(eq(q, p)) q=q->next(); else return false; } if(q == NULL) return true; else return false; } int EST_UList::index(const EST_UList &l, const EST_UItem &val, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2)) { EST_UItem *ptr; int n = 0; for (ptr = l.head(); ptr != 0; ptr = ptr->next(), ++n) if (eq(&val,ptr)) return n; return -1; } void EST_UList::sort(EST_UList &l, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2)) { // just bubble sort for now // use EST_String::operator > for comparisons EST_UItem *l_ptr,*m_ptr; bool sorted=false; while(!sorted){ sorted=true; for(l_ptr=l.head(); l_ptr != 0; l_ptr=l_ptr->next()){ m_ptr=l_ptr->next(); if(m_ptr != 0) if(gt(l_ptr, m_ptr)){ l.exchange(l_ptr,m_ptr); sorted=false; } } } } // quicksort from 'Algorithms' // by Cormen, Leiserson & Rivest static EST_UItem *partition(EST_UItem *p, EST_UItem *r, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*exchange)(EST_UItem *item1, EST_UItem *item2)) { // this can be tidied up / sped up EST_UItem *i,*j,*i2,*j2; EST_UItem *x = p; i = p; j = r; while(true){ while(gt(j, x) ) j = j->prev(); while(gt(x, i)) i = i->next(); if((i != j) && (i->prev() != j)){ i2=i; j2=j; i=i->next(); j=j->prev(); exchange(i2,j2); }else return j; } return NULL; } static void qsort_sub(EST_UList &l, EST_UItem *p, EST_UItem *r, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*exchange)(EST_UItem *item1, EST_UItem *item2)) { EST_UItem *q; if(p != r){ q = partition(p,r, gt, exchange); qsort_sub(l,p,q, gt, exchange); qsort_sub(l,q->next(),r, gt, exchange); } } void EST_UList::qsort(EST_UList &l, bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*exchange)(EST_UItem *item1, EST_UItem *item2)) { qsort_sub(l,l.head(),l.tail(), gt, exchange); } void EST_UList::sort_unique(EST_UList &l, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2), bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*item_free)(EST_UItem *item)) { // as sort(..) but delete any repeated items EST_UItem *l_ptr,*m_ptr; bool sorted=false; while(!sorted){ sorted=true; for(l_ptr=l.head(); l_ptr != 0; l_ptr=l_ptr->next()){ m_ptr=l_ptr->next(); if(m_ptr != 0) { if(gt(l_ptr, m_ptr)){ l.exchange(l_ptr,m_ptr); sorted=false; } else if(eq(l_ptr, m_ptr)){ l.remove(m_ptr, item_free); sorted=false; } } } } } void EST_UList::merge_sort_unique(EST_UList &l, EST_UList &m, bool (*eq)(const EST_UItem *item1, const EST_UItem *item2), bool (*gt)(const EST_UItem *item1, const EST_UItem *item2), void (*item_free)(EST_UItem *item)) { // keep all unique items in l, and add any new items from m to l EST_UItem *l_ptr,*m_ptr; bool flag; // make sure sort_unique(l, eq, gt, item_free); for(m_ptr=m.head(); m_ptr != 0; m_ptr=m_ptr->next()){ // try and put item from m in list flag=false; for(l_ptr=l.head(); l_ptr != 0; l_ptr=l_ptr->next()){ if( gt(l_ptr, m_ptr) ){ l.insert_before(l_ptr, m_ptr); flag=true; break; }else if( eq(m_ptr, l_ptr) ){ flag=true; break; } } // or try and append it if(!flag && ( gt(m_ptr, l.tail()) ) ) l.append(m_ptr); } } speech_tools/base_class/EST_Option.cc0000644000076400007640000001446211465017154016265 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* EST_Option Class */ /* */ /*=======================================================================*/ #include #include "EST_Option.h" #include "EST_io_aux.h" #include "EST_Token.h" static const EST_String Empty_String(""); // Fills in keyval pair. If Key already exists, overwrites value. int EST_Option::override_val(const EST_String rkey, const EST_String rval) { if (rval == "") return 0; return add_item(rkey, rval); } int EST_Option::override_fval(const EST_String rkey, const float rval) { EST_String tmp; char ctmp[100]; sprintf(ctmp, "%f", rval); tmp = ctmp; return override_val(rkey, tmp); } int EST_Option::override_ival(const EST_String rkey, const int rval) { EST_String tmp; char ctmp[100]; sprintf(ctmp, "%d", rval); tmp = ctmp; return override_val(rkey, tmp); } int EST_Option::ival(const EST_String &rkey, int must) const { const EST_String &tval = val_def(rkey, Empty_String); if (tval != "") return atoi(tval); if (must) cerr << "EST_Option: No value set for " << rkey << endl; return 0; } const EST_String &EST_Option::sval(const EST_String &rkey, int must) const { const EST_String &tval = val_def(rkey, Empty_String); if (tval != Empty_String) return tval; if (must) cerr << "EST_Option: No value set for " << rkey << endl; return Empty_String; } float EST_Option::fval(const EST_String &rkey, int must) const { const EST_String &tval = val_def(rkey, Empty_String); if (tval != Empty_String) return atof(tval); if (must) cerr << "EST_Option: No value set for " << rkey << endl; return 0.0; } double EST_Option::dval(const EST_String &rkey, int must) const { const EST_String &tval = val_def(rkey,Empty_String); if (tval != Empty_String) return atof(tval); if (must) cerr << "EST_Option: No value set for " << rkey << endl; return 0.0; } int EST_Option::add_iitem(const EST_String &rkey, const int &rval) { char tmp[100]; sprintf(tmp, "%d", rval); return add_item(rkey, tmp); } int EST_Option::add_fitem(const EST_String &rkey, const float &rval) { char tmp[100]; sprintf(tmp, "%f", rval); return add_item(rkey, tmp); } // load in Options from files. This function has a recursive include // facility fpr reading nested files. Maybe there should be a check on // the max number of allowable open files. EST_read_status EST_Option::load(const EST_String &filename, const EST_String &comment) { EST_TokenStream ts; EST_String k, v; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open EST_Option input file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream while(!ts.eof()) { k = ts.get().string(); v = ts.get_upto_eoln().string(); if (v.contains(RXwhite, 0)) v = v.after(RXwhite); if (k.contains("#include")) //recursively load additional files { cout << "Include directive\n"; this->load(v); } if (!k.contains(comment, 0)) add_item(k, v, 0); // e a search is required. } return format_ok; } void EST_Option::add_prefix(EST_String prefix) { EST_Litem *ptr; for (ptr = list.head(); ptr; ptr = ptr->next()) change_key(ptr, prefix + key(ptr)); } void EST_Option::remove_prefix(EST_String prefix) { (void)prefix; } ostream& operator << (ostream& s, const EST_Option &kv) { EST_Litem *ptr; for (ptr = kv.list.head(); ptr; ptr = ptr->next()) s << kv.key(ptr) << "\t" << kv.val((EST_Litem *)ptr) << endl; return s; } speech_tools/base_class/EST_StringTrie.cc0000644000076400007640000001307210127000717017072 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* A class for building EST_String (char-based) tries for indexing */ /* arbitrary objects by Strings */ /* */ /*=======================================================================*/ #include "EST_String.h" #include "EST_StringTrie.h" #include #define TRIEWIDTH 256 static void (* trie_delete_function)(void *n) = 0; static inline int char2idx(unsigned char k) { // return k & 0x7f; // only seven significant bits; return k; } EST_TrieNode::EST_TrieNode(const int width) { // Initialise a node of given width w=width; d= new EST_TrieNode *[w]; contents=0; memset(d,0,w*sizeof(EST_TrieNode *)); } EST_TrieNode::~EST_TrieNode() { int i; if (trie_delete_function != 0) /* user supplied delete function */ trie_delete_function(contents); for (i=0; ilookup(key+1); } } void EST_TrieNode::copy_into(EST_StringTrie &trie, const EST_String &path) const { // find all items and add them to trie if (contents != 0) trie.add(path,contents); for (int i=0; i < w; i++) { if (d[i] != 0) { char tail[2]; tail[0] = (char)i; tail[1] = '\0'; d[i]->copy_into(trie,path+tail); } } } void EST_TrieNode::add(const unsigned char *key,void *value) { // add this value if (*key == '\0') contents = value; else { int idx = char2idx(*key); if (d[idx] == 0) // need new subnode d[idx] = new EST_TrieNode(w); d[idx]->add(key+1,value); } } EST_StringTrie::EST_StringTrie() { tree = new EST_TrieNode(TRIEWIDTH); } void EST_StringTrie::copy(const EST_StringTrie &trie) { // This can't work because of the void* pointers in contents delete tree; tree = new EST_TrieNode(TRIEWIDTH); trie.tree->copy_into(*this,""); } EST_StringTrie::~EST_StringTrie() { delete tree; } void *EST_StringTrie::lookup(const EST_String &key) const { const unsigned char *ckey = (const unsigned char *)(void *)(const char *)key; return tree->lookup(ckey); } void EST_StringTrie::add(const EST_String &key,void *item) { const unsigned char *ckey = (const unsigned char *)(void *)(const char *)key; tree->add(ckey,item); return; } void EST_StringTrie::clear(void) { delete tree; tree = new EST_TrieNode(TRIEWIDTH); } void EST_StringTrie::clear(void (*deletenode)(void *n)) { // This wont work if we go multi-thread trie_delete_function = deletenode; delete tree; trie_delete_function = 0; tree = new EST_TrieNode(TRIEWIDTH); } speech_tools/base_class/EST_Token.cc0000644000076400007640000005131711367067245016104 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : April 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* A Tokenize class, both for Tokens (Strings plus alpha) */ /* EST_TokenStream for strings, FILE *, files, pipes etc */ /* */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include #include #include "EST_math.h" #include "EST_Token.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_error.h" const EST_String EST_Token_Default_WhiteSpaceChars = " \t\n\r"; const EST_String EST_Token_Default_SingleCharSymbols = "(){}[]"; const EST_String EST_Token_Default_PrePunctuationSymbols = "\"'`({["; const EST_String EST_Token_Default_PunctuationSymbols = "\"'`.,:;!?]})"; const EST_String Token_Origin_FD = "existing file descriptor"; const EST_String Token_Origin_Stream = "existing istream"; const EST_String Token_Origin_String = "existing string"; static EST_Regex RXanywhitespace("[ \t\n\r]"); static inline char *check_extend_str_in(char *str, int pos, int *max) { // Check we are not at the end of the string, if so get some more // and copy the old one into the new one char *newstuff; if (pos >= *max) { if (pos > *max) *max = 2 * pos; else *max *= 2; newstuff = new char[*max]; strncpy(newstuff,str,pos); delete [] str; return newstuff; } else return str; } #define check_extend_str(STR, POS, MAX) \ (((POS)>= *(MAX))?check_extend_str_in((STR),(POS),(MAX)):(STR)) ostream& operator<<(ostream& s, const EST_Token &p) { s << "[TOKEN " << p.pname << "]"; return s; } EST_Token &EST_Token::operator = (const EST_Token &a) { linenum = a.linenum; linepos = a.linepos; p_filepos = a.p_filepos; p_quoted = a.p_quoted; space = a.space; prepunc = a.prepunc; pname = a.pname; punc = a.punc; return *this; } const EST_String EST_Token::pos_description() const { return "line "+itoString(linenum)+" char "+itoString(linepos); } EST_Token &EST_Token::operator = (const EST_String &a) { pname = a; return *this; } EST_TokenStream::EST_TokenStream() { tok_wspacelen = 64; // will grow if necessary tok_wspace = new char[tok_wspacelen]; tok_stufflen = 512; // will grow if necessary tok_stuff = new char[tok_stufflen]; tok_prepuncslen = 32; // will grow if necessary tok_prepuncs = new char[tok_prepuncslen]; default_values(); } EST_TokenStream::EST_TokenStream(EST_TokenStream &s) { (void)s; cerr << "TokenStream: warning passing TokenStream not as reference" << endl; // You *really* shouldn't use this AT ALL unless you // fully understand its consequences, you'll be copying open // files and moving file pointers all over the place // basically *DON'T* do this, pass the stream by reference // Now there may be occasions when you do want to do this for example // when you need to do far look ahead or check point as you read // but they are obscure and I'm not sure how to do that for all // the file forms supported by the TokenStream. If you do // I can write a clone function that might do it. } void EST_TokenStream::default_values() { type = tst_none; peeked_tokp = FALSE; peeked_charp = FALSE; eof_flag = FALSE; quotes = FALSE; p_filepos = 0; linepos = 1; WhiteSpaceChars = EST_Token_Default_WhiteSpaceChars; SingleCharSymbols = EST_String::Empty; PrePunctuationSymbols = EST_String::Empty; PunctuationSymbols = EST_String::Empty; build_table(); close_at_end=TRUE; } EST_TokenStream::~EST_TokenStream() { if (type != tst_none) close(); delete [] tok_wspace; delete [] tok_stuff; delete [] tok_prepuncs; } ostream& operator<<(ostream& s, EST_TokenStream &p) { s << "[TOKENSTREAM "; switch (p.type) { case tst_none: cerr << "UNSET"; break; case tst_file: cerr << "FILE"; break; case tst_pipe: cerr << "PIPE"; break; case tst_istream: cerr << "ISTREAM"; break; case tst_string: cerr << "STRING"; break; default: cerr << "UNKNOWN" << endl; } s << "]"; return s; } int EST_TokenStream::open(const EST_String &filename) { if (type != tst_none) close(); default_values(); fp = fopen(filename,"rb"); if (fp == NULL) { cerr << "Cannot open file " << filename << " as tokenstream" << endl; return -1; } Origin = filename; type = tst_file; return 0; } int EST_TokenStream::open(FILE *ofp, int close_when_finished) { // absorb already open stream if (type != tst_none) close(); default_values(); fp = ofp; if (fp == NULL) { cerr << "Cannot absorb NULL filestream as tokenstream" << endl; return -1; } Origin = Token_Origin_FD; type = tst_file; close_at_end = close_when_finished; return 0; } int EST_TokenStream::open(istream &newis) { // absorb already open istream if (type != tst_none) close(); default_values(); is = &newis; Origin = Token_Origin_Stream; type = tst_istream; return 0; } int EST_TokenStream::open_string(const EST_String &newbuffer) { // Make a tokenstream from an internal existing string/buffer const char *buf; if (type != tst_none) close(); default_values(); buf = (const char *)newbuffer; buffer_length = newbuffer.length(); buffer = new char[buffer_length+1]; memmove(buffer,buf,buffer_length+1); pos = 0; Origin = Token_Origin_String; type = tst_string; return 0; } int EST_TokenStream::seek_end() { // This isn't actually useful but people expect it peeked_charp = FALSE; peeked_tokp = FALSE; switch (type) { case tst_none: cerr << "EST_TokenStream unset" << endl; return -1; break; case tst_file: fseek(fp,0,SEEK_END); p_filepos = ftell(fp); return p_filepos; case tst_pipe: cerr << "EST_TokenStream seek on pipe not supported" << endl; return -1; break; case tst_istream: cerr << "EST_TokenStream seek on istream not yet supported" << endl; return -1; break; case tst_string: pos = buffer_length; return pos; default: cerr << "EST_TokenStream: unknown type" << endl; return -1; } return -1; // can't get here } int EST_TokenStream::seek(int position) { peeked_charp = FALSE; peeked_tokp = FALSE; switch (type) { case tst_none: cerr << "EST_TokenStream unset" << endl; return -1; break; case tst_file: p_filepos = position; return fseek(fp,position,SEEK_SET); case tst_pipe: cerr << "EST_TokenStream seek on pipe not supported" << endl; return -1; break; case tst_istream: cerr << "EST_TokenStream seek on istream not yet supported" << endl; return -1; break; case tst_string: if (position >= pos) { pos = position; return -1; } else { pos = position; return 0; } break; default: cerr << "EST_TokenStream: unknown type" << endl; return -1; } return -1; // can't get here } static int stdio_fread(void *buff,int size,int nitems,FILE *fp) { // So it can find the stdio one rather than the TokenStream one return fread(buff,size,nitems,fp); } int EST_TokenStream::fread(void *buff, int size, int nitems) { // switching into binary mode for current position int items_read; // so we can continue to read afterwards if (peeked_tokp) { cerr << "ERROR " << pos_description() << " peeked into binary data" << endl; return 0; } peeked_charp = FALSE; peeked_tokp = FALSE; switch (type) { case tst_none: cerr << "EST_TokenStream unset" << endl; return 0; break; case tst_file: items_read = stdio_fread(buff,(size_t)size,(size_t)nitems,fp); p_filepos += items_read*size; return items_read; case tst_pipe: cerr << "EST_TokenStream fread pipe not yet supported" << endl; return 0; break; case tst_istream: cerr << "EST_TokenStream fread istream not yet supported" << endl; return 0; case tst_string: if ((buffer_length-pos)/size < nitems) items_read = (buffer_length-pos)/size; else items_read = nitems; memcpy(buff,&buffer[pos],items_read*size); pos += items_read*size; return items_read; default: cerr << "EST_TokenStream: unknown type" << endl; return EOF; } return 0; // can't get here } void EST_TokenStream::close(void) { // close any files (if they were used) switch (type) { case tst_none: break; case tst_file: if (close_at_end) fclose(fp); case tst_pipe: // close(fd); break; case tst_istream: break; case tst_string: delete [] buffer; buffer = 0; break; default: cerr << "EST_TokenStream: unknown type" << endl; break; } type = tst_none; peeked_charp = FALSE; peeked_tokp = FALSE; } int EST_TokenStream::restart(void) { // For paul, the only person I know who uses this switch (type) { case tst_none: break; case tst_file: fp = freopen(Origin,"rb",fp); p_filepos = 0; break; case tst_pipe: cerr << "EST_TokenStream: can't rewind pipe" << endl; return -1; break; case tst_istream: cerr << "EST_TokenStream: can't rewind istream" << endl; break; case tst_string: pos = 0; break; default: cerr << "EST_TokenStream: unknown type" << endl; break; } linepos = 1; peeked_charp = FALSE; peeked_tokp = FALSE; eof_flag = FALSE; return 0; } EST_TokenStream & EST_TokenStream::operator >>(EST_Token &p) { return get(p); } EST_TokenStream & EST_TokenStream::operator >>(EST_String &p) { EST_Token t; get(t); p = t.string(); return *this; } EST_TokenStream &EST_TokenStream::get(EST_Token &tok) { tok = get(); return *this; } EST_Token EST_TokenStream::get_upto(const EST_String &s) { // Returns a concatenated token form here to next symbol that matches s // including s (though not adding s on the result) // Not really for the purist but lots of times very handy // Note this is not very efficient EST_String result; EST_Token t; for (result=EST_String::Empty; (t=get()) != s; ) { result += t.whitespace() + t.prepunctuation() + t.string() + t.punctuation(); if (eof()) { cerr << "EST_TokenStream: end of file when looking for \"" << s << "\"" << endl; break; } } return EST_Token(result); } EST_Token EST_TokenStream::get_upto_eoln(void) { // Swallow the lot up to end of line // assumes \n is a whitespace character EST_String result(EST_String::Empty); while (!eoln()) { EST_Token &t=get(); result += t.whitespace() + t.prepunctuation(); if (quotes) result += quote_string(t.string()); else result += t.string(); result += t.punctuation(); if (eof()) { // cerr << "EST_TokenStream: end of file when looking for end of line" // << endl; break; } } // So that the next call works I have to step over the eoln condition // That involves removing the whitespace upto and including the next // \n in the peek token. char *w = wstrdup(peek().whitespace()); int i; for (i=0; w[i] != 0; i++) if (w[i] == '\n') // maybe not portable peek().set_whitespace(&w[i+1]); wfree(w); static EST_Token result_t; result_t.set_token(result); return result_t; } EST_Token &EST_TokenStream::must_get(EST_String expected, bool *ok) { EST_Token &tok = get(); if (tok != expected) { if (ok != NULL) { *ok=FALSE; return tok; } else EST_error("Expected '%s' got '%s' at %s", (const char *)expected, (const char *)(EST_String)tok, (const char *)pos_description()); } if (ok != NULL) *ok=TRUE; return tok; } void EST_TokenStream::build_table() { int i; const char *p; unsigned char c; for (i=0; i<256; ++i) p_table[i]=0; for (p=WhiteSpaceChars; *p; ++p) if (p_table[c=(unsigned char)*p]) EST_warning("Character '%c' has two classes, '%c' and '%c'", *p, c, ' '); else p_table[c] = ' '; for (p=SingleCharSymbols; *p; ++p) if (p_table[c=(unsigned char)*p]) EST_warning("Character '%c' has two classes, '%c' and '%c'", *p, p_table[c], '!'); else p_table[c] = '@'; for (p=PunctuationSymbols; *p; ++p) if (p_table[c=(unsigned char)*p] == '@') continue; else if (p_table[c]) EST_warning("Character '%c' has two classes, '%c' and '%c'", *p, p_table[c], '.'); else p_table[c] = '.'; for(p=PrePunctuationSymbols; *p; ++p) if (p_table[c=(unsigned char)*p] == '@') continue; else if (p_table[c] == '.') p_table[c] = '"'; else if (p_table[c]) EST_warning("Character '%c' has two classes, '%c' and '%c'", *p, p_table[c], '$'); else p_table[c] = '$'; p_table_wrong=0; } inline int EST_TokenStream::getpeeked_internal(void) { peeked_charp = FALSE; return peeked_char; } inline int EST_TokenStream::getch_internal() { // Return next character in stream if (EST_TokenStream::peeked_charp) { return getpeeked_internal(); } switch (type) { case tst_none: cerr << "EST_TokenStream unset" << endl; return EOF; break; case tst_file: p_filepos++; { char lc; if (stdio_fread(&lc,1,1,fp) == 0) return EOF; else return (int)lc; } /* return getc(fp); */ case tst_pipe: cerr << "EST_TokenStream pipe not yet supported" << endl; return EOF; break; case tst_istream: p_filepos++; return is->get(); case tst_string: if (pos < buffer_length) { p_filepos++; return buffer[pos++]; } else return EOF; default: cerr << "EST_TokenStream: unknown type" << endl; return EOF; } return EOF; // can't get here } int EST_TokenStream::getch(void) { return getch_internal(); } inline int EST_TokenStream::peekch_internal() { // Return next character in stream (without reading it) if (!peeked_charp) peeked_char = getch_internal(); peeked_charp = TRUE; return peeked_char; } int EST_TokenStream::peekch(void) { return peekch_internal(); } #define CLASS(C,CL) (p_table[(unsigned char)(C)]==(CL)) #define CLASS2(C,CL1,CL2) (p_table[(unsigned char)(C)]==(CL1)||p_table[(unsigned char)(C)]==(CL2)) EST_Token &EST_TokenStream::get(void) { if (peeked_tokp) { peeked_tokp = FALSE; return current_tok; } if (p_table_wrong) build_table(); char *word; int c,i,j; for (i=0; (CLASS(c=getch_internal(),' ') && ( c != EOF )); i++) { if (c == '\n') linepos++; tok_wspace = check_extend_str(tok_wspace,i,&tok_wspacelen); tok_wspace[i] = c; } tok_wspace[i] = '\0'; current_tok.init(); if (c != EOF) { current_tok.set_filepos(p_filepos-1); if ((quotes) && // quoted strings (with escapes) are allowed (c == quote)) { for (i=0; ((c = getch_internal()) != EOF) ;) { if (c == quote) break; tok_stuff = check_extend_str(tok_stuff,i,&tok_stufflen); if (c == escape) c = getch_internal(); tok_stuff[i++] = c; } current_tok.set_quoted(TRUE); } else // standard whitespace separated tokens { for (i=0,tok_stuff[i++]=c; ( !CLASS(c,'@') && !CLASS(c=peekch_internal(),' ') && !CLASS(c,'@') && ( c != EOF )) ;) { tok_stuff = check_extend_str(tok_stuff,i,&tok_stufflen); // note, we must have peeked to get here. tok_stuff[i++] = getpeeked_internal(); } } tok_stuff[i] = '\0'; // Are there any punctuation symbols at the start? for (j=0; ((j < i) && CLASS2(tok_stuff[j], '$', '"')); j++); if ((j > 0) && (j < i)) // there are { tok_prepuncs = check_extend_str(tok_prepuncs,j+1,&tok_prepuncslen); memmove(tok_prepuncs,tok_stuff,j); tok_prepuncs[j] = '\0'; current_tok.set_prepunctuation(tok_prepuncs); word=&tok_stuff[j]; i-=j; // reduce size by number of prepuncs } else { current_tok.set_prepunctuation(EST_String::Empty); word = tok_stuff; } // Are there any punctuation symbols at the end for (j=i-1; ((j > 0) && CLASS2(word[j],'.','"')); j--); if (word[j+1] != '\0') { current_tok.set_punctuation(&word[j+1]); word[j+1] = '\0'; } else current_tok.set_punctuation(EST_String::Empty); current_tok.set_token(word); if (tok_wspace[0] == '\0') // feature paths will have null whitespace current_tok.set_whitespace(EST_String::Empty); else current_tok.set_whitespace(tok_wspace); } else { current_tok.set_token(EST_String::Empty); current_tok.set_whitespace(tok_wspace); current_tok.set_punctuation(EST_String::Empty); current_tok.set_prepunctuation(EST_String::Empty); eof_flag = TRUE; } return current_tok; } int EST_TokenStream::eoln(void) { // This doesn't really work if there are blank lines (and you want // to know about them) if ((peek().whitespace().contains("\n")) || eof()) return TRUE; else return FALSE; } EST_String quote_string(const EST_String &s, const EST_String "e, const EST_String &escape, int force) { // Quotes s always if force true, or iff s contains whitespace, // quotes or escapes force is false // Note quote and escape are assumed to be string of length 1 EST_String quoted_form; if ((force) || (s.contains(quote)) || (s.contains(escape)) || (s.contains(RXanywhitespace)) || (s.length() == 0)) { // bigger than the quoted form could ever be int i,j; char *quoted = new char[s.length()*(quote.length()+escape.length())+ 1+quote.length()+quote.length()]; quoted[0] = quote(0); for (i=1,j=0; j < s.length(); j++,i++) { if (s(j) == quote(0)) quoted[i++] = escape(0); else if (s(j) == escape(0)) quoted[i++] = escape(0); quoted[i] = s(j); } quoted[i++] = quote(0); quoted[i] = '\0'; quoted_form = quoted; delete [] quoted; return quoted_form; } else return s; } const EST_String EST_TokenStream::pos_description() { return Origin+":"+itoString(linepos); } speech_tools/base_class/vec_mat_aux.cc0000644000076400007640000004263210263052740016570 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* EST_FMatrix Class auxiliary functions */ /* */ /*=======================================================================*/ #include "EST_FMatrix.h" #include "EST_system.h" #include #include #include "EST_unix.h" #include "EST_math.h" #include bool polynomial_fit(EST_FVector &x, EST_FVector &y, EST_FVector &co_effs, int order) { EST_FVector weights; weights.resize(x.n()); for(int i=0; i= 1" << endl; return false; } if(x.n() != y.n()){ cerr << "polynomial_fit : x and y must have same dimension" << endl; return false; } if(weights.n() != y.n()){ cerr << "polynomial_fit : weights must have same dimension as x and y" << endl; return false; } if(x.n() <= order){ cerr << "polynomial_fit : x and y must have at least order+1 elements" << endl; return false; } // matrix of basis function values EST_FMatrix A; A.resize(x.n(),order+1); EST_FVector y1; y1.resize(y.n()); for(int row=0;row v) v = a.a_no_check(i, j); return v; } int square(const EST_FMatrix &a) { return a.num_rows() == a.num_columns(); } // add all elements in matrix. float sum(const EST_FMatrix &a) { int i, j; float t = 0.0; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) t += a.a_no_check(i, j); return t; } // set all elements not on the diagonal to zero. EST_FMatrix diagonalise(const EST_FMatrix &a) { int i; EST_FMatrix b(a, 0); // initialise and fill b with zeros if (a.num_rows() != a.num_columns()) { cerr << "diagonalise: non-square matrix "; return b; } for (i = 0; i < a.num_rows(); ++i) b(i, i) = a.a_no_check(i, i); return b; } // set all elements not on the diagonal to zero. void inplace_diagonalise(EST_FMatrix &a) { // NB - will work on non-square matrices without warning int i,j; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) if(i != j) a.a_no_check(i, j) = 0; } EST_FMatrix sub(const EST_FMatrix &a, int row, int col) { int i, j, I, J; int n = a.num_rows() - 1; EST_FMatrix s(n, n); for (i = I = 0; i < n; ++i, ++I) { if (I == row) ++I; for (j = J = 0; j < n; ++j, ++J) { if (J == col) ++J; s(i, j) = a.a(I, J); } } // cout << "sub: row " << row << " col " << col << "\n" << s; return s; } EST_FMatrix row(const EST_FMatrix &a, int row) { EST_FMatrix s(1, a.num_columns()); int i; for (i = 0; i < a.num_columns(); ++i) s(0, i) = a.a(row, i); return s; } EST_FMatrix column(const EST_FMatrix &a, int col) { EST_FMatrix s(a.num_rows(), 1); int i; for (i = 0; i < a.num_rows(); ++i) s(i, 0) = a.a(i, col); return s; } EST_FMatrix triangulate(const EST_FMatrix &a) { EST_FMatrix b(a, 0); int i, j; for (i = 0; i < a.num_rows(); ++i) for (j = i; j < a.num_rows(); ++j) b(j, i) = a.a(j, i); return b; } void transpose(const EST_FMatrix &a,EST_FMatrix &b) { int i, j; b.resize(a.num_columns(), a.num_rows()); for (i = 0; i < b.num_rows(); ++i) for (j = 0; j < b.num_columns(); ++j) b.a_no_check(i, j) = a.a_no_check(j, i); } EST_FMatrix backwards(EST_FMatrix &a) { int i, j, n; n = a.num_columns(); EST_FMatrix t(n, n); for (i = 0; i < n; ++i) for (j = 0; j < n; ++j) t(n - i - 1, n - j - 1) = a.a(i, j); return t; } // changed name from abs as it causes on at least on POSIX machine // where int abs(int) is a macro EST_FMatrix fmatrix_abs(const EST_FMatrix &a) { int i, j; EST_FMatrix b(a, 0); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) b.a_no_check(i, j) = fabs(a.a_no_check(i, j)); return b; } static void row_swap(int from, int to, EST_FMatrix &a) { int i; float f; if (from == to) return; for (i=0; i < a.num_columns(); i++) { f = a.a_no_check(to,i); a.a_no_check(to,i) = a.a_no_check(from,i); a.a_no_check(from,i) = f; } } int inverse(const EST_FMatrix &a,EST_FMatrix &inv) { int singularity=0; return inverse(a,inv,singularity); } int inverse(const EST_FMatrix &a,EST_FMatrix &inv,int &singularity) { // Used to use a function written by Richard Tobin (in C) but // we no longer need C functionality any more. This algorithm // follows that in "Introduction to Algorithms", Cormen, Leiserson // and Rivest (p759) and the term Gauss-Jordon is used for some part, // As well as looking back at Richard's. // This also keeps a record of which rows are which from the original // so that it can return which column actually has the singularity // in it if it fails to find an inverse. int i, j, k; int n = a.num_rows(); EST_FMatrix b = a; // going to destructively manipulate b to get inv EST_FMatrix pos; // the original position float biggest,s; int r=0,this_row,all_zeros; singularity = -1; if (a.num_rows() != a.num_columns()) return FALSE; // Make the inverse the identity matrix. inv.resize(n,n); pos.resize(n,1); for (i=0; i biggest) { r = j; biggest = fabs(b.a_no_check(j,i)); } } if (biggest == 0.0) // oops found a singularity { singularity = (int)pos.a_no_check(i,0); return FALSE; } // Swap current with biggest this_row = (int)pos.a_no_check(i,0); // in case we need this number row_swap(r,i,b); row_swap(r,i,inv); row_swap(r,i,pos); // Make b(i,i) = 1 s = b(i,i); for (k=0; k j) ? this_row : j); return FALSE; } } } return TRUE; } int pseudo_inverse(const EST_FMatrix &a, EST_FMatrix &inv) { int singularity=0; return pseudo_inverse(a,inv,singularity); } int pseudo_inverse(const EST_FMatrix &a, EST_FMatrix &inv,int &singularity) { // for non-square matrices // useful for solving linear eqns // (e.g. polynomial fitting) // is it square ? if( a.num_rows() == a.num_columns() ) return inverse(a,inv,singularity); if( a.num_rows() < a.num_columns() ) return FALSE; EST_FMatrix a_trans,atrans_a,atrans_a_inverse; transpose(a,a_trans); multiply(a_trans,a,atrans_a); if (!inverse(atrans_a,atrans_a_inverse,singularity)) return FALSE; multiply(atrans_a_inverse,a_trans,inv); return TRUE; } float determinant(const EST_FMatrix &a) { int i, j; int n = a.num_rows(); float det; if (!square(a)) { cerr << "Tried to take determinant of non-square matrix\n"; return 0.0; } EST_FVector A(n); if (n == 2) // special case of 2x2 determinant return (a.a_no_check(0,0) * a.a_no_check(1,1)) - (a.a_no_check(0,1) * a.a_no_check(1,0)); float p; // create cofactor matrix j = 1; for (i = 0; i < n; ++i) { p = (float)(i + j + 2); // because i & j should start at 1 // cout << "power " <

0 && (*this)(0) == '/'; } int EST_Pathname::is_dirname(void) const { return length()>0 && (*this)(length()-1) == '/'; } EST_Pathname EST_Pathname::directory(void) const { if (is_dirname()) return *this; int pos; if ((pos=index("/", -1)) >=0) return before(pos+1); else return "./"; } EST_Pathname EST_Pathname::as_file(void) const { if (is_filename()) return *this; if (length() > 0) return before(-1); return "."; } EST_Pathname EST_Pathname::as_directory(void) const { if (is_dirname()) return *this; if (length() > 0) { EST_String xx; xx = EST_String(*this) + "/"; return xx; } return "./"; } EST_Pathname EST_Pathname::construct(EST_Pathname dir, EST_String filename) { EST_String result(dir.as_directory()); result += filename; return result; } EST_Pathname EST_Pathname::construct(EST_Pathname dir, EST_String basename, EST_String extension) { EST_Pathname filename(basename + "." + extension); return EST_Pathname::construct(dir, filename); } EST_TList EST_Pathname::entries(int check_for_directories) const { DIR *dir; EST_TList list; if ((dir = opendir(this->as_directory()))!=NULL) { struct dirent *entry; while ((entry = readdir(dir)) != NULL) { EST_Pathname name(entry->d_name); struct stat buf; if (check_for_directories && stat((EST_String)this->as_directory() + (EST_String)name, &buf)==0 && (buf.st_mode & S_IFDIR)) list.append(name.as_directory()); else list.append(name); } closedir(dir); } return list; } EST_Pathname operator + (const EST_Pathname p, const EST_Pathname addition) {return EST_Pathname::append(p, addition); } EST_Pathname operator + (const char *p, const EST_Pathname addition) {return EST_Pathname::append(p, addition); } #if 0 EST_Pathname operator += (EST_Pathname p, const EST_Pathname addition) { EST_String q = EST_Pathname::append(p, addition); return q; } EST_Pathname operator += (EST_Pathname p, const EST_String addition) { EST_String q = EST_Pathname::append(p, addition); return q; } #endif EST_Pathname EST_Pathname::append(EST_Pathname directory, EST_Pathname addition) { if (addition.is_absolute()) return addition; EST_String add(addition); EST_String result(directory.as_directory()); result += add; return result; } EST_String EST_Pathname::extension(void) const { EST_String result(""); if (length() <= 0) return result; if (contains(".")) result = after(index(".",-1)); return result; } EST_Pathname EST_Pathname::filename(void) const { EST_String result(this->as_file()); if (contains("/")) result = result.after(index("/",-1)); return result; } EST_String EST_Pathname::basename(int remove_all) const { EST_String result(this->as_file().filename()); if (remove_all) { if (result.contains(".")) result = result.before("."); } return result; } speech_tools/base_class/THash_aux.cc0000644000076400007640000000641607262605664016177 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Apr 4 1997 */ /************************************************************************/ /* */ /* Default has functions and stuff. */ /* */ /************************************************************************/ #include "EST_THash.h" // default hash function, something like the one in Perl. unsigned int EST_HashFunctions::DefaultHash(const void *data, size_t size, unsigned int n) { return DefaultHashFunction(data, size, n); } unsigned int EST_HashFunctions::StringHash(const EST_String &key, unsigned int n) { return DefaultHashFunction((const char *)key, key.length(), n); } speech_tools/base_class/EST_FMatrix.cc0000644000076400007640000005321211465017151016360 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Matrix Class for floats */ /* */ /*=======================================================================*/ #include #include #include #include #include using namespace std; #include "EST_String.h" #include "EST_types.h" #include "EST_FileType.h" #include "EST_Option.h" #include "EST_FMatrix.h" #include "EST_cutils.h" // for swap functions #include "EST_Token.h" /* EST_FVector may used as EST_Val */ VAL_REGISTER_CLASS(fvector,EST_FVector) /* EST_FMatrix may used as EST_Val */ VAL_REGISTER_CLASS(fmatrix,EST_FMatrix) EST_String EST_FMatrix::default_file_type = "est_ascii"; EST_FMatrix::EST_FMatrix(const EST_FMatrix &a, int b) :EST_TSimpleMatrix(a.num_rows(), a.num_columns()) { float vv = 0.0; if (b < 0) return; if (b == 0) fill(vv); } EST_FMatrix & EST_FMatrix::operator+=(const EST_FMatrix &a) { int i, j; if (a.num_columns() != num_columns()) { cerr <<"Matrix addition error: bad number of columns\n"; return *this; } if (a.num_rows() != num_rows()) { cerr <<"Matrix addition error: bad number of rows\n"; return *this; } for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) += a.a_no_check(i,j); return *this; } EST_FMatrix & EST_FMatrix::operator-=(const EST_FMatrix &a) { int i, j; if (a.num_columns() != num_columns()) { cerr <<"Matrix subtraction error: bad number of columns\n"; return *this; } if (a.num_rows() != num_rows()) { cerr <<"Matrix subtraction error: bad number of rows\n"; return *this; } for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) -= a.a_no_check(i,j); return *this; } EST_FMatrix & EST_FMatrix::operator*=(const float f) { int i,j; for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) *= f; return *this; } EST_FMatrix & EST_FMatrix::operator/=(const float f) { int i,j; for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) /= f; return *this; } EST_FMatrix operator+(const EST_FMatrix &a, const EST_FMatrix &b) { EST_FMatrix ab; int i, j; if (a.num_columns() != b.num_columns()) { cerr <<"Matrix addition error: bad number of columns\n"; return ab; } if (a.num_rows() != b.num_rows()) { cerr <<"Matrix addition error: bad number of rows\n"; return ab; } ab.resize(a.num_rows(), a.num_columns()); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) ab.a_no_check(i, j) = a.a_no_check(i, j) + b.a_no_check(i, j); return ab; } EST_FMatrix operator-(const EST_FMatrix &a,const EST_FMatrix &b) { EST_FMatrix ab; int i, j; if (a.num_columns() != b.num_columns()) { cerr <<"Matrix subtraction error: bad number of columns:" << a.num_columns() << " and " << b.num_columns() << endl; return ab; } if (a.num_rows() != b.num_rows()) { cerr <<"Matrix subtraction error: bad number of rows\n"; return ab; } ab.resize(a.num_rows(), a.num_columns()); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) ab.a_no_check(i, j) = a.a_no_check(i, j) - b.a_no_check(i, j); return ab; } EST_FMatrix operator*(const EST_FMatrix &a, const float x) { EST_FMatrix b(a, 0); int i, j; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) b.a_no_check(i,j) = a.a_no_check(i,j) * x; return b; } int operator !=(const EST_FVector &fv1, const EST_FVector &fv2) { int i; if(fv1.length() != fv2.length()) return FALSE; for(i=0;i 0) { tt.open_string(sl.first()); for (n_cols = 0; !tt.eof(); ++n_cols) tt.get().string(); } // resize track and copy values in resize(n_rows, n_cols); for (p = sl.head(), i = 0; p != 0; ++i, p = p->next()) { tt.open_string(sl(p)); for (j = 0; !tt.eof(); ++j) a_no_check(i,j) = atof(tt.get().string()); if (j != n_cols) { cerr << "Wrong number of points in row " << i << endl; cerr << "Expected " << n_cols << " got " << j << endl; return misc_read_error; } } return format_ok; } else return r; } EST_FVector & EST_FVector::operator+=(const EST_FVector &s) { int i; if(n() != s.n()){ cerr << "Cannot elementwise add vectors of differing lengths" << endl; return *this; } for (i = 0; i < n(); ++i) (*this)[i] += s(i); return *this; } EST_FVector& EST_FVector::operator*=(const EST_FVector &s) { if(n() != s.n()){ cerr << "Cannot elementwise multiply vectors of differing lengths" << endl; return *this; } for (int i = 0; i < n(); ++i) (*this)[i] *= s(i); return *this; } EST_FVector& EST_FVector::operator*=(const float f) { for (int i = 0; i < n(); ++i) (*this)[i] *= f; return *this; } EST_FVector& EST_FVector::operator/=(const float f) { for (int i = 0; i < n(); ++i) (*this)[i] /= f; return *this; } EST_read_status EST_FVector::est_load(const EST_String &filename) { // ascii/binary load with short header for byte swap and sizes int i,k; int l, swap; EST_TokenStream ts; EST_read_status r; EST_EstFileType t; EST_Option hinfo; bool ascii; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "FVector: can't open FVector input file " << filename << endl; return misc_read_error; } if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_fvector) return misc_read_error; if (hinfo.ival("version") != 1) { cerr << "FVector load: " << ts.pos_description() << " wrong version of FVector format expected 1 but found " << hinfo.ival("version") << endl; return misc_read_error; } l = hinfo.ival("length"); resize(l); if (ascii) { // an ascii file for (i = 0; i < length(); ++i) a_no_check(i) = atof(ts.get().string()); } else { // a binary file float *buff; if ((EST_BIG_ENDIAN && (hinfo.sval("ByteOrder")=="LittleEndian")) || (EST_LITTLE_ENDIAN && (hinfo.sval("ByteOrder") == "BigEndian"))) swap = TRUE; else swap = FALSE; buff = walloc(float,l); // A single read is *much* faster than multiple reads if (ts.fread(buff,sizeof(float),l) != l) { cerr << "EST_FVector: binload: short file in \"" << filename << "\"" << endl; return misc_read_error; } if (swap) swap_bytes_float(buff,l); for (k = i = 0; i < length(); ++i) a_no_check(i) = buff[k++]; wfree(buff); } ts.close(); return read_ok; } EST_read_status EST_FVector::load(const EST_String &filename) { EST_read_status r; if ((r = est_load(filename)) == format_ok) return r; else if (r == wrong_format) { // maybe its an ancient ascii file EST_TokenStream ts; EST_String s; int i; i = 0; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } ts.set_SingleCharSymbols(";"); while (!ts.eof()) { ts.get(); ++i; } resize(i); ts.close(); if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } for (i = 0; !ts.eof(); ++i) { s = ts.get().string(); (*this)[i] = (float)(atof(s)); // actually returns double } ts.close(); return format_ok; } else return r; return format_ok; } /* EST_read_status EST_FVector::load(EST_String &filename) { EST_TokenStream ts; EST_String s; int i; i = 0; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } ts.set_SingleCharSymbols(";"); while (!ts.eof()) { ts.get(); ++i; } resize(i); ts.close(); if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } for (i = 0; !ts.eof(); ++i) { s = ts.get().string(); (*this)[i] = atof(s); } ts.close(); return format_ok; } */ // EST_read_status EST_DVector::load(EST_String &filename) // { // EST_TokenStream ts; // EST_String s; // int i; // i = 0; // if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) // { // cerr << "can't open vector input file " << filename << endl; // return misc_read_error; // } // ts.set_SingleCharSymbols(";"); // while (!ts.eof()) // { // ts.get(); // ++i; // } // resize(i); // ts.close(); // if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) // { // cerr << "can't open vector input file " << filename << endl; // return misc_read_error; // } // for (i = 0; !ts.eof(); ++i) // { // s = ts.get().string(); // (*this)[i] = atof(s); // actually returns double // } // ts.close(); // return format_ok; // } float operator*(const EST_FVector &v1, const EST_FVector &v2) { // dot product float b=0; if(v1.length() != v2.length()) { cerr <<"Vector dot product error: differing vector size" << endl; return b; } int i; for (i = 0; i < v1.length(); ++i) b += v1.a_no_check(i) * v2.a_no_check(i); return b; } EST_write_status EST_FVector::save(const EST_String &filename, const EST_String &type) { if ((type == "est_ascii") || (type == "est_binary")) return est_save(filename,type); else { // the old stuff raw unheadered int i; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); outf->precision(25); if (!(*outf)) { cerr << "FVector: can't open file \"" << filename <<"\" for writing" << endl; return misc_write_error; } for (i = 0; i < length(); ++i) *outf << a_no_check(i) << " "; *outf << endl; if (outf != &cout) delete outf; return write_ok; } } EST_write_status EST_FVector::est_save(const EST_String &filename, const EST_String &type) { // Binary save with short header for byte swap and sizes int i; FILE *fd; if (filename == "-") fd = stdout; else if ((fd = fopen(filename, "wb")) == NULL) { cerr << "EST_FVector: binsave: failed to open \"" << filename << "\" for writing" << endl; return misc_write_error; } fprintf(fd,"EST_File fvector\n"); fprintf(fd,"version 1\n"); if (type == "est_binary") { fprintf(fd,"DataType binary\n"); if (EST_LITTLE_ENDIAN) fprintf(fd,"ByteOrder LittleEndian\n"); else fprintf(fd,"ByteOrder BigEndian\n"); } else fprintf(fd,"DataType ascii\n"); fprintf(fd,"length %d\n",length()); fprintf(fd,"EST_Header_End\n"); if (type == "est_binary") { for (i = 0; i < length(); ++i) if (fwrite(&a_no_check(i),sizeof(float),1,fd) != 1) { cerr << "EST_FVector: binsave: failed to write item " << i << " to \"" << filename << "\"" << endl; return misc_write_error; } } else { // est_ascii for (i = 0; i < length(); ++i) fprintf(fd,"%.25f ",a_no_check(i)); fprintf(fd,"\n"); } if (fd != stdout) fclose(fd); return write_ok; } speech_tools/base_class/EST_Complex.cc0000644000076400007640000001026407262605664016431 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /*=======================================================================*/ #include "EST_Complex.h" // Addition EST_Complex operator + (const EST_Complex& z1, const EST_Complex &z2) { return EST_Complex(z1.r + z2.r, z1.i + z2.i); } EST_Complex operator + (const EST_Complex& z, float x) { return EST_Complex(z.r + x, z.i); } EST_Complex operator + (float x, const EST_Complex &z) { return EST_Complex(z.r + x, z.i); } // Subtraction EST_Complex operator - (const EST_Complex& z1, const EST_Complex &z2) { return EST_Complex(z1.r - z2.r, z1.i - z2.i); } EST_Complex operator - (const EST_Complex& z, float x) { return EST_Complex(z.r -x, z.i); } EST_Complex operator - (float x, const EST_Complex &z) { return EST_Complex(x - z.r, - z.i); } // Multiplication EST_Complex operator * (const EST_Complex& z1, const EST_Complex &z2) { return EST_Complex((z1.r * z2.r) - (z1.i * z2.i), (z1.r * z2.i) + (z1.i * z2.r)); } EST_Complex operator * (const EST_Complex& z, float x) { return EST_Complex(z.r * x, z.i *x); } EST_Complex operator * (float x, const EST_Complex &z) { return EST_Complex(z.r * x, z.i *x); } // Division EST_Complex operator / (const EST_Complex& z1, const EST_Complex &z2) { double m = z1.mag(); EST_Complex inv(z1.r / m, z1.i /m); return inv * z2; } EST_Complex operator / (const EST_Complex& z, float x) { return EST_Complex(z.r / x, z.i / x); } EST_Complex operator / (float x, const EST_Complex &z) { EST_Complex a(x, 0.0); return (z / a); } speech_tools/base_class/EST_Val.cc0000644000076400007640000001256010127000717015523 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* Class to represent ints, floats and strings */ /* and other arbitrary objects */ /*=======================================================================*/ #include #include "EST_Val.h" #include "EST_string_aux.h" val_type val_unset = "unset"; val_type val_int = "int"; val_type val_float = "float"; val_type val_string = "string"; EST_Val::EST_Val(const EST_Val &c) { if (c.t == val_string) sval = c.sval; else if (c.t == val_int) v.ival = c.v.ival; else if (c.t == val_float) v.fval = c.v.fval; else if (c.t != val_unset) { // does references not a real copy v.pval = new EST_Contents; *v.pval = *c.v.pval; } t=c.t; } EST_Val::EST_Val(val_type type,void *p, void (*f)(void *)) { t=type; v.pval = new EST_Contents; v.pval->set_contents(p,f); } EST_Val::~EST_Val(void) { if ((t != val_int) && (t != val_float) && (t != val_unset) && (t != val_string)) delete v.pval; } EST_Val &EST_Val::operator=(const EST_Val &c) { // Have to be careful with the case where they are different types if ((t != val_int) && (t != val_float) && (t != val_unset) && (t != val_string)) delete v.pval; if (c.t == val_string) sval = c.sval; else if (c.t == val_int) v.ival = c.v.ival; else if (c.t == val_float) v.fval = c.v.fval; else if (c.t != val_unset) { // does references not a real copy v.pval = new EST_Contents; *v.pval = *c.v.pval; } t=c.t; return *this; } const int EST_Val::to_int(void) const { // coerce this to an int if (t==val_float) return (int)v.fval; else if (t==val_string) return atoi(sval); else return v.ival; // just for completeness } const float EST_Val::to_flt(void) const { // coerce this to a float if (t==val_int) return (float)v.ival; else if (t==val_string) return atof(sval); else return v.fval; // just for completeness } const EST_String &EST_Val::to_str(void) const { // coerce this to and save it for later // This requires the following casting, so we can still tell the // compiler this is a const function. If this was properly declared // non-const vast amounts of the rest of this would also have to be // non-const. So we do one nasty bit here for uniformity elsewhere. // Not saving the result is also a possibility but probably too // inefficient (maybe not with rjc's string class) EST_String *n = (EST_String *)((void *)&sval); if (t==val_int) *n = itoString(v.ival); else if (t==val_float) { if (v.fval == 0) *n = "0"; // to be compatible with other's notion of fstrings else *n = ftoString(v.fval); } else if (t != val_string) *n = EST_String("[Val ")+t+"]"; return sval; } speech_tools/base_class/EST_matrix_support.cc0000644000076400007640000001223410127000717020077 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Mar 10 1998 */ /* -------------------------------------------------------------------- */ /* Support functions for all matrix types. */ /* */ /*************************************************************************/ #include #include "EST_TVector.h" #include "EST_matrix_support.h" #include "EST_bool.h" const int EST_CURRENT=-1; const int EST_ALL=-1; bool EST_matrix_bounds_check(int r, int c, int num_rows, int num_columns, bool set) { const char *what = set?"set":"access"; if ((r < 0) || (r >= num_rows)) { cerr << "Tried to " << what << " row " << r << " of " << num_rows << " row matrix\n"; return FALSE; } if ((c < 0) || (c >= num_columns)) { cerr << "Tried to " << what << " column " << c << " of " << num_columns << " column matrix\n"; return FALSE; } return TRUE; } bool EST_matrix_bounds_check(int r, int nr, int c, int nc, int num_rows, int num_columns, bool set) { const char *what = set?"set":"access"; if (nr>0) { if ((r < 0) || (r >= num_rows)) { cerr << "Tried to " << what << " row " << r << " of " << num_rows << " row matrix\n"; return FALSE; } if (r+nr-1 >= num_rows) { cerr << "Tried to " << what << " row " << r+nr-1 << " of " << num_rows << " row matrix\n"; return FALSE; } } if (nc>0) { if ((c < 0) || (c >= num_columns)) { cerr << "Tried to " << what << " column " << c << " of " << num_columns << " column matrix\n"; return FALSE; } if (c+nc-1 >= num_columns) { cerr << "Tried to " << what << " column " << c+nc-1 << " of " << num_columns << " column matrix\n"; return FALSE; } } return TRUE; } bool EST_vector_bounds_check(int c, int num_columns, bool set) { const char *what = set?"set":"access"; if ((c < 0) || (c >= num_columns)) { cerr << "Tried to " << what << " column " << c << " of " << num_columns << " column vector\n"; return FALSE; } return TRUE; } bool EST_vector_bounds_check(int c, int nc, int num_columns, bool set) { const char *what = set?"set":"access"; if (nc>0) { if ((c < 0) || (c >= num_columns)) { cerr << "Tried to " << what << " column " << c << " of " << num_columns << " column vector\n"; return FALSE; } if (c+nc-1 >= num_columns) { cerr << "Tried to " << what << " column " << c+nc-1 << " of " << num_columns << " column vector\n"; return FALSE; } } return TRUE; } speech_tools/base_class/rateconv.cc0000644000076400007640000004131510522743364016122 0ustar awbawb/* * $Id: rateconv.cc,v 1.4 2004/09/29 08:24:16 robert Exp $ * * RATECONV.C * * Convert sampling rate stdin to stdout * * Copyright (c) 1992, 1995 by Markus Mummert * ***************************************************************************** * MODIFIED BY Alan W Black (awb@cstr.ed.ac.uk) * Make it compilable under C++ * and integrate into Edinburgh Speech Tools (i.e. no longer * reads from stdin / writes to stdout) * Removed interface functions * ansified function calls * made it work in floats rather than ints * I got the original from a random linux site, the original * author's email is ***************************************************************************** * * Redistribution and use of this software, modification and inclusion * into other forms of software are permitted provided that the following * conditions are met: * * 1. Redistributions of this software must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. If this software is redistributed in a modified condition * it must reveal clearly that it has been modified. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * * history: 2.9.92 begin coding * 5.9.92 fully operational * 14.2.95 provide BIG_ENDIAN, SWAPPED_BYTES_DEFAULT * switches, Copyright note and References * 25.11.95 changed XXX_ENDIAN to I_AM_XXX_ENDIAN * default gain set to 0.8 * 3.12.95 stereo implementation * SWAPPED_BYTES_DEFAULT now HBYTE1ST_DEFAULT * changed [L/2] to (L-1)/2 for exact symmetry * * * IMPLEMENTATION NOTES * * Converting is achieved by interpolating the input samples in * order to evaluate the represented continuous input slope at * sample instances of the new rate (resampling). It is implemented * as a polyphase FIR-filtering process (see reference). The rate * conversion factor is determined by a rational factor. Its * nominator and denominator are integers of almost arbitrary * value, limited only by coefficient memory size. * * General rate conversion formula: * * out(n*Tout) = SUM in(m*Tin) * g((n*d/u-m)*Tin) * Tin * over all m * * FIR-based rate conversion formula for polyphase processing: * * L-1 * out(n*Tout) = SUM in(A(i,n)*Tin) * g(B(i,n)*Tin) * Tin * i=0 * * A(i,n) = i - (L-1)/2 + [n*d/u] * = i - (L-1)/2 + [(n%u)*d/u] + [n/u]*d * B(i,n) = n*d/u - [n*d/u] + (L-1)/2 - i * = ((n%u)*d/u)%1 + (L-1)/2 - i * Tout = Tin * d/u * * where: * n,i running integers * out(t) output signal sampled at t=n*Tout * in(t) input signal sampled in intervals Tin * u,d up- and downsampling factor, integers * g(t) interpolating function * L FIR-length of realized g(t), integer * / float-division-operator * % float-modulo-operator * [] integer-operator * * note: * (L-1)/2 in A(i,n) can be omitted as pure time shift yielding * a causal design with a delay of ((L-1)/2)*Tin. * n%u is a cyclic modulo-u counter clocked by out-rate * [n/u]*d is a d-increment counter, advanced when n%u resets * B(i,n)*Tin can take on L*u different values, at which g(t) * has to be sampled as a coefficient array * * Interpolation function design: * * The interpolation function design is based on a sinc-function * windowed by a gaussian function. The former determines the * cutoff frequency, the latter limits the necessary FIR-length by * pushing the outer skirts of the resulting impulse response below * a certain threshold fast enough. The drawback is a smoothed * cutoff inducing some aliasing. Due to the symmetry of g(t) the * group delay of the filtering process is constant (linear phase). * * g(t) = 2*fgK*sinc(pi*2*fgK*t) * exp(-pi*(2*fgG*t)**2) * * where: * fgK cutoff frequency of sinc function in f-domain * fgG key frequency of gaussian window in f-domain * reflecting the 6.82dB-down point * * note: * Taking fsin=1/Tin as the input sampling frequency, it turns out * that in conjunction with L, u and d only the ratios fgK/(fsin/2) * and fgG/(fsin/2) specify the whole process. Requiring fsin, fgK * and fgG as input purposely keeps the notion of absolute * frequencies. * * Numerical design: * * Samples are expected to be 16bit-signed integers, alternating * left and right channel in case of stereo mode- The byte order * per sample is selectable. FIR-filtering is implemented using * 32bit-signed integer arithmetic. Coefficients are scaled to * find the output sample in the high word of accumulated FIR-sum. * * Interpolation can lead to sample magnitudes exceeding the * input maximum. Worst case is a full scale step function on the * input. In this case the sinc-function exhibits an overshoot of * 2*9=18percent (Gibb's phenomenon). In any case sample overflow * can be avoided by a gain of 0.8. * * If u=d=1 and if the input stream contains only a single sample, * the whole length of the FIR-filter will be written to the output. * In general the resulting output signal will be (L-1)*fsout/fsin * samples longer than the input signal. The effect is that a * finite input sequence is viewed as padded with zeros before the * `beginning' and after the `end'. * * The output lags ((L-1)/2)*Tin behind to implement g(t) as a * causal system corresponding to a causal relationship of the * discrete-time sequences in(m/fsin) and out(n/fsout) with * respect to a sequence time origin at t=n*Tin=m*Tout=0. * * * REFERENCES * * Crochiere, R. E., Rabiner, L. R.: "Multirate Digital Signal * Processing", Prentice-Hall, Englewood Cliffs, New Jersey, 1983 * * Zwicker, E., Fastl, H.: "Psychoacoustics - Facts and Models", * Springer-Verlag, Berlin, Heidelberg, New-York, Tokyo, 1990 */ #include #include #include #include #include "rateconv.h" /* * adaptable defines and globals */ #define BYTE char /* signed or unsigned */ #define WORD short /* signed or unsigned, fit two BYTEs */ #define LONG int /* signed, fit two WORDs */ #ifndef MAXUP #define MAXUP 0x400 /* MAXUP*MAXLENGTH worst case malloc */ #endif #ifndef MAXLENGTH #define MAXLENGTH 0x400 /* max FIR length */ #endif /* accounts for mono samples, means */ #define OUTBUFFSIZE (2*MAXLENGTH) /* fit >=MAXLENGHT stereo samples */ #define INBUFFSIZE (4*MAXLENGTH) /* fit >=2*MAXLENGTH stereo samples */ #define sqr(a) ((a)*(a)) #ifndef M_PI #define M_PI 3.14159265358979 #endif /* AWB deleted previous byte swap globals, byteswap is done external to */ /* this function */ #ifdef STEREO_DEFAULT static int g_monoflag = 0; #else static int g_monoflag = -1; #endif /* * other globals */ static double g_ampli = 0.8; /* default gain, don't change */ static int /* g_infilehandle = 0, */ /* stdin */ /* g_outfilehandle = 1, */ /* stdout */ g_firlen, /* FIR-length */ g_up, /* upsampling factor */ g_down /* downsampling factor */ ; static float g_sin[INBUFFSIZE], /* input buffer */ g_sout[OUTBUFFSIZE], /* output buffer */ *g_coep; /* coefficient array pointer */ static double g_fsi, /* input sampling frequency */ g_fgk, /* sinc-filter cutoff frequency */ g_fgg /* gaussian window key frequency */ ; /* (6.8dB down freq. in f-domain) */ /* * evaluate sinc(x) = sin(x)/x safely */ static double sinc(double x) { return(fabs(x) < 1E-50 ? 1.0 : sin(fmod(x,2*M_PI))/x); } /* * evaluate interpolation function g(t) at t * integral of g(t) over all times is expected to be one */ static double interpol_func(double t,double fgk,double fgg) { return (2*fgk*sinc(M_PI*2*fgk*t)*exp(-M_PI*sqr(2*fgg*t))); } /* * evaluate coefficient from i, q=n%u by sampling interpolation function * and scale it for integer multiplication used by FIR-filtering */ static float coefficient(int i,int q,int firlen,double fgk,double fgg, double fsi,int up,int down,double amp) { float val; double d; d = interpol_func((fmod(q*down/(double)up,1.) + (firlen-1)/2. - i) / fsi, fgk, fgg); val = amp * d/fsi; return val; } /* * transfer n floats from s to d */ static void transfer_int(float *s,float *d,int n) { memmove(d,s,sizeof(float)*n); } /* * zerofill n floats from s */ static void zerofill(float *s,int n) { memset(s,0,n*(sizeof(float))); } /* * FIR-routines, mono and stereo * this is where we need all the MIPS */ void fir_mono(float *inp,float *coep,int firlen,float *outp) { float akku = 0, *endp; int n1 = (firlen / 8) * 8, n0 = firlen % 8; endp = coep + n1; while (coep != endp) { akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; akku += *inp++ * *coep++; } endp = coep + n0; while (coep != endp) { akku += *inp++ * *coep++; } *outp = akku; } static void fir_stereo(float *inp,float *coep,int firlen,float *out1p,float *out2p) { float akku1 = 0, akku2 = 0, *endp; int n1 = (firlen / 8) * 8, n0 = firlen % 8; endp = coep + n1; while (coep != endp) { akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; } endp = coep + n0; while (coep != endp) { akku1 += *inp++ * *coep; akku2 += *inp++ * *coep++; } *out1p = akku1; *out2p = akku2; } /* * filtering from input buffer to output buffer; * returns number of processed samples in output buffer: * if it is not equal to output buffer size, * the input buffer is expected to be refilled upon entry, so that * the last firlen numbers of the old input buffer are * the first firlen numbers of the new input buffer; * if it is equal to output buffer size, the output buffer * is full and is expected to be stowed away; * */ static int inbaseidx = 0, inoffset = 0, cycctr = 0, outidx = 0; static int filtering_on_buffers (float *inp,int insize,float *outp, int outsize, float *coep,int firlen,int up,int down,int monoflag) { if (monoflag) { while (-1) { inoffset = (cycctr * down)/up; if ((inbaseidx + inoffset + firlen) > insize) { inbaseidx -= insize - firlen + 1; return(outidx); } fir_mono(inp + inoffset + inbaseidx, coep + cycctr * firlen, firlen, outp + outidx++); cycctr++; if (!(cycctr %= up)) inbaseidx += down; if (!(outidx %= outsize)) return(outsize); } } else { /* * rule how to convert mono routine to stereo routine: * firlen, up, down and cycctr relate to samples in general, * wether mono or stereo; inbaseidx, inoffset and outidx as * well as insize and outsize still account for mono samples. */ while (-1) { inoffset = 2*((cycctr * down)/up); if ((inbaseidx + inoffset + 2*firlen) > insize) { inbaseidx -= insize - 2*firlen + 2; return(outidx); } fir_stereo(inp + inoffset + inbaseidx, coep + cycctr * firlen, firlen, outp + outidx++, outp + outidx++); cycctr++; if (!(cycctr %= up)) inbaseidx += 2*down; if (!(outidx %= outsize)) return(outsize); } } } /* * set up coefficient array */ static void make_coe(void) { int i, q; for (i = 0; i < g_firlen; i++) { for (q = 0; q < g_up; q++) { g_coep[q * g_firlen + i] = coefficient(i, q, g_firlen, g_fgk, g_fgg, g_fsi, g_up, g_down, g_ampli); } } } /***********************************************************************/ /* Serious modifications by Alan W Black (awb@cstr.ed.ac.uk) */ /* to interface with rest of system // deleted various io functions */ /* too. */ /***********************************************************************/ static WORD *inbuff = NULL; static int inpos; static int inmax; static WORD *outbuff = NULL; static int outpos; static int outmax; static int ioerr(void) { delete g_coep; return -1; } static int gcd(int x, int y) { int remainder,a,b; if ((x < 1) || (y < 1)) return -1; for (a=x,b=y; b != 0; ) { remainder = a % b; a = b; b = remainder; } return a; } static int find_ratios(int in_samp_freq,int out_samp_freq,int *up,int *down) { // Find ratios int d; d = gcd(in_samp_freq,out_samp_freq); if (d == -1) return -1; *down = in_samp_freq / d; *up = out_samp_freq / d; if ((*up > 1024) || (*down > 1024)) return -1; // should try harder return 0; } static int intimport(float *buff, int n) { /* Import n more samples from PWave into buff */ int i,end; if ((inpos+n) >= inmax) end = inmax - inpos; else end = n; for (i=0;i < end; i++) buff[i] = inbuff[inpos++]; return i; } static int intexport(float *buff, int n) { /* Export n samples from buff into end of PWave */ int i,end; if ((outpos+n) >= outmax) end = outmax - inpos; else end = n; for (i=0;i < end; i++) outbuff[outpos++] = (short)buff[i]; return i; } static int init_globs(WORD *in,int insize, WORD **out, int *outsize, int in_samp_freq, int out_samp_freq) { int new_size; g_monoflag = 1; /* always mono */ if (find_ratios(in_samp_freq,out_samp_freq,&g_up,&g_down) == -1) return -1; g_fsi = 1.0; /* ? in_samp_freq ? */ if (g_up > g_down) { // upsampling g_fgg = 0.0116; g_fgk = 0.461; g_firlen = (int)(162 * (float)g_up/(float)g_down); } else { // downsampling g_fgg = (float)g_up/(float)g_down * 0.0116; g_fgk = (float)g_up/(float)g_down * 0.461; g_firlen = (int)(162 * (float)g_down/(float)g_up); } if (g_firlen < 1 || g_firlen > MAXLENGTH) return -1; g_ampli = 0.8; g_coep = new float[g_firlen * g_up]; inpos = 0; inmax = insize; inbuff = in; new_size = (int)(((float)out_samp_freq/(float)in_samp_freq)* 1.1*insize)+2000; *out = new WORD[new_size]; outbuff = *out; outmax = new_size; *outsize = 0; outpos = 0; /* For filter_on_buffers */ inbaseidx = 0; inoffset = 0; cycctr = 0; outidx = 0; return 0; } /* * External call added by Alan W Black, 4th June 1996 * a combination of parse args and main */ int rateconv(short *in,int isize, short **out, int *osize, int in_samp_freq, int out_samp_freq) { int insize = 0, outsize = 0, skirtlen; if (init_globs(in,isize,out,osize,in_samp_freq,out_samp_freq) == -1) return -1; make_coe(); skirtlen = (g_firlen - 1) * (g_monoflag ? 1 : 2); zerofill(g_sin, skirtlen); do { insize = intimport(g_sin + skirtlen, INBUFFSIZE - skirtlen); if (insize < 0 || insize > INBUFFSIZE - skirtlen) return ioerr(); do { outsize = filtering_on_buffers(g_sin, skirtlen + insize, g_sout, OUTBUFFSIZE, g_coep, g_firlen, g_up, g_down, g_monoflag); if (outsize != OUTBUFFSIZE) { transfer_int(g_sin + insize, g_sin, skirtlen); break; } if (intexport(g_sout, outsize) != outsize) return ioerr(); } while (-1); } while (insize > 0); zerofill(g_sin + skirtlen, skirtlen); do { outsize = filtering_on_buffers(g_sin, skirtlen + skirtlen, g_sout, OUTBUFFSIZE, g_coep, g_firlen, g_up, g_down, g_monoflag); if (intexport(g_sout, outsize) != outsize) return ioerr(); } while (outsize == OUTBUFFSIZE); delete g_coep; *osize = outpos; /* The new signal will be offset by half firlen window so fix it */ memmove(*out,*out+g_firlen/4,*osize*2); *osize -= g_firlen/4; return 0; } speech_tools/base_class/EST_IMatrix.cc0000644000076400007640000000645610127000717016365 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Matrix Class for ints */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_String.h" #include "EST_types.h" #include "EST_FileType.h" #include "EST_Option.h" #include "EST_IMatrix.h" #include "EST_cutils.h" // for swap functions #include "EST_Token.h" #include "rateconv.h" EST_IMatrix::EST_IMatrix(EST_IMatrix &a, int b) :EST_TSimpleMatrix(a.num_rows(), a.num_columns()) { int vv = 0; if (b < 0) return; if (b == 0) fill(vv); } speech_tools/base_class/EST_SMatrix.cc0000644000076400007640000001012010127000717016356 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Matrix Class for shorts */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_String.h" #include "EST_types.h" #include "EST_FileType.h" #include "EST_Option.h" #include "EST_SMatrix.h" #include "EST_cutils.h" // for swap functions #include "EST_Token.h" #include "rateconv.h" EST_SMatrix::EST_SMatrix(EST_SMatrix &a, int b) :EST_TSimpleMatrix(a.num_rows(), a.num_columns()) { short vv = 0; if (b < 0) return; if (b == 0) fill(vv); } int EST_SMatrix::rateconv(int in_samp_freq, int out_samp_freq) { short *in_buf = new short[num_rows()]; short ** results = new short *[num_columns()]; int *len = new int[num_columns()]; int max_len=0; for(int c=0; c max_len) max_len = osize; } else return -1; } delete [] in_buf; resize(max_len, EST_CURRENT, 0); fill(0); for(int c1=0; c1 #include #include #include #include #include "EST_String.h" #include "EST_types.h" #include "EST_FileType.h" #include "EST_Option.h" #include "EST_DMatrix.h" #include "EST_cutils.h" // for swap functions #include "EST_Token.h" #include "rateconv.h" EST_String EST_DMatrix::default_file_type = "est_ascii"; EST_DMatrix::EST_DMatrix(const EST_DMatrix &a, int b) :EST_TSimpleMatrix(a.num_rows(), a.num_columns()) { double vv = 0.0; if (b < 0) return; if (b == 0) fill(vv); } EST_DMatrix & EST_DMatrix::operator+=(const EST_DMatrix &a) { int i, j; if (a.num_columns() != num_columns()) { cerr <<"Matrix addition error: bad number of columns\n"; return *this; } if (a.num_rows() != num_rows()) { cerr <<"Matrix addition error: bad number of rows\n"; return *this; } for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) += a.a_no_check(i,j); return *this; } EST_DMatrix & EST_DMatrix::operator-=(const EST_DMatrix &a) { int i, j; if (a.num_columns() != num_columns()) { cerr <<"Matrix subtraction error: bad number of columns\n"; return *this; } if (a.num_rows() != num_rows()) { cerr <<"Matrix subtraction error: bad number of rows\n"; return *this; } for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) -= a.a_no_check(i,j); return *this; } EST_DMatrix & EST_DMatrix::operator*=(const double f) { int i,j; for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) *= f; return *this; } EST_DMatrix & EST_DMatrix::operator/=(const double f) { int i,j; for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i, j) /= f; return *this; } EST_DMatrix operator+(const EST_DMatrix &a, const EST_DMatrix &b) { EST_DMatrix ab; int i, j; if (a.num_columns() != b.num_columns()) { cerr <<"Matrix addition error: bad number of columns\n"; return ab; } if (a.num_rows() != b.num_rows()) { cerr <<"Matrix addition error: bad number of rows\n"; return ab; } ab.resize(a.num_rows(), a.num_columns()); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) ab.a_no_check(i, j) = a.a_no_check(i, j) + b.a_no_check(i, j); return ab; } EST_DMatrix operator-(const EST_DMatrix &a,const EST_DMatrix &b) { EST_DMatrix ab; int i, j; if (a.num_columns() != b.num_columns()) { cerr <<"Matrix subtraction error: bad number of columns:" << a.num_columns() << " and " << b.num_columns() << endl; return ab; } if (a.num_rows() != b.num_rows()) { cerr <<"Matrix subtraction error: bad number of rows\n"; return ab; } ab.resize(a.num_rows(), a.num_columns()); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) ab.a_no_check(i, j) = a.a_no_check(i, j) - b.a_no_check(i, j); return ab; } EST_DMatrix operator*(const EST_DMatrix &a, const double x) { EST_DMatrix b(a, 0); int i, j; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) b.a_no_check(i,j) = a.a_no_check(i,j) * x; return b; } EST_DVector operator*(const EST_DMatrix &a, const EST_DVector &v) { // treat the vector as a column vector // multiply each row of the matrix in turn by the vector EST_DVector b; b.resize(a.num_rows()); if(a.num_columns() != v.n()) { cerr <<"Matrix-vector multiplication error: matrix rows != vector size" << endl; return b; } int i, j; for (i = 0; i < a.num_rows(); ++i){ b[i] = 0.0; for (j = 0; j < a.num_columns(); ++j) b.a_no_check(i) += a.a_no_check(i,j) * v.a_no_check(j); } return b; } EST_DVector operator+(const EST_DVector &a, const EST_DVector &b) { EST_DVector ab; int i; if (a.length() != b.length()) { cerr <<"Vector addition error: mismatched lengths\n"; return ab; } ab.resize(a.length()); for (i = 0; i < a.length(); ++i) ab.a_no_check(i) = a.a_no_check(i) + b.a_no_check(i); return ab; } EST_DVector operator-(const EST_DVector &a, const EST_DVector &b) { EST_DVector ab; int i; if (a.length() != b.length()) { cerr <<"Vector subtraction error: mismatched lengths\n"; return ab; } ab.resize(a.length()); for (i = 0; i < a.length(); ++i) ab.a_no_check(i) = a.a_no_check(i) - b.a_no_check(i); return ab; } EST_DVector operator*(const EST_DVector &v,const EST_DMatrix &a) { // treat the vector as a row vector // multiply the vector by each column of the matrix in turn EST_DVector b; b.resize(a.num_columns()); if(a.num_columns() != v.n()) { cerr <<"Matrix-vector multiplication error: matrix rows != vector size" << endl; return b; } int i, j; for (j = 0; j < a.num_columns(); ++j){ b[j] = 0.0; for (i = 0; i < a.num_rows(); ++i) b.a_no_check(i) += a.a_no_check(i,j) * v.a_no_check(j); } return b; } #if 0 EST_DMatrix operator/(const EST_DMatrix &a, double x) { return (a * (1/x)); } #endif EST_DMatrix operator*(const EST_DMatrix &a, const EST_DMatrix &b) { EST_DMatrix ab; multiply(a,b,ab); return ab; } void multiply(const EST_DMatrix &a, const EST_DMatrix &b, EST_DMatrix &ab) { if (a.num_columns() != b.num_rows()) { cerr <<"Matrix multiply error: a.num_columns() != b.num_rows()\n"; return; } ab.resize(a.num_rows(), b.num_columns()); int i, j, k, n; n = a.num_columns(); // could also be b.num_rows() for (i = 0; i < a.num_rows(); ++i) for (k = 0; k < b.num_columns(); ++k) { ab.a_no_check(i, k) = 0.0; for (j = 0; j < n; ++j) ab.a_no_check(i, k) += a.a_no_check(i, j) * b.a_no_check(j, k); } } void EST_DMatrix::copyin(double **inx, int rows, int cols) { int i, j; resize(rows, cols); for (i = 0; i < rows; ++i) for (j = 0; j < cols; ++j) a_no_check(i,j) = inx[i][j]; } EST_write_status EST_DMatrix::save(const EST_String &filename, const EST_String &type) { if ((type == "est_ascii") || (type == "est_binary")) return est_save(filename,type); else { // the old stuff raw unheadered int i, j; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); outf->precision(25); if (!(*outf)) { cerr << "DMatrix: can't open file \"" << filename <<"\" for writing" << endl; return misc_write_error; } for (i = 0; i < num_rows(); ++i) { for (j = 0; j < num_columns(); ++j) *outf << a_no_check(i,j) << " "; *outf << endl; } if (outf != &cout) delete outf; return write_ok; } } EST_write_status EST_DMatrix::est_save(const EST_String &filename, const EST_String &type) { // Binary save with short header for byte swap and sizes int i,j; FILE *fd; if (filename == "-") fd = stdout; else if ((fd = fopen(filename, "wb")) == NULL) { cerr << "EST_DMatrix: binsave: failed to open \"" << filename << "\" for writing" << endl; return misc_write_error; } fprintf(fd,"EST_File dmatrix\n"); fprintf(fd,"version 1\n"); if (type == "est_binary") { fprintf(fd,"DataType binary\n"); if (EST_LITTLE_ENDIAN) fprintf(fd,"ByteOrder LittleEndian\n"); else fprintf(fd,"ByteOrder BigEndian\n"); } else fprintf(fd,"DataType ascii\n"); fprintf(fd,"rows %d\n",num_rows()); fprintf(fd,"columns %d\n",num_columns()); fprintf(fd,"EST_Header_End\n"); if (type == "est_binary") { for (i = 0; i < num_rows(); ++i) for (j=0; j < num_columns(); j++) if (fwrite(&a_no_check(i,j),sizeof(double),1,fd) != 1) { cerr << "EST_DMatrix: binsave: failed to write row " << i << " column " << j << " to \"" << filename << "\"" << endl; return misc_write_error; } } else { // est_ascii for (i = 0; i < num_rows(); ++i) { for (j=0; j < num_columns(); j++) fprintf(fd,"%.25f ",a_no_check(i,j)); fprintf(fd,"\n"); } } if (fd != stdout) fclose(fd); return write_ok; } EST_read_status EST_DMatrix::est_load(const EST_String &filename) { // ascii/binary load with short header for byte swap and sizes int i,j,k; int rows, cols, swap; EST_TokenStream ts; EST_read_status r; EST_EstFileType t; EST_Option hinfo; bool ascii; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "DMatrix: can't open DMatrix input file " << filename << endl; return misc_read_error; } if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_dmatrix) return misc_read_error; if (hinfo.ival("version") != 1) { cerr << "DMatrix load: " << ts.pos_description() << " wrong version of DMatrix format expected 1 but found " << hinfo.ival("version") << endl; return misc_read_error; } rows = hinfo.ival("rows"); cols = hinfo.ival("columns"); resize(rows,cols); if (ascii) { // an ascii file for (i = 0; i < num_rows(); ++i) { for (j = 0; j < num_columns(); ++j) a_no_check(i,j) = atof(ts.get().string()); if (!ts.eoln()) { cerr << "DMatrix load: " << ts.pos_description() << " missing end of line at end of row " << i << endl; return misc_read_error; } } } else { // a binary file double *buff; if ((EST_BIG_ENDIAN && (hinfo.sval("ByteOrder")=="LittleEndian")) || (EST_LITTLE_ENDIAN && (hinfo.sval("ByteOrder") == "BigEndian"))) swap = TRUE; else swap = FALSE; buff = walloc(double,rows*cols); // A single read is *much* faster than multiple reads if (ts.fread(buff,sizeof(double),rows*cols) != rows*cols) { cerr << "EST_DMatrix: binload: short file in \"" << filename << "\"" << endl; return misc_read_error; } if (swap) swap_bytes_double(buff,rows*cols); for (k = i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) a_no_check(i,j) = buff[k++]; wfree(buff); } ts.close(); return read_ok; } EST_read_status EST_DMatrix::load(const EST_String &filename) { EST_read_status r; if ((r = est_load(filename)) == format_ok) return r; else if (r == wrong_format) { // maybe its an ancient ascii file EST_TokenStream ts, tt; EST_StrList sl; int i, j, n_rows=0, n_cols=0; EST_String t; EST_Litem *p; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open DMatrix file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); // first read in as list for (n_rows = 0; !ts.eof(); ++n_rows) sl.append(ts.get_upto_eoln().string()); if (n_rows > 0) { tt.open_string(sl.first()); for (n_cols = 0; !tt.eof(); ++n_cols) tt.get().string(); } // resize track and copy values in resize(n_rows, n_cols); for (p = sl.head(), i = 0; p != 0; ++i, p = p->next()) { tt.open_string(sl(p)); for (j = 0; !tt.eof(); ++j) a_no_check(i,j) = atof(tt.get().string()); if (j != n_cols) { cerr << "Wrong number of points in row " << i << endl; cerr << "Expected " << n_cols << " got " << j << endl; return misc_read_error; } } return format_ok; } else return r; return format_ok; } EST_read_status EST_DVector::est_load(const EST_String &filename) { // ascii/binary load with short header for byte swap and sizes int i,k; int l, swap; EST_TokenStream ts; EST_read_status r; EST_EstFileType t; EST_Option hinfo; bool ascii; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "DVector: can't open DVector input file " << filename << endl; return misc_read_error; } if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_dvector) return misc_read_error; if (hinfo.ival("version") != 1) { cerr << "DVector load: " << ts.pos_description() << " wrong version of DVector format expected 1 but found " << hinfo.ival("version") << endl; return misc_read_error; } l = hinfo.ival("length"); resize(l); if (ascii) { // an ascii file for (i = 0; i < length(); ++i) a_no_check(i) = atof(ts.get().string()); } else { // a binary file double *buff; if ((EST_BIG_ENDIAN && (hinfo.sval("ByteOrder")=="LittleEndian")) || (EST_LITTLE_ENDIAN && (hinfo.sval("ByteOrder") == "BigEndian"))) swap = TRUE; else swap = FALSE; buff = walloc(double,l); // A single read is *much* faster than multiple reads if (ts.fread(buff,sizeof(double),l) != l) { cerr << "EST_DVector: binload: short file in \"" << filename << "\"" << endl; return misc_read_error; } if (swap) swap_bytes_double(buff,l); for (k = i = 0; i < length(); ++i) a_no_check(i) = buff[k++]; wfree(buff); } ts.close(); return read_ok; } EST_read_status EST_DVector::load(const EST_String &filename) { EST_read_status r; if ((r = est_load(filename)) == format_ok) return r; else if (r == wrong_format) { // maybe its an ancient ascii file EST_TokenStream ts; EST_String s; int i; i = 0; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } ts.set_SingleCharSymbols(";"); while (!ts.eof()) { ts.get(); ++i; } resize(i); ts.close(); if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "can't open vector input file " << filename << endl; return misc_read_error; } for (i = 0; !ts.eof(); ++i) { s = ts.get().string(); (*this)[i] = atof(s); // actually returns double } ts.close(); return format_ok; } else return r; return format_ok; } EST_DVector & EST_DVector::operator+=(const EST_DVector &s) { int i; if(n() != s.n()){ cerr << "Cannot elementwise add vectors of differing lengths" << endl; return *this; } for (i = 0; i < n(); ++i) (*this)[i] += s(i); return *this; } EST_DVector& EST_DVector::operator*=(const EST_DVector &s) { if(n() != s.n()){ cerr << "Cannot elementwise multiply vectors of differing lengths" << endl; return *this; } for (int i = 0; i < n(); ++i) (*this)[i] *= s(i); return *this; } EST_DVector& EST_DVector::operator*=(const double f) { for (int i = 0; i < n(); ++i) (*this)[i] *= f; return *this; } double operator*(const EST_DVector &v1, const EST_DVector &v2) { if(v1.length() != v2.length()) { cerr << "Can't do vector dot prod - differing vector sizes !" << endl; return 0; } double p=0; for (int i = 0; i < v1.length(); ++i) p += v1.a_no_check(i) * v2.a_no_check(i); return p; } EST_DVector& EST_DVector::operator/=(const double f) { for (int i = 0; i < n(); ++i) (*this)[i] /= f; return *this; } EST_write_status EST_DVector::save(const EST_String &filename, const EST_String &type) { if ((type == "est_ascii") || (type == "est_binary")) return est_save(filename,type); else { // the old stuff raw unheadered int i; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); outf->precision(25); if (!(*outf)) { cerr << "DVector: can't open file \"" << filename <<"\" for writing" << endl; return misc_write_error; } for (i = 0; i < length(); ++i) *outf << a_no_check(i) << " "; *outf << endl; if (outf != &cout) delete outf; return write_ok; } } EST_write_status EST_DVector::est_save(const EST_String &filename, const EST_String &type) { // Binary save with short header for byte swap and sizes int i; FILE *fd; if (filename == "-") fd = stdout; else if ((fd = fopen(filename, "wb")) == NULL) { cerr << "EST_DVector: binsave: failed to open \"" << filename << "\" for writing" << endl; return misc_write_error; } fprintf(fd,"EST_File dvector\n"); fprintf(fd,"version 1\n"); if (type == "est_binary") { fprintf(fd,"DataType binary\n"); if (EST_LITTLE_ENDIAN) fprintf(fd,"ByteOrder LittleEndian\n"); else fprintf(fd,"ByteOrder BigEndian\n"); } else fprintf(fd,"DataType ascii\n"); fprintf(fd,"length %d\n",length()); fprintf(fd,"EST_Header_End\n"); if (type == "est_binary") { for (i = 0; i < length(); ++i) if (fwrite(&a_no_check(i),sizeof(double),1,fd) != 1) { cerr << "EST_DVector: binsave: failed to write item " << i << " to \"" << filename << "\"" << endl; return misc_write_error; } } else { // est_ascii for (i = 0; i < length(); ++i) fprintf(fd,"%.25f ",a_no_check(i)); fprintf(fd,"\n"); } if (fd != stdout) fclose(fd); return write_ok; } speech_tools/base_class/vec_mat_aux_d.cc0000644000076400007640000004167510127000717017075 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* EST_DMatrix Class auxiliary functions */ /* */ /*=======================================================================*/ #include #include "EST_DMatrix.h" #include #include "EST_math.h" #include "EST_unix.h" bool polynomial_fit(EST_DVector &x, EST_DVector &y, EST_DVector &co_effs, int order) { EST_DVector weights; weights.resize(x.n()); for(int i=0; i= 1" << endl; return false; } if(x.n() != y.n()){ cerr << "polynomial_fit : x and y must have same dimension" << endl; return false; } if(weights.n() != y.n()){ cerr << "polynomial_fit : weights must have same dimension as x and y" << endl; return false; } if(x.n() <= order){ cerr << "polynomial_fit : x and y must have at least order+1 elements" << endl; return false; } // matrix of basis function values EST_DMatrix A; A.resize(x.n(),order+1); EST_DVector y1; y1.resize(y.n()); for(int row=0;row v) v = a.a_no_check(i, j); return v; } int square(const EST_DMatrix &a) { return a.num_rows() == a.num_columns(); } // add all elements in matrix. double sum(const EST_DMatrix &a) { int i, j; double t = 0.0; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) t += a.a_no_check(i, j); return t; } // set all elements not on the diagonal to zero. EST_DMatrix diagonalise(const EST_DMatrix &a) { int i; EST_DMatrix b(a, 0); // initialise and fill b with zeros if (a.num_rows() != a.num_columns()) { cerr << "diagonalise: non-square matrix "; return b; } for (i = 0; i < a.num_rows(); ++i) b(i, i) = a.a_no_check(i, i); return b; } // set all elements not on the diagonal to zero. void inplace_diagonalise(EST_DMatrix &a) { // NB - will work on non-square matrices without warning int i,j; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) if(i != j) a.a_no_check(i, j) = 0; } EST_DMatrix sub(const EST_DMatrix &a, int row, int col) { int i, j, I, J; int n = a.num_rows() - 1; EST_DMatrix s(n, n); for (i = I = 0; i < n; ++i, ++I) { if (I == row) ++I; for (j = J = 0; j < n; ++j, ++J) { if (J == col) ++J; s(i, j) = a.a(I, J); } } // cout << "sub: row " << row << " col " << col << "\n" << s; return s; } EST_DMatrix row(const EST_DMatrix &a, int row) { EST_DMatrix s(1, a.num_columns()); int i; for (i = 0; i < a.num_columns(); ++i) s(0, i) = a.a(row, i); return s; } EST_DMatrix column(const EST_DMatrix &a, int col) { EST_DMatrix s(a.num_rows(), 1); int i; for (i = 0; i < a.num_rows(); ++i) s(i, 0) = a.a(i, col); return s; } EST_DMatrix triangulate(const EST_DMatrix &a) { EST_DMatrix b(a, 0); int i, j; for (i = 0; i < a.num_rows(); ++i) for (j = i; j < a.num_rows(); ++j) b(j, i) = a.a(j, i); return b; } void transpose(const EST_DMatrix &a,EST_DMatrix &b) { int i, j; b.resize(a.num_columns(), a.num_rows()); for (i = 0; i < b.num_rows(); ++i) for (j = 0; j < b.num_columns(); ++j) b.a_no_check(i, j) = a.a_no_check(j, i); } EST_DMatrix backwards(EST_DMatrix &a) { int i, j, n; n = a.num_columns(); EST_DMatrix t(n, n); for (i = 0; i < n; ++i) for (j = 0; j < n; ++j) t(n - i - 1, n - j - 1) = a.a(i, j); return t; } // changed name from abs as it causes on at least on POSIX machine // where int abs(int) is a macro EST_DMatrix DMatrix_abs(const EST_DMatrix &a) { int i, j; EST_DMatrix b(a, 0); for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) b.a_no_check(i, j) = fabs(a.a_no_check(i, j)); return b; } static void row_swap(int from, int to, EST_DMatrix &a) { int i; double f; if (from == to) return; for (i=0; i < a.num_columns(); i++) { f = a.a_no_check(to,i); a.a_no_check(to,i) = a.a_no_check(from,i); a.a_no_check(from,i) = f; } } int inverse(const EST_DMatrix &a,EST_DMatrix &inv) { int singularity=0; return inverse(a,inv,singularity); } int inverse(const EST_DMatrix &a,EST_DMatrix &inv,int &singularity) { // Used to use a function written by Richard Tobin (in C) but // we no longer need C functionality any more. This algorithm // follows that in "Introduction to Algorithms", Cormen, Leiserson // and Rivest (p759) and the term Gauss-Jordon is used for some part, // As well as looking back at Richard's. // This also keeps a record of which rows are which from the original // so that it can return which column actually has the singularity // in it if it fails to find an inverse. int i, j, k; int n = a.num_rows(); EST_DMatrix b = a; // going to destructively manipulate b to get inv EST_DMatrix pos; // the original position double biggest,s; int r=0,this_row,all_zeros; singularity = -1; if (a.num_rows() != a.num_columns()) return FALSE; // Make the inverse the identity matrix. inv.resize(n,n); pos.resize(n,1); for (i=0; i biggest) { r = j; biggest = fabs(b.a_no_check(j,i)); } } if (biggest == 0.0) // oops found a singularity { singularity = (int)pos.a_no_check(i,0); return FALSE; } // Swap current with biggest this_row = (int)pos.a_no_check(i,0); // in case we need this number row_swap(r,i,b); row_swap(r,i,inv); row_swap(r,i,pos); // Make b(i,i) = 1 s = b(i,i); for (k=0; k j) ? this_row : j); return FALSE; } } } return TRUE; } int pseudo_inverse(const EST_DMatrix &a, EST_DMatrix &inv) { int singularity=0; return pseudo_inverse(a,inv,singularity); } int pseudo_inverse(const EST_DMatrix &a, EST_DMatrix &inv,int &singularity) { // for non-square matrices // useful for solving linear eqns // (e.g. polynomial fitting) // is it square ? if( a.num_rows() == a.num_columns() ) return inverse(a,inv,singularity); if( a.num_rows() < a.num_columns() ) return FALSE; EST_DMatrix a_trans,atrans_a,atrans_a_inverse; transpose(a,a_trans); multiply(a_trans,a,atrans_a); if (!inverse(atrans_a,atrans_a_inverse,singularity)) return FALSE; multiply(atrans_a_inverse,a_trans,inv); return TRUE; } double determinant(const EST_DMatrix &a) { int i, j; int n = a.num_rows(); double det; if (!square(a)) { cerr << "Tried to take determinant of non-square matrix\n"; return 0.0; } EST_DVector A(n); if (n == 2) // special case of 2x2 determinant return (a.a_no_check(0,0) * a.a_no_check(1,1)) - (a.a_no_check(0,1) * a.a_no_check(1,0)); double p; // create cofactor matrix j = 1; for (i = 0; i < n; ++i) { p = (double)(i + j + 2); // because i & j should start at 1 // cout << "power " <

resize(0); return *ans; }; ans->resize(a.length()); for(i=0;ia_no_check(i) = a.a_no_check(i) + b.a_no_check(i); return *ans; } EST_DVector subtract(const EST_DVector &a,const EST_DVector &b) { // a - b EST_DVector *ans = new EST_DVector; int i; if(a.length() != b.length()) { cerr << "Can't subtract vectors of differing lengths !" << endl; ans->resize(0); return *ans; }; ans->resize(a.length()); for(i=0;ia_no_check(i) = a.a_no_check(i) - b.a_no_check(i); return *ans; } EST_DVector diagonal(const EST_DMatrix &a) { EST_DVector ans; if(a.num_rows() != a.num_columns()) { cerr << "Can't extract diagonal of non-square matrix !" << endl; return ans; } int i; ans.resize(a.num_rows()); for(i=0;i #include #include "EST_THash.h" EST_FeatureData::EST_FeatureData() { default_vals(); } EST_FeatureData::EST_FeatureData(const EST_FeatureData &a) { default_vals(); copy(a); } EST_FeatureData::~EST_FeatureData(void) { } int EST_FeatureData::num_samples() const { return fd.num_rows(); } int EST_FeatureData::num_features() const { return fd.num_columns(); } void EST_FeatureData::default_vals() { /* cout << "Default values\n"; p_sub_fd = false; p_info = new EST_FeatureInfo; */ } void EST_FeatureData::set_num_samples(int num_samples, bool preserve) { fd.resize(num_samples, fd.num_columns(), preserve); } void EST_FeatureData::resize(int num_samples, int num_features, bool preserve) { // If enlargement is required, give new features dummy names // and set their types to . If preserve is set to 0 // rename all features this way. if (num_features > fd.num_columns()) { int i; if (preserve) i = fd.num_columns(); else i = 0; for (; i < num_features; ++i) info.set("unnamed_" + itoString(i), ""); } fd.resize(num_samples, num_features, preserve); } void EST_FeatureData::resize(int num_samples, EST_Features &f, bool preserve) { fd.resize(num_samples, f.length(), preserve); info = f; } EST_String EST_FeatureData::type(const EST_String &feature_name) { EST_String t = info.S(feature_name); if (t.contains("<", 0)) // i.e. a predefined type return t; return "undef"; } EST_StrList EST_FeatureData::values(const EST_String &feature_name) { EST_StrList v; EST_String t = info.S(feature_name); // check for infinite set: if ((t == "") || (t == "") || (t == "")) return v; StringtoStrList(t, v); return v; } int EST_FeatureData::feature_position(const EST_String &feature_name) { int i; EST_Features::Entries p; for (i = 0, p.begin(info); p; ++p, ++i) { // cout << "looking at " << info.fname(p) << endl; // cout << "i = " << i << endl; if (p->k == feature_name) return i; } EST_error("No such feature %s\n", (const char *) feature_name); return 0; } int EST_FeatureData::update_values(const EST_String &feature_name, int max) { // This should be converted back to Hash tables once extra // iteration functions are added the EST_Hash. int i, col; EST_Features values; EST_String v; // EST_TStringHash values(max); col = feature_position(feature_name); for (i = 0; i < num_samples(); ++i) values.set(fd.a(i, col).string(), 1); // check to see if there are more types than allowed, if so // just set to open set STRING if (values.length() > max) v = ""; else { EST_Features::Entries p; for(p.begin(values); p; ++p) v += p->k + " "; } info.set(feature_name, v); return values.length(); } EST_FeatureData & EST_FeatureData::copy(const EST_FeatureData &a) { (void) a; /* // copy on a sub can't alter header information if (!p_sub_fd) { delete p_info; *p_info = *(a.p_info); } // but data can be copied so long as no resizing is involved. EST_ValMatrix::operator=(a); */ return *this; } /*void EST_FeatureData::a(int i, int j) { return EST_ValMatrix::a(i, j); } */ /* EST_Val &EST_FeatureData::operator()(int i, int j) { return a(i, j); } EST_Val &EST_FeatureData::operator()(int s, const EST_String &f) { int i = info().field_index(f); return a(s, i); } EST_FeatureData &EST_FeatureData::operator=(const EST_FeatureData &f) { return copy(f); } */ EST_Val &EST_FeatureData::a(int i, const EST_String &f) { (void)f; return fd.a(i, 0); } EST_Val &EST_FeatureData::a(int i, int j) { return fd.a(i, j); } const EST_Val &EST_FeatureData::a(int i, const EST_String &f) const { (void)f; return fd.a(i, 0); } const EST_Val &EST_FeatureData::a(int i, int j) const { return fd.a(i, j); } /* void EST_FeatureData::sub_samples(EST_FeatureData &f, int start, int num) { sub_matrix(f, start, num); f.p_info = p_info; f.p_sub_fd = true; } void EST_FeatureData::extract_named_fields(const EST_String &fields) { EST_FeatureData n; // there must be a more efficient way than a copy? extract_named_fields(n, fields); *this = n; } void EST_FeatureData::extract_named_fields(const EST_StrList &fields) { EST_FeatureData n; // there must be a more efficient way than a copy? extract_named_fields(n, fields); *this = n; } void EST_FeatureData::extract_numbered_fields(const EST_String &fields) { EST_FeatureData n; // there must be a more efficient way than a copy? extract_numbered_fields(n, fields); *this = n; } void EST_FeatureData::extract_numbered_fields(const EST_IList &fields) { EST_FeatureData n; // there must be a more efficient way than a copy? extract_numbered_fields(n, fields); *this = n; } void EST_FeatureData::extract_named_fields(EST_FeatureData &f, const EST_String &fields) const { EST_StrList s; StringtoStrList(fields, s); extract_named_fields(f, s); } void EST_FeatureData::extract_named_fields(EST_FeatureData &f, const EST_StrList &n_fields) const { EST_Litem *p; EST_StrList n_types; int i, j; info().extract_named_fields(*(f.p_info), n_fields); for (p = n_fields.head(), i = 0; i < f.num_fields(); ++i, p = p->next()) for (j = 0; j < f.num_samples(); ++j) f(j, i) = a(j, n_fields(p)); } void EST_FeatureData::extract_numbered_fields(EST_FeatureData &f, const EST_IList &fields) const { EST_Litem *p; EST_StrList n_fields; int i, j; for (p = fields.head(); p; p = p->next()) n_fields.append(info().field_name(fields(p))); info().extract_named_fields(*(f.p_info), n_fields); for (p = fields.head(), i = 0; i < f.num_fields(); ++i, p = p->next()) for (j = 0; j < f.num_samples(); ++j) f(j, i) = a(j, fields(p)); } void EST_FeatureData::extract_numbered_fields(EST_FeatureData &f, const EST_String &fields) const { EST_StrList s; EST_IList il; StringtoStrList(fields, s); StrListtoIList(s, il); extract_numbered_fields(f, il); } */ EST_write_status save_est(const EST_FeatureData &f, const EST_String &filename) { (void)f; (void)filename; /* ostream *outf; EST_Litem *s, *e; int i; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; outf->precision(5); outf->setf(ios::fixed, ios::floatfield); outf->width(8); *outf << "EST_File feature_data\n"; // EST header identifier *outf << "DataType ascii\n"; *outf << "NumSamples " << f.num_samples() << endl; *outf << "NumFields " << f.num_fields() << endl; *outf << "FieldNames " << f.info().field_names(); *outf << "FieldTypes " << f.info().field_types(); if (f.info().group_start.length() > 0) for (s = f.info().group_start.head(), e = f.info().group_end.head(); s; s = s->next(), e = e->next()) *outf << "Group " << f.info().group_start.key(s) << " " << f.info().group_start.val(s) << " " << f.info().group_end.val(e) << endl; for (i = 0; i < f.num_fields(); ++i) if (f.info().field_values(i).length() > 0) *outf << "Field_" << i << "_Values " << f.info().field_values(i) << endl; *outf << "EST_Header_End\n"; // EST end of header identifier // *outf << ((EST_ValMatrix ) f); *outf << f; */ return write_ok; } EST_write_status EST_FeatureData::save(const EST_String &filename, const EST_String &file_type) const { if ((file_type == "est") || (file_type == "")) return save_est(*this, filename); /* else if (file_type = "octave") return save_octave(*this, filename); else if (file_type = "ascii") return save_ascii(*this, filename); */ cerr << "Can't save feature data in format \"" << file_type << endl; return write_fail; } EST_read_status EST_FeatureData::load(const EST_String &filename) { int i, j; EST_Option hinfo; EST_String k, v; EST_read_status r; bool ascii; EST_TokenStream ts; EST_EstFileType t; int ns, nf; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); ts.set_quotes('"','\\'); if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) { cerr << "Error reading est header of file " << filename << endl; return r; } if (t != est_file_feature_data) { cerr << "Not a EST Feature Data file: " << filename << endl; return misc_read_error; } ns = hinfo.ival("NumSamples"); nf = hinfo.ival("NumFeatures"); cout << "ns: " << ns << endl; cout << "nf: " << nf << endl; resize(ns, nf); info.clear(); // because resize will make default names for (i = 0; i < nf; ++i) { k = "Feature_" + itoString(i+1); if (hinfo.present(k)) { v = hinfo.val(k); info.set(v.before(" "), v.after(" ")); cout << "value: " << v.after(" ") << endl; } else EST_error("No feature definition given for feature %d\n", i); } for (i = 0; i < ns; ++i) { EST_Features::Entries p; for (p.begin(info), j = 0; j < nf; ++j, ++p) { if (p->k == "") a(i, j) = atof(ts.get().string()); else if (p->k == "") a(i, j) = atoi(ts.get().string()); else if (p->k == "") a(i, j) = atoi(ts.get().string()); else a(i, j) = ts.get().string(); } } return format_ok; } /*ostream& operator << (ostream &st, const EST_FeatureInfo &a) { // st << a.field_names() << endl; // st << a.field_types() << endl; return st; } */ ostream& operator << (ostream &st, const EST_FeatureData &d) { int i, j; EST_String t; EST_Val v; // st << a; // EST_ValMatrix::operator<<(st, (EST_ValMatrix)a); for (i = 0; i < d.num_samples(); ++i) { for (j = 0; j < d.num_features(); ++j) { v = d.a(i, j); st << v << " "; // cout << "field type " << a.info().field_type(j) << endl; /* else if (a.info().field_type(j) == "float") st << a.a(i, j); else if (a.info().field_type(j) == "int") st << a.a(i, j); else if (a.info().field_type(j) == "string") { // st << "\"" << a.a(i, j) << "\""; t = a.a(i, j); t.gsub(" ", "_"); st << t; } */ } st << endl; } return st; } speech_tools/base_class/EST_slist_aux.cc0000644000076400007640000001503711465017154017027 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1994 */ /*-----------------------------------------------------------------------*/ /* StrList/Vector i/o utility functions */ /* */ /*=======================================================================*/ #include #include #include #include #include #include #include "EST_types.h" #include "EST_String.h" #include "EST_Pathname.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_Token.h" int StrListtoFList(EST_StrList &s, EST_FList &f) { EST_Litem *p; for (p = s.head(); p; p = p->next()) if (!s(p).matches(RXdouble)) { cout << "Expecting a floating point value in StrListtoFlist(): got " << s(p) << endl; return -1; } else f.append(atof(s(p))); return 0; } int StrListtoIList(EST_StrList &s, EST_IList &il) { EST_Litem *p; for (p = s.head(); p; p = p->next()) if (!s(p).matches(RXint)) { cout << "Expecting a integer value in StrListtoIList(): got " << s(p) << endl; return -1; } else il.append(atoi(s(p))); return 0; } // read string list eclosed in brackets. Simply a place holder for // future use with more complicate lists. void BracketStringtoStrList(EST_String s, EST_StrList &l, EST_String sep) { s.gsub("(", ""); s.gsub(")", ""); StringtoStrList(s, l, sep); } void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep) { EST_TokenStream ts; EST_String tmp; ts.open_string(s); (void)sep; if (sep != "") // default is standard white space ts.set_WhiteSpaceChars(sep); ts.set_SingleCharSymbols(";"); // modified by simonk - was appending an empty // string at end of list. // unmodified back again by pault while (!ts.eof()) l.append(ts.get().string()); ts.close(); return; } void StrListtoString(EST_StrList &l, EST_String &s, EST_String sep) { for (EST_Litem *p = l.head(); p; p = p->next()) s += l(p) + sep; } EST_read_status load_StrList(EST_String filename, EST_StrList &l) { EST_TokenStream ts; EST_String s; if(ts.open(filename) != 0){ cerr << "Can't open EST_StrList file " << filename << endl; return misc_read_error; } ts.set_SingleCharSymbols(""); ts.set_PunctuationSymbols(""); while (!ts.eof()) l.append(ts.get().string()); ts.close(); return format_ok; } EST_write_status save_StrList(EST_String filename, EST_StrList &l, EST_String style) { ostream *outf; EST_Litem *p; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; if (style == "words") { for (p = l.head(); p; p = p->next()) { *outf << l(p); if (p->next() != 0) *outf << " "; } *outf << endl; } else if (style == "lines") for (p = l.head(); p; p = p->next()) *outf << l(p) << endl; else { cerr << "Unknown style for writing StrLists: " << style << endl; return misc_write_error; } delete outf; return write_ok; } int strlist_member(const EST_StrList &l,const EST_String &s) { EST_Litem *p; for (p = l.head(); p != 0; p = p->next()) if (l.item(p) == s) return TRUE; return FALSE; } int strlist_index(const EST_StrList &l,const EST_String &s) { EST_Litem *p; int j=0; for (p = l.head(); p != 0; p = p->next()) { if (l.item(p) == s) return j; j++; } return -1; } void StrList_to_StrVector(EST_StrList &l, EST_StrVector &v) { int len,i; len = l.length(); v.resize(len); //EST_TBI *p; EST_Litem *p; for (p = l.head(),i=0; p != 0; p = p->next(),i++) v[i] = l(p); } void StrVector_to_StrList(EST_StrVector &v, EST_StrList &l) { int i; l.clear(); for (i=0;i #include #include #include #include #include #include "EST_types.h" #include "EST_String.h" #include "EST_Pathname.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_Token.h" EST_read_status load_TList_of_StrVector(EST_TList &w, const EST_String &filename, const int vec_len) { EST_TokenStream ts; EST_String s; EST_StrVector v; int c; if(ts.open(filename) != 0){ cerr << "Can't open EST_TList file " << filename << endl; return misc_read_error; } v.resize(vec_len); // ts.set_SingleCharSymbols(""); // ts.set_PunctuationSymbols(""); c=0; while (!ts.eof()) { s = ts.get().string(); if(s != "") { if(c == vec_len) { cerr << "Too many points in line - expected " << vec_len << endl; return wrong_format; } else v[c++] = s; } if(ts.eoln()) { if(c != vec_len) { cerr << "Too few points in line - got " << c << ", expected " << vec_len << endl; return wrong_format; } else { w.append(v); c=0; } } } ts.close(); return format_ok; } speech_tools/base_class/EST_ilist_aux.cc0000644000076400007640000000766111465017154017021 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor, Simon King */ /* Date : 1994-99 */ /*-----------------------------------------------------------------------*/ /* IList i/o utility functions */ /* */ /*=======================================================================*/ #include #include #include #include #include #include #include "EST_types.h" #include "EST_String.h" #include "EST_Pathname.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_Token.h" int ilist_member(const EST_IList &l,int i) { EST_Litem *p; for (p = l.head(); p != 0; p = p->next()) if (l.item(p) == i) return TRUE; return FALSE; } int ilist_index(const EST_IList &l,int i) { EST_Litem *p; int j=0; for (p = l.head(); p != 0; p = p->next()) { if (l.item(p) == i) return j; j++; } return -1; } void IList_to_IVector(EST_IList &l, EST_IVector &v) { int len,i; len = l.length(); v.resize(len); //EST_TBI *p; EST_Litem *p; for (p = l.head(),i=0; p != 0; p = p->next(),i++) v[i] = l(p); } void IVector_to_IList(EST_IVector &v, EST_IList &l) { int i; l.clear(); for (i=0;iv.type() != val_type_feats) { cerr << "Not a features in val\n"; break; } p_score = feats(p->v)->F(field, 1.0); n_score = feats(n->v)->F(field, 1.0); if (n_score > p_score) { cout << "swapping\n"; e = *p; *p = *n; *n = e; work_to_do = 1; } } } } speech_tools/base_class/EST_features_io.cc0000644000076400007640000002314511465017154017320 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* Features i/o */ /* This is kept separate from EST_Features to help reduce dependencies */ /*=======================================================================*/ #include #include "EST_Features.h" #include "ling_class/EST_Item.h" #include "EST_error.h" #include "EST_String.h" #include "EST_Token.h" void EST_Features::set_function(const EST_String &name, const EST_String &funcname) { EST_Item_featfunc f = get_featfunc(funcname,1); set_path(name, est_val(f)); } void EST_Features::save_fpair(ostream &outf, const EST_String &fname, const EST_Val &fvalue) const { /* Feature valued features themselves (so can't denot empty ones) */ if (fvalue.type() == val_type_feats) { EST_Features *f = feats(fvalue); if (f->features->list.head() == 0) { // An empty feature set outf << fname << " () ; "; } else for (EST_Litem *q=f->features->list.head(); q != 0; q=q->next() ) save_fpair(outf, fname+"."+f->features->list(q).k, f->features->list(q).v); return; } /* a non feature valued one */ // in case someone has () in their feature names (ought to be shot) if (fname.contains("(") || fname.contains(")") || fname.contains(" ") || // bang, bang fname.contains("\t") || // what smoking gun ? fname.contains(";") || (fname == "")) outf << quote_string(fname,"\"","\\",1) << " "; else outf << fname << " "; if (fvalue == ";") outf << "\";\""; else if ((fvalue.type() == val_string) && ((fvalue.string().matches(RXint)) || (fvalue.string().matches(RXdouble)) || (fvalue.string().contains("(")) || (fvalue.string().contains(")")) || (fvalue.string().contains(";")) )) // force quoting, cause it looks like a number but isn't outf << quote_string(fvalue.string(),"\"","\\",1); else if (fvalue.type() == val_float) { char b[20]; sprintf(b,"%g",fvalue.Float()); outf << b; } else if (fvalue.type() == val_type_featfunc) { outf << "F:"<list.head() == 0) outf << "()"; else for (EST_Litem *p=features->list.head(); p != 0; p=p->next() ) save_fpair(outf, features->list(p).k, features->list(p).v); return write_ok; } EST_write_status EST_Features::save_sexpr(ostream &outf) const { // Save features as an sexpression outf << "("; for (EST_Litem *p=features->list.head(); p != 0; p=p->next() ) { const EST_String &fname = features->list(p).k; const EST_Val &fvalue = features->list(p).v; outf << "("; // in case someone has () in their feature names (ought to be shot) if (fname.contains("(") || fname.contains(")") || fname.contains(" ") || fname.contains("\t") || fname.contains(";")) outf << quote_string(fname,"\"","\\",1); else outf << fname; outf << " "; if (fvalue == ";") outf << "\";\""; else if ((fvalue.type() == val_string) && ((fvalue.string().matches(RXint)) || (fvalue.string().matches(RXdouble)) || (fvalue.string().contains("(")) || (fvalue.string().contains(")")))) // force quoting, cause it looks like a number but isn't // or contains a paren outf << quote_string(fvalue.string(),"\"","\\",1); else if (fvalue.type() == val_float) { char b[20]; sprintf(b,"%g",fvalue.Float()); outf << b; } else if (fvalue.type() == val_type_featfunc) { outf << "F:"<save_sexpr(outf); } else outf << quote_string(fvalue.string()); outf << ")"; if (p->next()) outf << " "; } outf << ")"; return write_ok; } EST_read_status EST_Features::load_sexpr(EST_TokenStream &ts) { /* Load in feature structure from sexpression */ if (ts.peek() != "(") { cerr << "load_features: no sexpression found\n"; return misc_read_error; } else { EST_String f; EST_Token v; ts.get(); /* skip opening paren */ for (; ts.peek() != ")"; ) { if (ts.peek() != "(") { cerr << "load_features: no sexpression found\n"; return misc_read_error; } ts.get(); f = ts.get().string(); /* feature name */ if ((ts.peek() == "(") && (ts.peek().quoted() == FALSE)) { EST_Features fv; set(f,fv); A(f).load_sexpr(ts); } else { v = ts.get(); if (v.quoted()) set(f,v.string()); else if (v.string().matches(RXint)) set(f,atoi(v.string())); else if (v.string().matches(RXdouble)) set(f,atof(v.string())); else if (v.string().contains("F:")) { EST_Item_featfunc func = get_featfunc(v.string().after("F:")); if (func != NULL) set_val(f,est_val(func)); else { cerr << "load_features: Unknown Function '" << f <<"'\n"; set_val(f,feature_default_value); } } else set(f,v.string()); } if (ts.get() != ")") { cerr << "load_features: no sexpression found\n"; return misc_read_error; } } if (ts.get() != ")") { cerr << "load_features: no sexpression found\n"; return misc_read_error; } } return format_ok; } EST_read_status EST_Features::load(EST_TokenStream &ts) { // load features from here to end of line separated by semicolons EST_String f; EST_Token v; static EST_Val val0 = EST_Val(0); while (!ts.eoln()) { if (ts.eof()) { cerr << "load_features: unexpected end of file\n"; return misc_read_error; } f = ts.get().string(); v = EST_String::Empty; while (((ts.peek() != ";") || (ts.peek().quoted())) && (!ts.eof()) && (!ts.eoln())) if (v == "") v = ts.get(); else v = v.string() + ts.peek().whitespace() + ts.get().string(); if (v.quoted() || (v.string() == "")) set_path(f,EST_Val(v.string())); else if (v.string() == "0") // very common cases for speed set_path(f,val0); else if ((strchr("0123456789-.",v.string()(0)) != NULL) && (v.string().matches(RXdouble))) { if (v.string().matches(RXint)) set_path(f, EST_Val(atoi(v.string()))); else set_path(f, EST_Val(atof(v.string()))); } else if (v.string().contains("F:")) { EST_Item_featfunc func = get_featfunc(v.string().after("F:")); if (func != NULL) set_path(f, est_val(func)); else { cerr << "load_features: Unknown Function '" << f <<"'\n"; set_path(f, feature_default_value); } } else if (v.string() == "()") { // An empty feature set EST_Features *fs = new EST_Features; set_path(f,est_val(fs)); } else if (v != "") // unsupported type set_path(f,EST_Val(v.string())); if (ts.peek() == ";") ts.get(); else if (!ts.eoln()) { cerr << "load_features: " << ts.pos_description() << " missing semicolon in feature list\n"; return misc_read_error; } } return format_ok; } speech_tools/base_class/vec_mat_aux_i.cc0000644000076400007640000000631410127000717017071 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* EST_IMatrix Class auxiliary functions */ /* */ /*=======================================================================*/ #include "EST_IMatrix.h" #include "EST_system.h" #include #include #include "EST_unix.h" #include "EST_math.h" #include int matrix_max(const EST_IMatrix &a) { int i, j; int v = INT_MIN; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_columns(); ++j) if (a.a_no_check(i, j) > v) v = a.a_no_check(i, j); return v; } speech_tools/base_class/EST_Featured.cc0000644000076400007640000001014607262605664016560 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* */ /* -------------------------------------------------------------------- */ /* A class encapsulating the mechanics of objects which have features. */ /* */ /*************************************************************************/ #include "EST_Featured.h" EST_Featured::EST_Featured(void) { init_features(); } EST_Featured::EST_Featured(const EST_Featured &f) { init_features(); copy_features(f); } EST_Featured::~EST_Featured(void) { clear_features(); } void EST_Featured::init_features() { p_features=NULL; } void EST_Featured::clear_features() { if (p_features) { delete p_features; p_features=NULL; } init_features(); } const EST_Val &EST_Featured::f_Val(const char *name) const { if (p_features) return p_features->val(name); else return EST_Features::feature_default_value; } const EST_Val &EST_Featured::f_Val(const char *name, const EST_Val &def) const { if (p_features) return p_features->val(name); else return def; } void EST_Featured::copy_features(const EST_Featured &f) { clear_features(); if (f.p_features) p_features = new EST_Features(*(f.p_features)); } #if defined(INSTANTIATE_TEMPLATES) typedef EST_TKVI EST_Featured_Entry; Instantiate_TStructIterator_T(EST_Featured, EST_Featured::IPointer_feat,EST_Featured_Entry, Featured_itt) Instantiate_TIterator_T(EST_Featured, EST_Featured::IPointer_feat,EST_Featured_Entry, Featured_itt) #endif speech_tools/base_class/EST_Features.cc0000644000076400007640000001567611465017154016603 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* Feature value pairs in a EST_TKVL */ /*=======================================================================*/ #include #include "EST_Features.h" #include "ling_class/EST_Item.h" #include "EST_error.h" #include "EST_String.h" #include "EST_Token.h" /* Features may used as Vals */ VAL_REGISTER_CLASS(feats,EST_Features) EST_Val EST_Features::feature_default_value("0"); // Sometimes we need a set of features even though there aren't any static EST_Features default_features; EST_Features::EST_Features() { features = new EST_TKVL; } EST_Features::EST_Features(const EST_Features &f) { features = new EST_TKVL; *features = *f.features; } EST_Features::~EST_Features() { if (features != NULL) { delete features; features=NULL; } } const EST_Val &EST_Features::val(const char *name, const EST_Val &def) const { // Because so many access are from char* literals we all access // directly rather than requiring the creation of an EST_String EST_Litem *p; for (p=features->list.head(); p; p=p->next()) { if (features->list(p).k == name) return features->list(p).v; } return def; } const EST_Val &EST_Features::val(const char *name) const { // Because so many access are from char* literals we all access // directly rather than requiring the creation of an EST_String EST_Litem *p; for (p=features->list.head(); p; p=p->next()) { if (features->list(p).k == name) return features->list(p).v; } EST_error("{FND} Feature %s not defined\n", name); return feature_default_value; } const EST_Val &EST_Features::val_path(const EST_String &name, const EST_Val &d) const { // For when name contains references to sub-features if (strchr(name,'.') == NULL) return val(name, d); else { EST_String nname = name; EST_String fname = nname.before("."); const EST_Val &v = val(fname, d); if (v.type() == val_type_feats) return feats(v)->val_path(nname.after("."), d); else return d; } } const EST_Val &EST_Features::val_path(const EST_String &name) const { // For when name contains references to sub-features if (strchr(name,'.') == NULL) return val(name); else { EST_String nname = name; EST_String fname = nname.before("."); const EST_Val &v = val(fname); if (v.type() == val_type_feats) return feats(v)->val_path(nname.after(".")); else EST_error("Feature %s not feature valued\n", (const char *)fname); return feature_default_value; // wont get here } } EST_Features &EST_Features::A(const EST_String &path,EST_Features &def) const { EST_Features *ff = new EST_Features(def); return *feats(val(path,est_val(ff))); } int EST_Features::present(const EST_String &name) const { if (strchr(name,'.') == NULL) return features->present(name); EST_String nname = name; if (features->present(nname.before("."))) { const EST_Val &v = val(nname.before(".")); if (v.type() == val_type_feats) return feats(v)->present(nname.after(".")); else return FALSE; } else return FALSE; } void EST_Features::set_path(const EST_String &name, const EST_Val &sval) { // Builds sub features (if necessary) if (strchr(name,'.') == NULL) set_val(name,sval); else { EST_String nname = name; EST_String fname = nname.before("."); if (present(fname)) { const EST_Val &v = val(fname); if (v.type() == val_type_feats) feats(v)->set_path(nname.after("."),sval); else EST_error("Feature %s not feature valued\n", (const char *)fname); } else { EST_Features f; set(fname,f); A(fname).set_path(nname.after("."),sval); } } } EST_Features &EST_Features::operator=(const EST_Features &x) { *features = *x.features; return *this; } void merge_features(EST_Features &to,EST_Features &from) { EST_Features::Entries p; for(p.begin(from); p; ++p) to.set_val(p->k,p->v); } EST_String error_name(const EST_Features &a) { (void)a; return "<>"; } #if defined(INSTANTIATE_TEMPLATES) typedef EST_TKVI EST_Features_Entry; Instantiate_TStructIterator_T(EST_Features, EST_Features::IPointer, EST_Features_Entry, Features_itt) Instantiate_TIterator_T(EST_Features, EST_Features::IPointer, EST_Features_Entry, Features_itt) #endif speech_tools/base_class/EST_Pathname_win32.cc0000644000076400007640000001470610127000717017564 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Mar 18 1997 */ /************************************************************************/ /* */ /* Implementation of a class for manipulating filenames and so on. */ /* */ /* This is all hard coded to be unix filenames. I think the best */ /* strategy is to have a separate version of this for any other */ /* pathname format rather than trying to parameterise this. Most of */ /* it is fairly simple. */ /* */ /************************************************************************/ #include #include "EST_System.h" #include "EST_Pathname.h" void EST_Pathname::setup(void) { this->gsub("/", "\\"); } int EST_Pathname::is_absolute(void) const { return length()>0 && (*this)[0] == '\\'; } int EST_Pathname::is_dirname(void) const { return length()>0 && (*this)[length()-1] == '\\'; } EST_Pathname EST_Pathname::directory(void) const { if (is_dirname()) return *this; int pos; if ((pos=index("\\", -1)) >=0) return before(pos+1); else return ".\\"; } EST_Pathname EST_Pathname::as_file(void) const { if (is_filename()) return *this; if (length() > 0) return before(-1); return "."; } EST_Pathname EST_Pathname::as_directory(void) const { if (is_dirname()) return *this; if (length() > 0) return ((EST_String)(*this) + (EST_String)"\\"); return ".\\"; } EST_Pathname EST_Pathname::construct(EST_Pathname dir, EST_String filename) { EST_Pathname result(dir.as_directory()); result += filename; return result; } EST_Pathname EST_Pathname::construct(EST_Pathname dir, EST_String basename, EST_String extension) { EST_Pathname filename(basename + "." + extension); return EST_Pathname::construct(dir, filename); } EST_TList EST_Pathname::entries(int check_for_directories) const { WIN32_FIND_DATA find_data; HANDLE handle; EST_TList list; EST_Pathname pattern(this->as_directory() + EST_Pathname("*")); handle = FindFirstFile(pattern, &find_data); if (handle != INVALID_HANDLE_VALUE) while (1==1) { EST_Pathname name(find_data.cFileName); if (check_for_directories && (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) list.append(name.as_directory()); else list.append(name); if (!FindNextFile(handle, &find_data)) break; } FindClose(handle); return list; } EST_Pathname EST_Pathname::append(EST_Pathname directory, EST_Pathname addition) { if (addition.is_absolute()) return addition; EST_String add(addition); EST_Pathname result(directory.as_directory()); result.EST_String::operator += (add); return result; } EST_String EST_Pathname::extension(void) const { EST_String result(""); if (length() <= 0) return result; if (contains(".")) result = after(index(".",-1)); return result; } EST_Pathname EST_Pathname::filename(void) const { EST_String result(this->as_file()); if (contains("\\")) result = result.after(index("\\",-1)); return result; } EST_String EST_Pathname::basename(int remove_all) const { EST_String result(this->as_file().filename()); if (remove_all) { if (result.contains(".")) result = result.before("."); } return result; } EST_Pathname operator + (const EST_Pathname p, const EST_Pathname addition) {return EST_Pathname::append(p, addition); } EST_Pathname operator + (const char *p, const EST_Pathname addition) {return EST_Pathname::append(p, addition); } EST_Pathname &operator += (EST_Pathname p, const EST_Pathname addition) { p = EST_Pathname::append(p, addition); return p; } EST_Pathname &operator += (EST_Pathname p, const EST_String addition) { p = EST_Pathname::append(p, addition); return p; } speech_tools/base_class/EST_TList.cc0000644000076400007640000001152011465017154016044 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1995 */ /* --------------------------------------------------------------------- */ /* Template List Class */ /* */ /* Modified by RJC, 21/7/97. Now much of the working code is in the */ /* UList class, this template class provides a type safe front end to */ /* the untyped list. */ /* */ /*************************************************************************/ #include "EST_TList.h" template EST_TItem *EST_TItem::make(const T &val) { EST_TItem *it=NULL; if (s_free!=NULL) { void *mem = s_free; s_free=(EST_TItem *)s_free->n; s_nfree--; // Create an item in the retrieved memory. it=new (mem) EST_TItem(val); } else it = new EST_TItem(val); return it; } template void EST_TItem::release(EST_TItem *it) { if (0) // (s_nfree < s_maxFree) { // Destroy the value in case it holds resources. it->EST_TItem::~EST_TItem(); // I suppose it's a bit weird to use 'n' after calling the destructor. it->n=s_free; s_free=it; s_nfree++; } else { delete it; } } template void EST_TList::copy_items(const EST_TList &l) { EST_UItem *p; for (p = l.head(); p; p = p->next()) append(l.item(p)); } template void EST_TList::free_item(EST_UItem *item) { EST_TItem::release((EST_TItem *)item); } template EST_TList::EST_TList(const EST_TList &l) { init(); copy_items(l); } template void EST_TList::exchange_contents(EST_Litem *a,EST_Litem *b) { if(a==b) return; T temp; temp = ((EST_TItem *)a)->val; ((EST_TItem *)a)->val = ((EST_TItem *)b)->val; ((EST_TItem *)b)->val = temp; } template EST_TList &EST_TList::operator=(const EST_TList &a) { clear(); // clear out all current items in list. copy_items(a); return *this; } template EST_TList &EST_TList::operator+=(const EST_TList &a) { if (this == &a) { cerr << "EST_TList: error: tried to add list to itself\n"; return *this; } copy_items(a); return *this; } speech_tools/base_class/EST_TSortable.cc0000644000076400007640000000711110127000717016674 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Simon King, Richard Caley */ /* Date : November 1996 */ /* --------------------------------------------------------------------- */ /* Sorting order definitions. */ /* */ /*************************************************************************/ //#include //#include #include "EST_TSortable.h" // requires operators '<' and '>' for type T template bool EST_TSortable::items_eq(const EST_UItem *item1, const EST_UItem *item2) { return ((EST_TItem *)item1)->val == ((EST_TItem *)item2)->val; } template bool EST_TSortable::items_lt(const EST_UItem *item1, const EST_UItem *item2) { return ((EST_TItem *)item1)->val < ((EST_TItem *)item2)->val; } template bool EST_TSortable::items_gt(const EST_UItem *item1, const EST_UItem *item2) { return ((EST_TItem *)item1)->val > ((EST_TItem *)item2)->val; } speech_tools/base_class/EST_TKVL.cc0000644000076400007640000002041011465017154015563 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1995 */ /*-----------------------------------------------------------------------*/ /* Key/value List Class source file */ /* */ /*=======================================================================*/ #include #include "EST_TKVL.h" #include "EST_error.h" template EST_TKVL::EST_TKVL(const EST_TKVL &kv) { list = kv.list; } template void EST_TKVL::clear(void) { list.clear(); } template EST_Litem *EST_TKVL::find_pair_key(const K &key) const { EST_Litem *ptr; for (ptr = list.head(); ptr != 0; ptr= ptr->next()) if (list.item(ptr).k == key) return ptr; return 0; } template EST_Litem *EST_TKVL::find_pair_val(const V &val) const { EST_Litem *ptr; /// cout << "function list\n" << endl; for (ptr = list.head(); ptr != 0; ptr= ptr->next()) { // cout << "ff: " << list.item(ptr).k << endl; if (list.item(ptr).v == val) return ptr; } return 0; } // look for pointer kptr in list. If found, change its value to rval and // return true, otherwise return false. template int EST_TKVL::change_val(EST_Litem *kptr, const V &rval) { if (list.index(kptr) == -1) return 0; else { list.item(kptr).v = rval; return 1; } } template int EST_TKVL::change_key(EST_Litem *kptr, const K &rkey) { if (list.index(kptr) == -1) return 0; else { list.item(kptr).k = rkey; return 1; } } // look for key rkey in list. If found, change its value to rval and // return true, otherwise return false. template int EST_TKVL::change_val(const K &rkey,const V &rval) { EST_Litem *ptr=find_pair_key(rkey); if (ptr == 0) return 0; else { list.item(ptr).v = rval; return 1; } } // NOTE: This _MUST_NOT_ change the EST_TKVL, if it needs to, a separate // const version will need to replace the dummy one below. template V &EST_TKVL::val(const K &rkey, bool must) { EST_Litem *ptr = find_pair_key(rkey); if (ptr == 0) { if (must) EST_error("No value set for '%s'", error_name(rkey)); return *default_val; } else return list.item(ptr).v; } template const V &EST_TKVL::val(const K &rkey, bool must) const { return ((EST_TKVL *)this)->val(rkey, must); } template const V &EST_TKVL::val_def(const K &rkey, const V &def) const { EST_Litem *ptr = find_pair_key(rkey); if (ptr == 0) return def; else return list.item(ptr).v; } // NOTE: This _MUST_NOT_ change the EST_TKVL, if it needs to, a separate // const version will need to replace the dummy one below. template V &EST_TKVL::val(EST_Litem *kptr, bool must) { if (must == 0) return list.item(kptr).v; /* check kptr is one of mine */ if (list.index(kptr) == -1) { if (must) EST_error("No value set in EST_TKVL"); return *default_val; } else return list.item(kptr).v; } template const V &EST_TKVL::val(EST_Litem *kptr, bool must) const { return ((EST_TKVL *)this)->val(kptr, must); } // NOTE: This _MUST_NOT_ change the EST_TKVL, if it needs to, a separate // const version will need to replace the dummy one below. template K &EST_TKVL::key(EST_Litem *kptr, int must) { if (must == 0) return list.item(kptr).k; if (list.index(kptr) == -1) EST_error("No value set in EST_TKVL"); return list.item(kptr).k; } template const K &EST_TKVL::key(EST_Litem *kptr, int must) const { return ((EST_TKVL *)this)->key(kptr, must); } template const K &EST_TKVL::key(const V &v, int must) const { EST_Litem *ptr = find_pair_val(v); if (ptr == 0) { if (must) EST_error("No value set for '%s'", error_name(v)); return *default_key; } return list.item(ptr).k; } template const int EST_TKVL::present(const K &rkey) const { if (find_pair_key(rkey) == 0) return 0; else return 1; } // map a function over the pairs template void EST_TKVL::map(void (*func)(K&, V&)) { EST_Litem *p; for(p=list.head(); p; p=p->next()) { EST_TKVI item = list.item(p); (*func)(item.k, item.v); } } // add item to list. By default, the list is searched to see if the // item exists already. If so, its value is overwritten. This facility // can be turned off by setting no_search = 1; template int EST_TKVL::add_item(const K &rkey, const V &rval, int no_search) { if (!no_search) if (change_val(rkey, rval)) // first see if key exists return 1; EST_TKVI item; item.k = rkey; item.v = rval; list.append(item); return 1; } template int EST_TKVL::remove_item(const K &rkey, int quiet) { EST_Litem *ptr = find_pair_key(rkey); const char *en; if (ptr == 0) { if (!quiet) { en = error_name(rkey); EST_warning("EST_TKVL: no item labelled '%s'", en); } return -1; } else { list.remove(ptr); return 0; } } template EST_TKVL &EST_TKVL::operator = (const EST_TKVL &kv) { list = kv.list; return *this; } template EST_TKVL &EST_TKVL::operator += (const EST_TKVL &kv) { list += kv.list; return *this; } template EST_TKVL EST_TKVL::operator + (const EST_TKVL &kv) { EST_TKVL result; result = *this; result += kv; return result; } speech_tools/base_class/EST_TMatrix.cc0000644000076400007640000003672211146563675016422 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Rewritten : Richard Caley */ /* ------------------------------------------------------------------- */ /* Template EST_TMatrix Class */ /* */ /*************************************************************************/ #include "EST_TMatrix.h" #include #include #include "EST_bool.h" #include "EST_matrix_support.h" #include "EST_TVector.h" #include "EST_cutils.h" #include "EST_error.h" /* Construction and destruction */ template void EST_TMatrix::default_vals() { EST_TVector::default_vals(); p_num_rows = 0; p_row_step=0; } template EST_TMatrix::EST_TMatrix() { default_vals(); } template EST_TMatrix::EST_TMatrix(const EST_TMatrix &in) { default_vals(); copy(in); } template EST_TMatrix::EST_TMatrix(int rows, int cols) { default_vals(); resize(rows, cols); } template EST_TMatrix::EST_TMatrix(int rows, int cols, T *memory, int offset, int free_when_destroyed) { default_vals(); set_memory(memory, offset, rows, cols, free_when_destroyed); } template EST_TMatrix::~EST_TMatrix() { p_num_rows = 0; p_row_step=0; } /* Basic access */ template T &EST_TMatrix::a_check(int row, int col) { if (!EST_matrix_bounds_check(row, col, num_rows(), num_columns(), FALSE)) return *this->error_return; return a_no_check(row,col); } /* Since we know a() itself doesn't change the matrix, we can cast away * the const here. Isn't the C++ syntax beautiful! */ template const T &EST_TMatrix::a_check(int row, int col) const { return ((EST_TMatrix *)this)->a(row,col); } template void EST_TMatrix::copy_data(const EST_TMatrix &a) { set_values(a.p_memory, a.p_row_step, a.p_column_step, 0, a.num_rows(), 0, a.num_columns()); } template void EST_TMatrix::set_values(const T *data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c ) { for(int r=start_r, i=0, rp=0; i< num_r; i++, r++, rp+=r_step) for(int c=start_c, j=0, cp=0; j< num_c; j++, c++, cp+=c_step) a_no_check(r,c) = data[rp+cp]; } template void EST_TMatrix::get_values(T *data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c ) const { for(int r=start_r, i=0, rp=0; i< num_r; i++, r++, rp+=r_step) for(int c=start_c, j=0, cp=0; j< num_c; j++, c++, cp+=c_step) data[rp+cp] = a_no_check(r,c); } template void EST_TMatrix::copy(const EST_TMatrix &a) { resize(a.num_rows(), a.num_columns(), 0); copy_data(a); } template EST_TMatrix &EST_TMatrix::operator=(const EST_TMatrix &in) { copy(in); return *this; } template EST_TMatrix &EST_TMatrix::add_rows(const EST_TMatrix &in) { if (in.num_columns() != num_columns()) EST_error("Can't add rows with differnet number of columns (%d vs %d)", in.num_columns(), num_columns() ); else { int old_num_rows = num_rows(); resize(num_rows()+in.num_rows(), num_columns(), TRUE); for(int i=old_num_rows, i1=0; i EST_TMatrix &EST_TMatrix::add_columns(const EST_TMatrix &in) { if (in.num_rows() != num_rows()) EST_error("Can't add columns with differnet number of rows (%d vs %d)", in.num_rows(), num_rows() ); else { int old_num_columns = num_columns(); resize(num_columns()+in.num_columns(), num_rows(), TRUE); for(int i=old_num_columns, i1=0; i void EST_TMatrix::just_resize(int new_rows, int new_cols, T** old_vals) { T *new_m; if (num_rows() != new_rows || num_columns() != new_cols || this->p_memory == NULL ) { if (this->p_sub_matrix) EST_error("Attempt to resize Sub-Matrix"); if (new_cols < 0 || new_rows < 0) EST_error("Attempt to resize matrix to negative size: %d x %d", new_rows, new_cols); new_m = new T[new_rows*new_cols]; if (this->p_memory != NULL) { if (old_vals != NULL) *old_vals = this->p_memory; else if (!this->p_sub_matrix) delete [] (this->p_memory-this->p_offset); } p_num_rows = new_rows; this->p_num_columns = new_cols; this->p_offset=0; p_row_step=this->p_num_columns; this->p_column_step=1; this->p_memory = new_m; } else *old_vals = this->p_memory; } template void EST_TMatrix::resize(int new_rows, int new_cols, int set) { int i,j; T * old_vals = this->p_memory; int old_rows = num_rows(); int old_cols = num_columns(); int old_row_step = p_row_step; int old_offset = this->p_offset; int old_column_step = this->p_column_step; if (new_rows<0) new_rows = old_rows; if (new_cols<0) new_cols = old_cols; just_resize(new_rows, new_cols, &old_vals); if (set) { int copy_r = 0; int copy_c = 0; if (old_vals != NULL) { copy_r = Lof(num_rows(), old_rows); copy_c = Lof(num_columns(), old_cols); set_values(old_vals, old_row_step, old_column_step, 0, copy_r, 0, copy_c); } else { copy_r = old_rows; copy_c = old_cols; } for(i=0; idef_val; for(i=copy_r; idef_val; } if (old_vals && old_vals != this->p_memory && !this->p_sub_matrix) delete [] (old_vals-old_offset); } template bool EST_TMatrix::have_rows_before(int n) const { return this->p_offset >= n*p_row_step; } template bool EST_TMatrix::have_columns_before(int n) const { return this->p_offset >= n*this->p_column_step; } template void EST_TMatrix::fill(const T &v) { int i, j; for (i = 0; i < num_rows(); ++i) for (j = 0; j < num_columns(); ++j) fast_a_m(i,j) = v; } template EST_write_status EST_TMatrix::save(const EST_String &filename) const { int i, j; ostream *outf; if (filename == "-" || filename == "") outf = &cout; else outf = new ofstream(filename); for (i = 0; i < num_rows(); ++i) { for (j = 0; j < num_columns(); ++j) { *outf #if 0 << "{" < EST_read_status EST_TMatrix::load(const EST_String &filename) { // this function can only be written if we can find a way of parsing // an unknown type; (void) filename; EST_error("Matrix loading not implemented yet."); return misc_read_error; } template void EST_TMatrix::set_memory(T *buffer, int offset, int rows, int columns, int free_when_destroyed) { EST_TVector::set_memory(buffer, offset, columns, free_when_destroyed); p_num_rows = rows; p_row_step = columns; } template void EST_TMatrix::copy_row(int r, T *buf, int offset, int num) const { int to = num >= 0 ? offset + num : num_columns(); if (!EST_matrix_bounds_check(r, 0, num_rows(), num_columns(), FALSE)) { if (num_rows()>0) r=0; else return; } for (int j = offset; j < to; j++) buf[j-offset] = fast_a_m(r, j); } template void EST_TMatrix::copy_row(int r, EST_TVector &buf, int offset, int num) const { int to = num >= 0 ? offset + num : num_columns(); if (!EST_matrix_bounds_check(r, 0, num_rows(), num_columns(), FALSE)) { if (num_rows()>0) r=0; else return; } buf.resize(to - offset); for (int j = offset; j < to; j++) buf[j - offset] = fast_a_m(r, j); } template void EST_TMatrix::copy_column(int c, T *buf, int offset, int num) const { if (num_rows() == 0) return; int to = num >= 0 ? offset + num : num_rows(); if (!EST_matrix_bounds_check(0, c, num_rows(), num_columns(), FALSE)) { if (num_columns()>0) c=0; else return; } for (int i = offset; i < to; i++) buf[i-offset] = fast_a_m(i, c); } template void EST_TMatrix::copy_column(int c, EST_TVector &buf, int offset, int num) const { if (num_rows() == 0) return; int to = num >= 0 ? offset + num : num_rows(); if (!EST_matrix_bounds_check(0, c, num_rows(), num_columns(), FALSE)) { if( num_columns()>0 ) c=0; else return; } buf.resize(to - offset); for (int i = offset; i < to; i++) buf[i-offset] = fast_a_m(i, c); } template void EST_TMatrix::set_row(int r, const T *buf, int offset, int num) { int to = num>=0?offset+num:num_columns(); if (!EST_matrix_bounds_check(r, 0, num_rows(), num_columns(), TRUE)) return; for(int j=offset; j void EST_TMatrix::set_column(int c, const T *buf, int offset, int num) { int to = num>=0?offset+num:num_rows(); if (!EST_matrix_bounds_check(0, c, num_rows(), num_columns(), TRUE)) return; for(int i=offset; i void EST_TMatrix::set_row(int r, const EST_TMatrix &from, int from_r, int from_offset, int offset, int num) { int to = num>=0?offset+num:num_columns(); if (!EST_matrix_bounds_check(r, 0, num_rows(), num_columns(), TRUE)) return; if (!EST_matrix_bounds_check(from_r, 0, from.num_rows(), from.num_columns(), FALSE)) { if (from.num_rows()>0) from_r=0; else return; } for(int j=offset; j void EST_TMatrix::set_column(int c, const EST_TMatrix &from, int from_c, int from_offset, int offset, int num) { int to = num>=0?offset+num:num_rows(); if (!EST_matrix_bounds_check(0, c, num_rows(), num_columns(), TRUE)) return; if (!EST_matrix_bounds_check(0, from_c, from.num_rows(), from.num_columns(), FALSE)) { if (from.num_columns()>0) from_c=0; else return; } for(int i=offset; i void EST_TMatrix::row(EST_TVector &rv, int r, int start_c, int len) { if (len < 0) len = num_columns()-start_c; if (!EST_matrix_bounds_check(r, 1, start_c, len, num_rows(), num_columns(), 0)) return; if (rv.p_memory != NULL && ! rv.p_sub_matrix) delete [] (rv.p_memory - rv.p_offset); rv.p_sub_matrix = TRUE; rv.p_num_columns = len; rv.p_offset = this->p_offset + start_c*this->p_column_step + r*p_row_step; rv.p_memory = this->p_memory - this->p_offset + rv.p_offset; // cout << "mrow: mem: " << rv.p_memory << " (" << (int)rv.p_memory << ")\n"; // cout << "mrow: ofset: " << rv.p_offset << " (" << (int)rv.p_offset << ")\n"; rv.p_column_step=this->p_column_step; } template void EST_TMatrix::column(EST_TVector &cv, int c, int start_r, int len) { if (len < 0) len = num_rows()-start_r; if (!EST_matrix_bounds_check(start_r, len, c, 1,num_rows(), num_columns(), 0)) return; if (cv.p_memory != NULL && ! cv.p_sub_matrix) delete [] (cv.p_memory - cv.p_offset); cv.p_sub_matrix = TRUE; cv.p_num_columns = len; cv.p_offset = this->p_offset + c*this->p_column_step + start_r*p_row_step; cv.p_memory = this->p_memory - this->p_offset + cv.p_offset; // cout << "mcol: mem: " << cv.p_memory << " (" << (int)cv.p_memory << ")\n"; // cout << "mcol: offset: " << cv.p_offset << " (" << (int)cv.p_offset << ")\n"; cv.p_column_step=p_row_step; } template void EST_TMatrix::sub_matrix(EST_TMatrix &sm, int r, int len_r, int c, int len_c) { if (len_r < 0) len_r = num_rows()-r; if (len_c < 0) len_c = num_columns()-c; if (!EST_matrix_bounds_check(r, len_r, c, len_c, num_rows(), num_columns(), 0)) return; if (sm.p_memory != NULL && ! sm.p_sub_matrix) delete [] (sm.p_memory - sm.p_offset); sm.p_sub_matrix = TRUE; sm.p_offset = this->p_offset + c*this->p_column_step + r*p_row_step; sm.p_memory = this->p_memory - this->p_offset + sm.p_offset; sm.p_row_step=p_row_step; sm.p_column_step=this->p_column_step; sm.p_num_rows = len_r; sm.p_num_columns = len_c; } speech_tools/base_class/EST_TSimpleMatrix.cc0000644000076400007640000001436111147002570017546 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Oct 10 1997 */ /* -------------------------------------------------------------------- */ /* A subclass of TMatrix which copies using memcopy. This isn't */ /* suitable for matrices of class objects which have to be copied */ /* using a constructor or specialised assignment operator. */ /* */ /*************************************************************************/ #include "EST_TSimpleMatrix.h" #include "EST_TVector.h" #include #include #include "EST_cutils.h" template void EST_TSimpleMatrix::copy_data(const EST_TSimpleMatrix &a) { if (!a.p_sub_matrix && !this->p_sub_matrix) memcpy((void *)&this->a_no_check(0,0), (const void *)&a.a_no_check(0,0), this->num_rows()*this->num_columns()*sizeof(T) ); else { for (int i = 0; i < this->num_rows(); ++i) for (int j = 0; j < this->num_columns(); ++j) this->a_no_check(i,j) = a.a_no_check(i,j); } } template void EST_TSimpleMatrix::copy(const EST_TSimpleMatrix &a) { if (this->num_rows() != a.num_rows() || this->num_columns() != a.num_columns()) resize(a.num_rows(), a.num_columns(), 0); copy_data(a); } template EST_TSimpleMatrix::EST_TSimpleMatrix(const EST_TSimpleMatrix &in) { copy(in); } template void EST_TSimpleMatrix::resize(int new_rows, int new_cols, int set) { T* old_vals=NULL; int old_offset = this->p_offset; unsigned int q; if (new_rows<0) new_rows = this->num_rows(); if (new_cols<0) new_cols = this->num_columns(); if (set) { if (!this->p_sub_matrix && new_cols == this->num_columns() && new_rows != this->num_rows()) { int copy_r = Lof(this->num_rows(), new_rows); just_resize(new_rows, new_cols, &old_vals); for (q=0; q<(copy_r*new_cols*sizeof(T)); q++) /* memcpy */ ((char *)this->p_memory)[q] = ((char *)old_vals)[q]; int i,j; if (new_rows > copy_r) { if (*this->def_val == 0) { for (q=0; q<(new_rows-copy_r)*new_cols*sizeof(T); q++) /* memset */ ((char *)(this->p_memory + copy_r*this->p_row_step))[q] = 0; } else { for(j=0; ja_no_check(i,j) = *this->def_val; } } } else if (!this->p_sub_matrix) { int old_row_step = this->p_row_step; int old_column_step = this->p_column_step; int copy_r = Lof(this->num_rows(), new_rows); int copy_c = Lof(this->num_columns(), new_cols); just_resize(new_rows, new_cols, &old_vals); set_values(old_vals, old_row_step, old_column_step, 0, copy_r, 0, copy_c); int i,j; for(i=0; ia_no_check(i,j) = *this->def_val; if (new_rows > copy_r) { if (*this->def_val == 0) { for (q=0; q<((new_rows-copy_r)*new_cols*sizeof(T)); q++) /* memset */ ((char *)(this->p_memory + copy_r*this->p_row_step))[q] = 0; } else { for(j=0; ja_no_check(i,j) = *this->def_val; } } } else EST_TMatrix::resize(new_rows, new_cols, 1); } else EST_TMatrix::resize(new_rows, new_cols, 0); if (old_vals && old_vals != this->p_memory) delete [] (old_vals-old_offset); } template EST_TSimpleMatrix &EST_TSimpleMatrix::operator=(const EST_TSimpleMatrix &in) { copy(in); return *this; } speech_tools/base_class/EST_TVector.cc0000644000076400007640000002031311146564712016376 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1995 */ /* --------------------------------------------------------------------- */ /* Template Vector Class */ /* */ /*************************************************************************/ #include #include #include "EST_TVector.h" #include "EST_matrix_support.h" #include "EST_cutils.h" #include "EST_error.h" template void EST_TVector::default_vals() { p_num_columns = 0; p_offset=0; p_column_step=0; p_memory = NULL; p_sub_matrix=FALSE; } template EST_TVector::EST_TVector() { default_vals(); } template EST_TVector::EST_TVector(int n) { default_vals(); resize(n); } template EST_TVector::EST_TVector(const EST_TVector &in) { default_vals(); copy(in); } template EST_TVector::EST_TVector(int n, T *memory, int offset, int free_when_destroyed) { default_vals(); set_memory(memory, offset, n, free_when_destroyed); } template EST_TVector::~EST_TVector() { p_num_columns = 0; p_offset=0; p_column_step=0; if (p_memory != NULL && !p_sub_matrix) { delete [] (p_memory-p_offset); p_memory = NULL; } } template void EST_TVector::fill(const T &v) { for (int i = 0; i < num_columns(); ++i) fast_a_v(i) = v; } template void EST_TVector::set_memory(T *buffer, int offset, int columns, int free_when_destroyed) { if (p_memory != NULL && !p_sub_matrix) delete [] (p_memory-p_offset); p_memory = buffer-offset; p_offset=offset; p_num_columns = columns; p_column_step=1; p_sub_matrix = !free_when_destroyed; } template void EST_TVector::set_values(const T *data, int step, int start_c, int num_c) { for(int i=0, c=start_c, p=0; i void EST_TVector::get_values(T *data, int step, int start_c, int num_c) const { for(int i=0, c=start_c, p=0; i void EST_TVector::copy_data(const EST_TVector &a) { set_values(a.p_memory, a.p_column_step, 0, num_columns()); } template void EST_TVector::copy(const EST_TVector &a) { resize(a.n(), FALSE); copy_data(a); } template void EST_TVector::just_resize(int new_cols, T** old_vals) { T *new_m; if (num_columns() != new_cols || p_memory == NULL ) { if (p_sub_matrix) EST_error("Attempt to resize Sub-Vector"); if (new_cols < 0) EST_error("Attempt to resize vector to negative size: %d", new_cols); new_m = new T[new_cols]; if (p_memory != NULL) { if (old_vals != NULL) *old_vals = p_memory; else if (!p_sub_matrix) delete [] (p_memory-p_offset); } p_memory = new_m; //cout << "vr: mem: " << p_memory << " (" << (int)p_memory << ")\n"; p_offset=0; p_num_columns = new_cols; p_column_step=1; } else *old_vals = p_memory; } template void EST_TVector::resize(int new_cols, int set) { int i; T * old_vals = p_memory; int old_cols = num_columns(); int old_offset = p_offset; int old_column_step = p_column_step; just_resize(new_cols, &old_vals); if (set) { int copy_c = 0; if (!old_vals) copy_c=0; else if (old_vals != p_memory) { copy_c = Lof(num_columns(), old_cols); for(i=0; i EST_TVector &EST_TVector::operator=(const EST_TVector &in) { copy(in); return *this; } template T &EST_TVector::a_check(int n) { if (!EST_vector_bounds_check(n, num_columns(), FALSE)) return *error_return; return fast_a_v(n); } template const T &EST_TVector::a_check(int n) const { return ((EST_TVector *)this)->a(n); } template int EST_TVector::operator == (const EST_TVector &v) const { if (num_columns() != v.num_columns()) return 0; for(int i=0; i void EST_TVector::copy_section(T* dest, int offset, int num) const { if (num<0) num = num_columns()-offset; if (!EST_vector_bounds_check(num+offset-1, num_columns(), FALSE)) return; for(int i=0; i void EST_TVector::set_section(const T* src, int offset, int num) { if (num<0) num = num_columns()-offset; if (!EST_vector_bounds_check(num+offset-1, num_columns(), FALSE)) return; for(int i=0; i void EST_TVector::sub_vector(EST_TVector &sv, int start_c, int len) { if (len < 0) len = num_columns()-start_c; if (sv.p_memory != NULL && ! sv.p_sub_matrix) delete [] (sv.p_memory - sv.p_offset); sv.p_sub_matrix = TRUE; sv.p_offset = p_offset + start_c*p_column_step; sv.p_memory = p_memory - p_offset + sv.p_offset; sv.p_column_step=p_column_step; sv.p_num_columns = len; } template void EST_TVector::integrity() const { cout << "integrity: p_memory=" << p_memory << endl; if(p_memory == (T *)0x00080102) { cout << "fatal value!!!\n"; } } speech_tools/base_class/EST_TSimpleVector.cc0000644000076400007640000001330611147002247017543 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Oct 10 1997 */ /* -------------------------------------------------------------------- */ /* A subclass of TVector which copies using memcopy. This isn't */ /* suitable for matrices of class objects which have to be copied */ /* using a constructor or specialised assignment operator. */ /* */ /*************************************************************************/ #include "EST_TSimpleVector.h" #include "EST_matrix_support.h" #include #include "EST_cutils.h" template void EST_TSimpleVector::copy(const EST_TSimpleVector &a) { if (this->p_column_step==1 && a.p_column_step==1) { resize(a.n(), FALSE); memcpy((void *)(this->p_memory), (const void *)(a.p_memory), this->n() * sizeof(T)); } else ((EST_TVector *)this)->copy(a); } template EST_TSimpleVector::EST_TSimpleVector(const EST_TSimpleVector &in) { this->default_vals(); copy(in); } // should copy from and delete old version first template void EST_TSimpleVector::resize(int newn, int set) { int oldn = this->n(); T *old_vals =NULL; int old_offset = this->p_offset; unsigned int q; just_resize(newn, &old_vals); if (set && old_vals) { int copy_c = 0; if (this->p_memory != NULL) { copy_c = Lof(this->n(), oldn); for (q=0; qp_memory)[q] = ((char *)old_vals)[q]; } for (int i=copy_c; i < this->n(); ++i) this->p_memory[i] = *this->def_val; } if (old_vals != NULL && old_vals != this->p_memory && !this->p_sub_matrix) delete [] (old_vals - old_offset); } template void EST_TSimpleVector::copy_section(T* dest, int offset, int num) const { unsigned int q; if (num<0) num = this->num_columns()-offset; if (!EST_vector_bounds_check(num+offset-1, this->num_columns(), FALSE)) return; if (!this->p_sub_matrix && this->p_column_step==1) { for (q=0; qp_memory+offset))[q]; } else for(int i=0; ia_no_check(offset+i); } template void EST_TSimpleVector::set_section(const T* src, int offset, int num) { unsigned int q; if (num<0) num = this->num_columns()-offset; if (!EST_vector_bounds_check(num+offset-1, this->num_columns(), FALSE)) return; if (!this->p_sub_matrix && this->p_column_step==1) { for (q=0; qp_memory+offset))[q] = ((char *)(src))[q]; } else for(int i=0; ia_no_check(offset+i) = src[i]; } template EST_TSimpleVector &EST_TSimpleVector::operator=(const EST_TSimpleVector &in) { copy(in); return *this; } template void EST_TSimpleVector::zero() { if (this->p_column_step==1) memset((void *)(this->p_memory), 0, this->n() * sizeof(T)); else ((EST_TVector *)this)->fill(*this->def_val); } speech_tools/base_class/EST_THash.cc0000644000076400007640000001635307262605664016036 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Apr 4 1997 */ /************************************************************************/ /* */ /* Simple Hash classes. */ /* */ /************************************************************************/ #include "EST_THash.h" template EST_THash::EST_THash(int size, unsigned int (*hash_function)(const K &key, unsigned int size)) { p_num_entries =0; p_num_buckets = size; p_buckets = new EST_Hash_Pair *[size]; for(int i=0; i EST_THash::EST_THash(const EST_THash &from) { p_buckets=NULL; copy(from); } template void EST_THash::clear(void) { if (p_buckets != NULL) { for(unsigned int i=0; i *p, *n; for(p=p_buckets[i]; p != NULL; p=n) { n = p->next; delete p; } p_buckets[i]=NULL; } } p_num_entries=0; } template EST_THash::~EST_THash(void) { if (p_buckets) { clear(); delete[] p_buckets; } } template int EST_THash::present(const K &key) const { unsigned int b; if (p_hash_function) b = (*p_hash_function)(key, p_num_buckets); else b = DefaultHashFunction((void *)&key, sizeof(key), p_num_buckets); EST_Hash_Pair *p; for(p=p_buckets[b]; p!=NULL; p=p->next) if (p->k == key) return TRUE; return FALSE; } template V &EST_THash::val(const K &key, int &found) const { unsigned int b; if (p_hash_function) b = (*p_hash_function)(key, p_num_buckets); else b = DefaultHashFunction((void *)&key, sizeof(key), p_num_buckets); EST_Hash_Pair *p; for(p=p_buckets[b]; p!=NULL; p=p->next) if (p->k == key) { found=1; return p->v; } found=0; return Dummy_Value; } template const K &EST_THash::key(const V &val, int &found) const { for(unsigned int b=0; b *p; for(p=p_buckets[b]; p!=NULL; p=p->next) if (p->v == val) { found=1; return p->k; } } found=0; return Dummy_Key; } template void EST_THash::map(void (*func)(K&, V&)) { for(unsigned int i=0; i *p; for(p=p_buckets[i]; p!=NULL; p=p->next) (*func)(p->k, p->v); } } template int EST_THash::add_item(const K &key, const V &value, int no_search) { unsigned int b; if (p_hash_function) b = (*p_hash_function)(key, p_num_buckets); else b = DefaultHashFunction((void *)&key, sizeof(key), p_num_buckets); EST_Hash_Pair *p; if (!no_search) for(p=p_buckets[b]; p!=NULL; p=p->next) if (p->k == key) { p->v = value; return FALSE; } p = new EST_Hash_Pair; p->k = key; p->v = value; p->next = p_buckets[b]; p_buckets[b] = p; p_num_entries++; return TRUE; } template int EST_THash::remove_item(const K &rkey, int quiet) { unsigned int b; if (p_hash_function) b = (*p_hash_function)(rkey, p_num_buckets); else b = DefaultHashFunction((void *)&rkey, sizeof(rkey), p_num_buckets); EST_Hash_Pair **p; for (p = &(p_buckets[b]); *p!=NULL; p=&((*p)->next)) if ( (*p)->k == rkey ) { EST_Hash_Pair *n = (*p)->next; delete *p; *p = n; p_num_entries--; return 0; } if (!quiet) cerr << "THash: no item labelled \"" << rkey << "\"" << endl; return -1; } template EST_THash &EST_THash::operator = (const EST_THash &from) { copy(from); return *this; } template void EST_THash::dump(ostream &stream, int all) { for(unsigned int i=0; i *p; for(p=p_buckets[i]; p!=NULL; p=p->next) stream << "[" << p->k << "],(" << p->v << ") "; stream << "\n"; } } template void EST_THash::copy(const EST_THash &from) { clear(); p_num_entries = from.p_num_entries; p_num_buckets = from.p_num_buckets; p_hash_function = from.p_hash_function; if (p_buckets != NULL) delete [] p_buckets; p_buckets = new EST_Hash_Pair *[p_num_buckets]; for(unsigned int b=0; b *p=from.p_buckets[b]; p; p=p->next) { EST_Hash_Pair *n = new EST_Hash_Pair(*p); n->next = p_buckets[b]; p_buckets[b]=n; } } } speech_tools/base_class/EST_Tvectlist.cc0000644000076400007640000000672411465017154017000 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Vector/List conversion templates */ /* only include this if you define both vectors and lists for the class */ /* */ /*=======================================================================*/ #include #include "EST_TList.h" #include "EST_TVector.h" #include "EST_cutils.h" template EST_TVector &set(EST_TVector &v, const EST_TList &in) { v.resize(in.length(), FALSE); EST_Litem *p; int i = 0; for (p = in.head(); p!= 0; p = p->next(), ++i) v.a_no_check(i) = in.item(p); return v; } template EST_TVector ©(EST_TVector a,const EST_TList &in) { a.resize(in.length(), FALSE); EST_Litem *p; int i = 0; for (p = in.head(); p!= 0; p = p->next(), ++i) a[i] = in.item(p); return a; } speech_tools/base_class/EST_TTimeIndex.cc0000644000076400007640000001143107262605664017031 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Mar 25 1998 */ /* -------------------------------------------------------------------- */ /* Indexing a container by time. */ /* */ /*************************************************************************/ #include "EST_TTimeIndex.h" template void EST_TTimeIndex::initialise() { p_time_step=0; p_entries.resize(0); } template EST_TTimeIndex::EST_TTimeIndex() { initialise(); } template EST_TTimeIndex::EST_TTimeIndex(CONTAINER &c, int bunch) { initialise(); index(c, bunch); } template void EST_TTimeIndex::index(CONTAINER &c, int bunch) { int n_objects = c.length(); float total_time = c.end(); int n_buckets = n_objects/bunch +1; p_time_step = total_time / n_buckets; p_entries.resize(n_buckets); p_container = &c; Index i; i=c.first_index(); p_entries[0].t = 0.0; p_entries[0].i = i; for(; c.valid_index(i); i=c.next_index(i)) { float t = c.time_of(i); int b = (int)(t/p_time_step); if (b>=p_entries.num_columns()) b = p_entries.num_columns()-1; for (int bb=b+1; bb < n_buckets ; bb++) if ( t > p_entries(bb).t ) { p_entries[bb].t = t; p_entries[bb].i = i; } else break; } } template void EST_TTimeIndex::just_before(float t, void *inp) const { CONTAINER::Index &in(*(Index *)inp); in= CONTAINER::bad_index(); if (p_container==NULL) return; int b = (int)(t/p_time_step); if (b>=p_entries.num_columns()) b = p_entries.num_columns()-1; Index i = p_entries(b).i; for(Index j=i; p_container->valid_index(j); j = p_container->next_index(j)) { if (p_container->time_of(j) > t) { in=i; return; } i=j; } in =i; return; } template int operator !=(const EST_TTI_Entry &e1, const EST_TTI_Entry &e2) { (void)e1; (void)e2; return 1; } template ostream& operator <<(ostream &s, const EST_TTI_Entry &e) { (void)e; return s << "entry"; } speech_tools/base_class/EST_TDeque.cc0000644000076400007640000001441510455716274016211 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Double ended queue. */ /* */ /* Implemented in a vector used as a circular buffer. When more space */ /* is needed we expand the vector and copy the data to the beginning */ /* of the buffer. */ /* */ /*************************************************************************/ #include "EST_error.h" #include "EST_TDeque.h" template EST_TDeque::EST_TDeque(unsigned int capacity, unsigned int increment) : p_vector(capacity) { p_increment = increment; p_front=0; p_back=0; } template EST_TDeque::EST_TDeque(unsigned int capacity) : p_vector(capacity) { p_increment = 10; p_front=0; p_back=0; } template EST_TDeque::EST_TDeque() { p_vector.resize(10); p_increment = 10; p_front=0; p_back=0; } template ostream &EST_TDeque::print(ostream &s) const { s << "{" << p_vector.n() << "|"; if (p_front >= p_back) { for(int i0=0; i0" << "//"; for(int i=p_back; i" << "//"; } else { for(int ii=0; ii" << "//"; for(int i=p_back; i void EST_TDeque::expand() { EST_TVector tmp(p_vector); if (p_back==0) // special case for pure stack p_vector.resize(p_vector.n()+p_increment, true); else { p_vector.resize(p_vector.n()+p_increment, false); if (p_front >= p_back) for(int i=p_back, j=0; i bool EST_TDeque::is_empty() const { return p_front==p_back; } template void EST_TDeque::clear() { p_front=p_back=0; for(int i=0; i void EST_TDeque::push(T& it) { int next_front= p_front+1; if (next_front >= p_vector.n()) next_front= 0; if (next_front==p_back) { expand(); push(it); } else { p_vector[p_front] = it; p_front=next_front; } } template T &EST_TDeque::pop() { if (is_empty()) EST_error("empty stack!"); p_front--; if (p_front < 0) p_front=p_vector.n()-1; return p_vector[p_front]; } template T &EST_TDeque::nth(int n) { if (is_empty()) EST_error("empty stack!"); int pos = p_front-1-n; if (p_front < p_back) { if (pos < 0) { pos += p_vector.n(); if (pos < p_back) EST_error("looking too far up stack!"); } } else if (pos < p_back) EST_error("looking too far up stack!"); return p_vector[pos]; } template void EST_TDeque::back_push(T& it) { int next_back = p_back-1; if (next_back < 0) next_back = p_vector.n()-1; if (next_back == p_front) { expand(); back_push(it); } else { p_vector[p_back=next_back] = it; } } template T &EST_TDeque::back_pop() { if (is_empty()) EST_error("empty stack!"); int old_back = p_back; p_back++; if (p_back >= p_vector.n()) p_back=0; return p_vector[old_back]; } speech_tools/base_class/EST_TBuffer.cc0000644000076400007640000001230110127000717016327 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Extending buffers, i.e. arrays which grow as needed. I got fed up */ /* of writing this code all over the place. */ /* */ /*************************************************************************/ #include #include #include #include "EST_unix.h" #include "EST_TBuffer.h" template EST_TBuffer::EST_TBuffer(unsigned int size, int step) { p_buffer = NULL; init(size, step); } template EST_TBuffer::~EST_TBuffer(void) { // save the buffer if we have a slot for(int i=0; i void EST_TBuffer::init(unsigned int size, int step) { for(int i=0; i= size) { p_buffer = (T *)EST_old_buffers[i].mem; p_size = EST_old_buffers[i].size/sizeof(T); EST_old_buffers[i].mem = NULL; EST_old_buffers[i].size = 0; break; } if (p_buffer == NULL) { p_buffer = new T[size]; p_size = size; } p_step = step; } template void EST_TBuffer::expand_to(unsigned int req_size, bool copy) { if (req_size > p_size) { unsigned int new_size = p_size; while(new_size < req_size) if (p_step >0) new_size += p_step; else new_size = (int)(new_size*(float)(-p_step)/100.0); T * new_buffer = new T[new_size]; if (copy) memcpy(new_buffer, p_buffer, p_size*sizeof(T)); delete[] p_buffer; p_buffer = new_buffer; p_size = new_size; } } template void EST_TBuffer::expand_to(unsigned int req_size, const T &set_to, int howmany) { if (req_size > p_size) { unsigned int new_size = p_size; while(new_size < req_size) if (p_step >0) new_size += p_step; else new_size = (int)(new_size*(float)(-p_step)/100.0); T * new_buffer = new T[new_size]; if (howmany<0) howmany=new_size; for(int i=0; i void EST_TBuffer::set(const T &set_to, int howmany) { if (howmany < 0) howmany = p_size; for(int i=0; i #include #include #include "EST_walloc.h" #include "EST_TNamedEnum.h" // This only takes a void * because I can't manage to get the // parameter declaration in the definition past gcc with the actual type. template void EST_TValuedEnumI::initialise(const void *vdefs) { int n=0; typedef EST_TValuedEnumDefinition defn; const defn *defs = (const defn *)vdefs; for(n=1; defs[n].token != defs[0].token; n++) ; this->ndefinitions = n; this->definitions = new defn[n]; this->definitions[0] = defs[0]; for(n=1; defs[n].token != defs[0].token; n++) this->definitions[n] = defs[n]; this->p_unknown_enum = defs[n].token; this->p_unknown_value = defs[n].values[0]; } template void EST_TValuedEnumI::initialise(const void *vdefs, ENUM (*conv)(const char *)) { int n=0; // const struct EST_TValuedEnumDefinition *defs = (const struct EST_TValuedEnumDefinition *)vdefs; typedef EST_TValuedEnumDefinition _EST_TMPNAME; const _EST_TMPNAME *defs = (const _EST_TMPNAME *)vdefs; // fprintf(stderr, "start setup\n"); for(n=1; strcmp(defs[n].token, defs[0].token) != 0; n++) { //const char *a = defs[0].token; // const char *b = defs[n].token; // fprintf(stderr, ": %d '%s' '%s'\n", n, defs[n].token, defs[0].token); } this->ndefinitions = n; typedef EST_TValuedEnumDefinition defn; this->definitions = new defn[n]; this->definitions[0].token = conv(defs[0].token); for(int i=0; idefinitions[0].values[i] = defs[0].values[i]; this->definitions[0].info = defs[0].info; for(n=1; strcmp(defs[n].token, defs[0].token) != 0; n++) { this->definitions[n].token = conv(defs[n].token); for(int i2=0; i2definitions[n].values[i2] = defs[n].values[i2]; this->definitions[n].info = defs[n].info; } this->p_unknown_enum = conv(defs[n].token); this->p_unknown_value = defs[n].values[0]; } template EST_TValuedEnumI::~EST_TValuedEnumI(void) { if (this->definitions) delete[] this->definitions; } template int EST_TValuedEnumI::n(void) const { return this->ndefinitions; } template VAL EST_TValuedEnumI::value (ENUM token, int n) const { int i; for(i=0; indefinitions; i++) if (this->definitions[i].token == token) return this->definitions[i].values[n]; return this->p_unknown_value; } template INFO &EST_TValuedEnumI::info (ENUM token) const { int i; for(i=0; indefinitions; i++) if (this->definitions[i].token == token) return this->definitions[i].info; cerr << "Fetching info for invalid entry\n"; abort(); static INFO dummyI; return dummyI; } template ENUM EST_TValuedEnumI::nth_token (int n) const { if (n>=0 && n < this->ndefinitions) return this->definitions[n].token; return this->p_unknown_enum; } template ENUM EST_TValuedEnumI::token (VAL value) const { int i,j; for(i=0; indefinitions; i++) for(j=0; jdefinitions[i].values[j] ; j++) if (eq_vals(this->definitions[i].values[j], value)) return this->definitions[i].token; return this->p_unknown_enum; } template EST_read_status EST_TNamedEnum::priv_load(EST_String name, EST_TNamedEnum *definitive) { typedef EST_TValuedEnumDefinition Defn; #define LINE_LENGTH (1024) EST_String line(NULL, 'x', LINE_LENGTH); char *buffer = (char *)line; EST_String tokens[NAMED_ENUM_MAX_SYNONYMS+2]; FILE *file; char quote = '\0'; int have_unknown=0; int n=0; if ((file=fopen(name, "rb"))==NULL) return misc_read_error; if (this->definitions) delete[] this->definitions; this->ndefinitions= -1; this->definitions=NULL; buffer[LINE_LENGTH-1] = 'x'; while (fgets(buffer, LINE_LENGTH, file)) { if ( buffer[LINE_LENGTH-1] != 'x') { cerr << "line too long .. '" << buffer << "'\n"; return wrong_format; } if (this->ndefinitions>=0 && quote != '\0' && buffer[0] == '=') { // definition by number if ( n>= this->ndefinitions) { cerr << "too many definitions\n"; return wrong_format; } int ntokens = split(line, tokens, NAMED_ENUM_MAX_SYNONYMS+2, RXwhite, '"'); this->definitions[n].token = (ENUM)atoi(tokens[0].after(0,1)); for(int i=1; idefinitions[n].values[i-1] = wstrdup(tokens[i].unquote_if_needed(quote)); for(int j=ntokens-1 ; j< NAMED_ENUM_MAX_SYNONYMS; j++) this->definitions[n].values[j]=NULL; n++; } else if (have_unknown && this->ndefinitions>=0 && quote != '\0' && buffer[0] == quote) { // definition by standard name if (!definitive) { cerr << "can't use names in this definition\n"; return wrong_format; } if ( n>= this->ndefinitions) { cerr << "too many definitions\n"; return wrong_format; } int ntokens = split(line, tokens, NAMED_ENUM_MAX_SYNONYMS+2, RXwhite, quote); this->definitions[n].token = definitive->token(tokens[0].unquote(quote)); for(int i=1; idefinitions[n].values[i-1] = wstrdup(tokens[i].unquote_if_needed(quote)); for(int j=ntokens-1 ; j< NAMED_ENUM_MAX_SYNONYMS; j++) this->definitions[n].values[j]=NULL; n++; } else { // parameter int mlen; int eq = line.search("=", 1, mlen); if (eq <0) { cerr << "bad header line '" << line; return wrong_format; } EST_String key(line.before(eq)); if (key == "quote") { quote = line[eq+1]; // cout << "quote = '" << quote << "'\n"; } else if (key == "number") { this->ndefinitions=atoi(line.after(eq,1)); // cout << "n = '" << ndefinitions << "'\n"; this->definitions = new Defn[this->ndefinitions]; for(int i=0; indefinitions; i++) this->definitions[i].values[0] =NULL; n=0; } else if (key == "unknown") { this->p_unknown_enum=(ENUM)atoi(line.after(eq,1)); // cout << "unknown = '" << p_unknown_enum << "'\n"; have_unknown=1; } else { cerr << "bad header line '" << line; return wrong_format; } } } fclose(file); return format_ok; } template EST_write_status EST_TNamedEnum::priv_save(EST_String name, EST_TNamedEnum *definitive, char quote) const { FILE *file; if ((file=fopen(name, "wb"))==NULL) return write_fail; fprintf(file, "unknown=%d\n", this->p_unknown_enum); fprintf(file, "quote=%c\n", quote); fprintf(file, "number=%d\n", this->ndefinitions); for(int i=0; indefinitions; i++) if (this->definitions[i].values[0]) { if (definitive) fprintf(file, "%s ", (const char *)EST_String(definitive->name(this->definitions[i].token)).quote(quote)); else fprintf(file, "=%d ", (int)this->definitions[i].token); for(int j=0; jdefinitions[i].values[j] != NULL; j++) fprintf(file, "%s ", (const char *) EST_String(this->definitions[i].values[j]).quote_if_needed(quote)); fputc('\n', file); } fclose(file); return write_ok; } speech_tools/base_class/EST_matrix_support.h0000644000076400007640000000604110045556420017746 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_MATRIX_SUPPORT_H__ #define __EST_MATRIX_SUPPORT_H__ /** Support functions for all matrices. * * @author Richard Caley * @version $Id: EST_matrix_support.h,v 1.3 2004/05/04 00:00:16 awb Exp $ */ bool EST_matrix_bounds_check(int r, int c, int num_rows, int num_columns, bool set); bool EST_matrix_bounds_check(int r, int nr, int c, int nc, int num_rows, int num_columns, bool set); bool EST_vector_bounds_check(int c, int num_columns, bool set); bool EST_vector_bounds_check(int c, int nc, int num_columns, bool set); #endif speech_tools/base_class/rateconv.h0000644000076400007640000000535007262616577015777 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name rateconv.h * * Just declares the resampling function. * * @author Richard Caley * @version $Id: rateconv.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ #ifndef __RATECONV_H__ #define __RATECONV_H__ int rateconv(short *in,int isize, short **out, int *osize, int in_samp_freq, int out_samp_freq); #endif //@} speech_tools/base_class/EST_get_function_template.h0000644000076400007640000000761207262605664021246 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Uses preprocessor to define a template for asafe feature access */ /* function. This is just here to avoid massive duplication. */ /* */ /*************************************************************************/ #include "EST_features_aux.h" #define defineGetFunction(FTYPE, VAL, RTYPE, NAME) \ RTYPE NAME(const FTYPE &it, \ const EST_String name, \ const RTYPE &def, \ EST_feat_status &status) \ { \ RTYPE val; \ EST_Val defv; \ \ defv = est_val((void *)&defv); \ \ CATCH_ERRORS() \ { \ if (strncmp(EST_error_message,"{FND}",5)==0) \ { \ status = efs_not_set; \ return def; \ } \ \ status=efs_error; \ return def; \ } \ \ EST_Val valr = it.VAL(name, defv); \ \ if (valr.type() == val_type_pointer && &defv == pointer(valr))\ { \ status=efs_not_set; \ val = def; \ } \ else \ { \ status=efs_ok; \ val = (RTYPE)valr; \ } \ \ END_CATCH_ERRORS(); \ \ return val; \ } speech_tools/base_class/Makefile0000644000076400007640000000744407603124412015430 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for base classes # # # #=========================================================================# TOP=.. DIRNAME=base_class LIB_BUILD_DIRS = string inst_tmpl BUILD_DIRS = $(LIB_BUILD_DIRS) ALL_DIRS = $(BUILD_DIRS) LOCAL_DEFAULT_LIBRARY = estbase H = EST_matrix_support.h rateconv.h EST_get_function_template.h T = EST_TList.cc EST_TSortable.cc EST_TKVL.cc \ EST_TMatrix.cc EST_TSimpleMatrix.cc \ EST_TVector.cc EST_TSimpleVector.cc \ EST_THash.cc EST_Tvectlist.cc \ EST_TTimeIndex.cc EST_TDeque.cc \ EST_TBuffer.cc EST_TNamedEnum.cc TSRCS = EST_Featured.cc EST_Features.cc CPPSRCS = EST_UList.cc EST_Option.cc EST_StringTrie.cc EST_Token.cc \ vec_mat_aux.cc EST_Pathname_unix.cc THash_aux.cc \ EST_FMatrix.cc EST_Complex.cc EST_Val.cc \ EST_matrix_support.cc rateconv.cc \ EST_IMatrix.cc EST_SMatrix.cc \ EST_DMatrix.cc vec_mat_aux_d.cc EST_FeatureData.cc\ EST_slist_aux.cc EST_svec_aux.cc EST_ilist_aux.cc \ EST_features_aux.cc EST_features_io.cc vec_mat_aux_i.cc \ $(TSRCS) SRCS = $(CPPSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) EST_Pathname_win32.cc $(T) $(H)\ Makefile ALL = .buildlib $(BUILD_DIRS) include $(TOP)/config/common_make_rules # Always compile with -O3 as its an important function rateconv.o: $(CXX_COMMAND) -O3 rateconv.cc -o rateconv.o speech_tools/base_class/string/EST_String.cc0000644000076400007640000006712211146562275017577 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors : Alan W Black (awb@cstr.ed.ac.uk) */ /* Date : January, February 1997 */ /* -------------------------------------------------------------------- */ /* */ /* A non-GNU implementation of a EST_String class to use with non-G++ */ /* compilers. */ /* */ /* Note this is not a full implementation of libg++'s EST_String class */ /* just the bits we need */ /* */ /*************************************************************************/ #include #include #include #include #include "EST_String.h" // #include "EST_error.h" #include "string_version.h" #include "EST_math.h" extern "C" { #include "regexp.h" } const char *EST_String::version = "CSTR String Class " STRING_VERSION " " STRING_DATE; const EST_String EST_String::Empty(""); EST_String EST_String_nullString = ""; struct subst { EST_String::EST_string_size start, end; char *s; int slen; } ; #if !__GSUB_REENTRANT__ static struct subst *substitutions=NULL; int num_substitutions=0; #endif /********************************************************************\ * * * Locate is the basic utility method behind many of the * * manipulations, it finds something in a EST_String, returns a * * success or failure flag and sets start and end to where it was. * * * \********************************************************************/ int EST_String::locate(const char *s, int len, int from, int &start, int &end) const { CHECK_STRING_ARG(s); const char *sub=NULL; if (!s) return 0; if (from < 0 && -from < size) { int endpos=size+from+1; int p=0; const char *nextsub; while ((nextsub=strstr(str()+p, s))) { p=nextsub-str()+1; if (p > endpos) break; sub=nextsub; } } else if (from>=0 && from <= size) sub= strstr(str()+from, s); if (sub != NULL) { start = sub-str(); end = start + len; return 1; } else { return 0; } } int EST_String::locate(EST_Regex &ex, int from, int &start, int &end, int *starts, int *ends) const { int match_start, match_end; if (from < 0 && -from < size) { int endpos=size+from+1; int p=0; int found=0; while (ex.run(str(), p, match_start, match_end, starts, ends)) { found++; start=match_start; end=match_end; p = match_start+1; if (p > endpos) break; } return found >0; } else if (from >=0 && from <= size) { if (ex.run(str(), from, match_start, match_end, starts, ends)) { start = match_start; end=match_end; return 1; } else return 0; } else return 0; } int EST_String::extract(const char *s, int len, int pos, int &start, int &end) const { CHECK_STRING_ARG(s); if (!s) return 0; if (pos < 0) return locate(s, len, 0, start, end); if (pos <= size-len && memcmp(str()+pos, s, len)==0) { start = pos; end = pos + len; return 1; } else return 0; } int EST_String::extract(EST_Regex &ex, int pos, int &start, int &end) const { int match_start, match_end; if (pos < 0) return locate(ex, 0, start, end); if (pos < size && ex.run(str(), pos, match_start, match_end) && match_start == pos) { start = match_start; end = match_end; return 1; } else return 0; } EST_String EST_String::chop_internal(int from, int len, EST_chop_direction mode) const { int start, end; if (from < 0) { start = size+from; } else { start = from; } end=start+len; if (start >=0 && end <=size && size > 0) switch (mode) { case Chop_Before: return EST_String(str(), size, 0, start); break; case Chop_At: return EST_String(str(), size, start, end-start); break; case Chop_After: return EST_String(str(), size, end, -1); } return EST_String(); } EST_String EST_String::chop_internal(const char *it, int len, int from, EST_chop_direction mode) const { CHECK_STRING_ARG(it); int start, end; if (it && locate(it, len, from, start, end)) switch (mode) { case Chop_Before: return EST_String(str(), size, 0, start); break; case Chop_At: return EST_String(str(), size, start, end-start); break; case Chop_After: return EST_String(str(), size, end, -1); } return EST_String(); } EST_String EST_String::chop_internal (EST_Regex &it, int from, EST_chop_direction mode) const { int start=0, end=0; if (locate(it, from, start, end)) switch (mode) { case Chop_Before: return EST_String(str(), size, 0, start); break; case Chop_At: return EST_String(str(), size, start, end-start); break; case Chop_After: return EST_String(str(), size, end, -1); } return EST_String(); } int EST_String::gsub_internal (const char *os, int olength, const char *s, int length) { CHECK_STRING_ARG(os); CHECK_STRING_ARG(s); int pos=0, n=0, change=0; EST_ChunkPtr new_memory; const char *from; char *to; #if __GSUB_REENTRANT__ struct subst { EST_String::EST_string_size start, end; } *substitutions=NULL; int num_substitutions=0; #endif if (s && os && size > 0 && *os != '\0') { { int start, end; while (locate(os, olength, pos, start, end)) { if (num_substitutions <= n) substitutions = wrealloc(substitutions, struct subst, (num_substitutions +=10)); substitutions[n].start = start; substitutions[n].end = end; change += length - (end-start); n++; pos=end; } } // dubious dealings with the inside of the string from = (const char *)memory; if (change > 0) { // Spurious braces make temporary ref to chunk go away {new_memory = chunk_allocate(size+change+1);} to = new_memory; } else { cp_make_updatable(memory, size); to = memory; } int i, at=0; char *p=to; for(i=0; i 0) memory = new_memory; size += change; } // cout << "gsub n=" << memory.count() << "\n"; #if __GSUB_REENTRANT__ if (substitutions) wfree(substitutions); #endif return n; } int EST_String::gsub_internal (EST_Regex &ex, const char *s, int length) { int bracket_num=-1; if (s==NULL) bracket_num = length; int pos=0, n=0, change=0; EST_ChunkPtr new_memory; const char *from; char *to; #if __GSUB_REENTRANT__ struct subst *substitutions=NULL; int num_substitutions=0; #endif // printf("match '%s'\n", (const char *)(*this)); if (size > 0) { { int start, starts[EST_Regex_max_subexpressions], ends[EST_Regex_max_subexpressions], mlen; while ((start = search(ex, mlen, pos, starts, ends))>=0) { // printf("match %d-%d, %d-%d, %d-%d\n", start, start+mlen, starts[0], ends[0], starts[1], ends[1]); if (num_substitutions <= n) substitutions = wrealloc(substitutions, struct subst, (num_substitutions +=10)); substitutions[n].start = start; substitutions[n].end = start+mlen; if (s) change += length - mlen; else { int slen = ends[bracket_num]-starts[bracket_num]; change += slen - mlen; substitutions[n].slen = slen; substitutions[n].s = walloc(char, slen); memcpy(substitutions[n].s, (const char *)memory+starts[bracket_num], slen); } n++; pos=start+mlen; } } // dubious dealings with the inside of the string from = (const char *)memory; if (change > 0) { // Spurious braces make temporary ref to chunk go away {new_memory = chunk_allocate(size+change+1);} to = new_memory; } else { cp_make_updatable(memory, size); to = memory; } int i, at=0; char *p=to; for(i=0; i 0) memory = new_memory; size += change; } #if __GSUB_REENTRANT__ if (substitutions) wfree(substitutions); #endif return n; } int EST_String::subst(EST_String source, int (&starts)[EST_Regex_max_subexpressions], int (&ends)[EST_Regex_max_subexpressions]) { int n=0, change=0; EST_ChunkPtr new_memory; const char *from; char *to; #if __GSUB_REENTRANT__ struct subst *substitutions=NULL; int num_substitutions=0; #endif // printf("match '%s'\n", (const char *)(*this)); int i; if (size > 0) { int escaped=0; for(i=0; i= '0' &&memory[i] <= '9') { int snum = memory[i] - '0'; if (ends[snum] >= 0 && starts[snum] >=0) { if (num_substitutions <= n) substitutions = wrealloc(substitutions, struct subst, (num_substitutions +=10)); substitutions[n].start = i-1; substitutions[n].end = i+1; substitutions[n].s = ((char *)(void *)(const char *)source.memory) + starts[snum]; substitutions[n].slen = ends[snum] - starts[snum]; change += substitutions[n].slen - 2; n++; } } escaped=0; } else if (memory[i] == '\\') escaped=1; } // dubious dealings with the inside of the string from = (const char *)memory; if (change > 0) { // Spurious braces make temporary ref to chunk go away {new_memory = chunk_allocate(size+change+1);} to = new_memory; } else { cp_make_updatable(memory, size); to = memory; } int at=0; char *p=to; for(i=0; i 0) memory = new_memory; size += change; } #if __GSUB_REENTRANT__ if (substitutions) wfree(substitutions); #endif return n; } // Pass in the two possible separators as pointers so we don't have to // duplicate all the code. Inline definitions of the friend functions // takes care of the pretty interface. int EST_String::split_internal(EST_String result[], int max, const char *s_seperator, int slen, EST_Regex *re_seperator, char quote) const { int n=0; int pos=0; int start, end; int lastspace=0; if (size>0) { while (pos < length()) { start= -1; end= -1; if ((*this)(pos) == quote) { start=pos; pos++; while (pos < length()) { if ((*this)(pos) == quote) { pos++; if ((*this)(pos) != quote) break; else pos++; } else pos++; } end=pos; } else { int mstart, mend, matched; if (s_seperator) matched = locate(s_seperator, slen, pos, mstart, mend); else matched = locate(*re_seperator, pos, mstart, mend); if (matched) if (mstart != pos) { start=pos; end=mstart; pos=mend; lastspace=mend; } else if (pos ==lastspace) { start=pos; end=pos; pos=mend; lastspace=mend; } else { pos=mend; lastspace=mend; } else { start=pos; end=length(); pos=end; } } if (start>=0) result[n++] = EST_String(*this, start, end-start); if (n==max) break; } } return n; } int EST_String::matches(const char *s, int pos) const { CHECK_STRING_ARG(s); int start, end; if (!s) return 0; int len=safe_strlen(s); if (extract(s, len, pos, start, end)) return start==pos && end==len; else return 0; } int EST_String::matches(const EST_String &s, int pos) const { int start, end; if (extract(s.str(), s.size, pos, start, end)) return start==pos && end==s.size; else return 0; } int EST_String::matches(EST_Regex &e, int pos, int *starts, int *ends) const { if (size==0) return e.run_match("", pos, starts, ends) >0; else return e.run_match(str(), pos, starts, ends) >0; } EST_String operator + (const EST_String &a, const char *b) { CHECK_STRING_ARG(b); int al = a.size; int bl = safe_strlen(b); if (al == 0) return EST_String(b, 0, bl); if (bl == 0) return EST_String(a); EST_ChunkPtr c = chunk_allocate(al+bl+1, a.str(), al); if (bl>0) memmove((char *)c + al, b, bl); c(al+bl)='\0'; return EST_String(al+bl, c); } EST_String operator + (const EST_String &a, const EST_String &b) { int al = a.size; int bl = b.size; if (al == 0) return EST_String(b); if (bl == 0) return EST_String(a); EST_ChunkPtr c = chunk_allocate(al+bl+1, a.str(), al); memmove((char *)c+al,b.str(),bl); c(al+bl)='\0'; return EST_String(al+bl, c); } EST_String operator + (const char *a, const EST_String &b) { CHECK_STRING_ARG(a); int al = safe_strlen(a); int bl = b.size; if (bl == 0) return EST_String(a, 0, al); if (al == 0) return EST_String(b); EST_ChunkPtr c = chunk_allocate(al+bl+1, a, al); memmove((char *)c + al, b.str(), bl); c(al+bl)='\0'; return EST_String(al+bl, c); } EST_String operator * (const EST_String &s, int n) { if (n<1) return ""; int l = s.length(); int sz = n * l; EST_String it(NULL, 0, sz); for(int j=0; j0) memmove((char *)memory + size,b.str(),bl); memory(size+bl)='\0'; size += bl; return *this; } EST_String::EST_String(const char *s) { CHECK_STRING_ARG(s); size=safe_strlen(s); if (size != 0) memory = chunk_allocate(size+1, s, size); else memory=NULL; } EST_String::EST_String(const char *s, int start_or_fill, int len) { if (s) { int start= start_or_fill; if (len <0) len=safe_strlen(s)-start; size=len; if (size != 0) memory = chunk_allocate(len+1, s+start, len); else memory=NULL; } else { char fill = start_or_fill; if (len<0) len=0; size=len; if (size != 0) { memory = chunk_allocate(len+1); char *p = memory; for(int j=0; j 0) return (s << str.str()); else return (s << ""); } EST_String EST_String::cat(const EST_String s1, const EST_String s2, const EST_String s3, const EST_String s4, const EST_String s5, const EST_String s6, const EST_String s7, const EST_String s8, const EST_String s9 ) { int len=(s1.length()+s2.length()+s3.length()+s4.length()+s5.length() + s6.length()+s7.length()+s8.length()+s9.length()); EST_String result; result.size=len; result.memory= chunk_allocate(len+1, (const char *)s1, s1.length()); int p = s1.length(); if (s2.length()) { strncpy((char *)result.memory + p, (const char *)s2, s2.length()); p += s2.length(); } if (s3.length()) { strncpy((char *)result.memory + p, (const char *)s3, s3.length()); p += s3.length(); } if (s4.length()) { strncpy((char *)result.memory + p, (const char *)s4, s4.length()); p += s4.length(); } if (s5.length()) { strncpy((char *)result.memory + p, (const char *)s5, s5.length()); p += s5.length(); } if (s6.length()) { strncpy((char *)result.memory + p, (const char *)s6, s6.length()); p += s6.length(); } if (s7.length()) { strncpy((char *)result.memory + p, (const char *)s7, s7.length()); p += s7.length(); } if (s8.length()) { strncpy((char *)result.memory + p, (const char *)s8, s8.length()); p += s8.length(); } if (s9.length()) { strncpy((char *)result.memory + p, (const char *)s9, s9.length()); p += s9.length(); } result.memory(p) = '\0'; return result; } int compare(const EST_String &a, const EST_String &b) { if (a.size == 0 && b.size == 0) return 0; else if (a.size == 0) return -1; else if (b.size == 0) return 1; else return strcmp(a.str(), b.str()); } int compare(const EST_String &a, const char *b) { if (a.size == 0 && (b==NULL || *b == '\0')) return 0; else if (a.size == 0) return -1; else if (b == NULL || *b == '\0') return 1; else return strcmp(a.str(), b); } int fcompare(const EST_String &a, const EST_String &b, const unsigned char *table) { if (a.size == 0 && b.size == 0) return 0; else if (a.size == 0) return -1; else if (b.size == 0) return 1; else return EST_strcasecmp(a.str(), b.str(), table); } int fcompare(const EST_String &a, const char *b, const unsigned char *table) { int bsize = (b ? strlen((const char *)b) : 0); if (a.size == 0 && bsize == 0) return 0; else if (a.size == 0) return -1; else if (bsize == 0) return 1; else return EST_strcasecmp(a.str(), (const char *)b, table); } int operator == (const char *a, const EST_String &b) { CHECK_STRING_ARG(a); if (!a) return 0; else if (b.size==0) return *a == '\0'; else return (*a == b(0)) && strcmp(a, b.str())==0; } int operator == (const EST_String &a, const EST_String &b) { if (a.size==0) return b.size == 0; else if (b.size == 0) return 0; else return a.size == b.size && a(0) == b(0) && memcmp(a.str(),b.str(),a.size)==0; }; EST_String EST_String::Number(int i, int b) { char buf[64]; const char *format; switch (b) { case 8: format="0%o"; break; case 10: format="%d"; break; case 16: format="0x%x"; break; default: format="??%d??"; break; } sprintf(buf, format, i); return EST_String(buf); } EST_String EST_String::Number(long i, int b) { char buf[64]; const char *format; switch (b) { case 8: format="0%lo"; break; case 10: format="%ld"; break; case 16: format="0x%lx"; break; default: format="??%ld??"; break; } sprintf(buf, format, i); return EST_String(buf); } EST_String EST_String::Number(float f) { char buf[64]; sprintf(buf, "%f", f); return EST_String(buf); } EST_String EST_String::Number(double d) { char buf[64]; sprintf(buf, "%f", d); return EST_String(buf); } long EST_String::Long(bool *valid) const { char *end; long val = strtol(str(), &end, 10); if (end==NULL|| *end != '\0') { if (valid != NULL) { *valid=0; return 0L; } else { printf("bad integer number format '%s'\n", (const char *)str()); exit(0); } } if (valid) *valid=1; return val; } int EST_String::Int(bool *valid) const { long val = Long(valid); if (valid && !*valid) return 0L; if (val > INT_MAX || val < INT_MIN) { if (valid != NULL) { *valid=0; return 0L; } else { printf("number out of range for integer %ld", val); exit(0); } } return val; } double EST_String::Double(bool *valid) const { char *end; double val = strtod(str(), &end); if (end==NULL|| *end != '\0') { if (valid != NULL) { *valid=0; return 0.0; } else { printf("bad decimal number format '%s'", (const char *)str()); exit(0); } } if (valid) *valid=1; return val; } float EST_String::Float(bool *valid) const { double val = Double(valid); if (valid && !*valid) return 0.0; if (val > FLT_MAX || val < -FLT_MAX) { if (valid != NULL) { *valid=0; return 0.0; } else { printf("number out of range for float %f", val); exit(0); } } return val; } speech_tools/base_class/string/EST_Regex.cc0000644000076400007640000002157110127000717017363 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author : Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date : February 1997 */ /* -------------------------------------------------------------------- */ /* */ /* A Regular expression class to go with the CSTR EST_String class. Uses*/ /* Henry Spencer`s regexp routines which allocate space dynamically */ /* using malloc, so we use free in here rather than wfree because */ /* wfree might at some time start doing something more than just be a */ /* safe wrapper around free. If you try and use another regexp */ /* package, beware of changes to how memory is allocated. */ /* */ /* We maintain two compiled versions, one for substring matches and */ /* one for whole string matches (because sometimes the regexp */ /* compiler can special case the latter). These are compiled when */ /* first used. */ /* */ /************************************************************************/ #ifdef NO_EST # include #else # include "EST_unix.h" #endif #include #include #include #include "EST_String.h" #include "EST_Regex.h" #ifdef sun #ifndef __svr4__ /* SunOS */ #include #endif #endif // extern "C" { #include "regexp.h" /* void *t_regcomp(void *v) { return v; } void *cpp_regcomp(void *v) { return v; } */ // #define wfree(P) (1==1) // These define the different escape conventions for the FSF's // regexp code and Henry Spencer's static const char *fsf_magic="^$*+?[].\\"; static const char *fsf_magic_backslashed="()|<>"; static const char *spencer_magic="^$*+?[].()|\\\n"; static const char *spencer_magic_backslashed="<>"; EST_Regex RXwhite("[ \n\t\r]+"); EST_Regex RXalpha("[A-Za-z]+"); EST_Regex RXlowercase("[a-z]+"); EST_Regex RXuppercase("[A-Z]+"); EST_Regex RXalphanum("[0-9A-Za-z]+"); EST_Regex RXidentifier("[A-Za-z_][0-9A-Za-z_]+"); EST_Regex RXint("-?[0-9]+"); EST_Regex RXdouble("-?\\(\\([0-9]+\\.[0-9]*\\)\\|\\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)\\([eE][---+]?[0-9]+\\)?"); // use this to free compiled regex since the regexp package uses malloc // and walloc might end up doing something clever. /* extern "C" void free(void *p); */ #if NSUBEXP != EST_Regex_max_subexpressions # error "EST_Regex_max_subexpressions must be equal to NSUBEXP" #endif EST_Regex::EST_Regex(void) : EST_String() { compiled = NULL; compiled_match = NULL; } EST_Regex::EST_Regex(const char *s) : EST_String(s) { compiled = NULL; compiled_match = NULL; } EST_Regex::EST_Regex(EST_String s) : EST_String(s) { compiled = NULL; compiled_match = NULL; } EST_Regex::EST_Regex(const EST_Regex &ex) : EST_String(ex) { compiled = NULL; compiled_match = NULL; } EST_Regex::~EST_Regex() { if (compiled_match) free(compiled_match); if (compiled) free(compiled); } // Convert a regular expression from the external syntax (defined by the // the FSF library) to the one expected by the regexp routines (which // say it's V8 syntax). char *EST_Regex::regularize(int match) const { char *reg = walloc(char, size()*2+3); char *r=reg; const char *e; int magic=0,last_was_bs=0; const char * in_brackets=NULL; const char *ex = (size()==0)?"":str(); if (match && *ex != '^') *(r++) = '^'; for(e=ex; *e ; e++) { if (*e == '\\' && !last_was_bs) { last_was_bs=1; continue; } magic=strchr((last_was_bs?fsf_magic_backslashed:fsf_magic), *e)!=NULL; if (in_brackets) { *(r++) = *e; if (*e == ']' && (e-in_brackets)>1) in_brackets=0; } else if (magic) { if (strchr(spencer_magic_backslashed, *e)) *(r++) = '\\'; *(r++) = *e; if (*e == '[') in_brackets=e; } else { if (strchr(spencer_magic, *e)) *(r++) = '\\'; *(r++) = *e; } last_was_bs=0; } if (match && (e==ex || *(e-1) != '$')) { if (last_was_bs) *(r++) = '\\'; *(r++) = '$'; } *r='\0'; // cerr<<"reg||"<startp[0] - on; end = re->endp[0]- on; if (starts) { int i; for (i=0; istartp[i]?(re->startp[i] - on):-1; } if (ends) { int i; for (i=0; iendp[i]?(re->endp[i] - on):-1; } return 1; } } return 0; } int EST_Regex::run_match(const char *on, int from, int *starts, int *ends) { compile_match(); hs_regexp *re = (hs_regexp *)compiled_match; if (compiled_match && from <= (int)strlen(on)) if (hs_regexec(re, on+from)) { if (starts) { int i; for (i=0; istartp[i]?(re->startp[i] - on):-1; } if (ends) { int i; for (i=0; iendp[i]?(re->endp[i] - on):-1; } return 1; } return 0; } EST_Regex &EST_Regex::operator = (const EST_Regex ex) { ((EST_String &)(*this)) = (EST_String)ex; compiled = NULL; compiled_match = NULL; return *this; } EST_Regex &EST_Regex::operator = (const EST_String s) { ((EST_String &)(*this)) = s; compiled = NULL; compiled_match = NULL; return *this; } EST_Regex &EST_Regex::operator = (const char *s) { ((EST_String &)(*this)) = s; compiled = NULL; compiled_match = NULL; return *this; } ostream &operator << (ostream &s, const EST_Regex &str) { return s << (EST_String)str; } speech_tools/base_class/string/EST_Chunk.cc0000644000076400007640000002342410452516725017374 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: February 1997 */ /* -------------------------------------------------------------------- */ /* */ /* Use counted memory chunks and smart pointers to them. */ /* */ /************************************************************************/ #include #include #include #include "EST_Chunk.h" EST_Chunk::EST_Chunk () { count = 0; memory[0] = '\0'; // cerr<<"created " << hex << (int)&memory << "," << dec << size <<"\n"; } EST_Chunk::~EST_Chunk () { if (count > 0) { cerr << "deleting chunk with non-zero count\n"; exit(1); } // cerr << "deleted "<< hex << (int)&memory << "," << dec << size <<"\n"; } // private address-of operator - up to friends to keep use counts correct. EST_Chunk *EST_Chunk::operator & () { return this; } #if !defined(__CHUNK_INLINE_AGGRESSIVELY__) void EST_Chunk:: operator ++ () { #if 0 if (++count > MAX_CHUNK_COUNT) { cerr<<"max count exceeded\n"; exit(1); } #endif if (count < MAX_CHUNK_COUNT) { ++count; } } void EST_Chunk::operator -- () { if (count-- == 0) { cerr<<"negative count\n"; exit(1); } else if (count == 0) { // cerr<<"deleting\n"; delete this; } } #endif void *EST_Chunk::operator new (size_t size, int bytes) { if (bytes > MAX_CHUNK_SIZE) { cerr<<"trying to make chunk of size "< malloc_flag = 1; #else void *it = new char[size + bytes]; #endif // cerr<<"allocated "< size = bytes; return it; } void EST_Chunk::operator delete (void *it) { #if defined(__CHUNK_USE_WALLOC__) wfree(it); #else delete it; #endif } /************************************************************************/ /* */ /* Now the smart pointers. */ /* */ /************************************************************************/ #if !defined(__CHUNK_INLINE_AGGRESSIVELY__) EST_ChunkPtr::EST_ChunkPtr (EST_Chunk *chp) { ptr=chp; if (ptr) ++ *ptr; } EST_ChunkPtr::EST_ChunkPtr (const EST_ChunkPtr &cp) { ptr=cp.ptr; if (ptr) ++ *ptr; } EST_ChunkPtr::~EST_ChunkPtr (void) { if (ptr) { -- *ptr; } } EST_ChunkPtr &EST_ChunkPtr::operator = (EST_ChunkPtr cp) { // doing it in this order means self assignment is safe. if (cp.ptr) ++ *(cp.ptr); if (ptr) -- *ptr; ptr=cp.ptr; return *this; } EST_ChunkPtr &EST_ChunkPtr::operator = (EST_Chunk *chp) { // doing it in this order means self assignment is safe. if (chp) ++ *chp; if (ptr) -- *ptr; ptr=chp; return *this; } EST_ChunkPtr::operator const char*() const { if (ptr) return &(ptr->memory[0]); else return NULL; } EST_ChunkPtr::operator char const*() { return ptr?&(ptr->memory[0]):(const char *)NULL; } EST_ChunkPtr::operator char*() { if (ptr) { if (ptr->count > 1) { CHUNK_WARN("getting writable version of shared chunk"); cp_make_updatable(*this); } return &(ptr->memory[0]); } else return NULL; } char &EST_ChunkPtr::operator () (int i) { if (ptr->count>1) { CHUNK_WARN("getting writable version of shared chunk"); cp_make_updatable(*this); } return ptr->memory[i]; } #endif /************************************************************************/ /* */ /* Friend function to allocate a chunk in a non count-aware program. */ /* */ /************************************************************************/ EST_ChunkPtr chunk_allocate(int bytes) { EST_Chunk *cp = new(bytes) EST_Chunk; return (EST_ChunkPtr)cp; } EST_ChunkPtr chunk_allocate(int bytes, const char *initial, int initial_len) { if (initial_len >= bytes) { cerr<<"initialiser too long\n"; abort(); } EST_Chunk *cp = new(bytes) EST_Chunk; memcpy(cp->memory, initial, initial_len); cp->memory[initial_len] = '\0'; return (EST_ChunkPtr)cp; } EST_ChunkPtr chunk_allocate(int bytes, const EST_ChunkPtr &initial, int initial_start, int initial_len) { if (initial_len >= bytes) { cerr<<"initialiser too long\n"; abort(); } EST_Chunk *cp = new(bytes) EST_Chunk; memcpy(cp->memory, initial.ptr->memory + initial_start, initial_len); cp->memory[initial_len] = '\0'; return (EST_ChunkPtr)cp; } /************************************************************************/ /* */ /* And one which ensures that a chunk is not shared. Do this before */ /* writing to the memory. The first version is told how much of the */ /* memory to copy, the second just copies it all. */ /* */ /************************************************************************/ void cp_make_updatable(EST_ChunkPtr &cp, EST_Chunk::EST_chunk_size inuse) { if (cp.ptr && cp.ptr->count > 1) { EST_Chunk *newchunk = new(cp.ptr->size) EST_Chunk; memcpy(newchunk->memory, cp.ptr->memory, inuse); cp = newchunk; } } void cp_make_updatable(EST_ChunkPtr &cp) { if (cp.ptr && cp.ptr->count > 1) { EST_Chunk *newchunk = new(cp.ptr->size) EST_Chunk; memcpy(newchunk->memory, cp.ptr->memory, cp.ptr->size); cp = newchunk; } } /************************************************************************/ /* */ /* Make more room in a chunk. If the chunk is already big enough and */ /* is unshared then nothing is done. */ /* */ /************************************************************************/ void grow_chunk(EST_ChunkPtr &cp, EST_Chunk::EST_chunk_size newsize) { if (!cp.ptr || cp.ptr->size < newsize) { if (cp.ptr) cp_make_updatable(cp); EST_Chunk *newchunk = new(newsize) EST_Chunk; memcpy(newchunk->memory, cp.ptr->memory, cp.ptr->size); cp = newchunk; } } void grow_chunk(EST_ChunkPtr &cp, EST_Chunk::EST_chunk_size inuse, EST_Chunk::EST_chunk_size newsize) { if (!cp.ptr || cp.ptr->size < newsize) { if (cp.ptr) cp_make_updatable(cp, inuse); EST_Chunk *newchunk = new(newsize) EST_Chunk; memcpy(newchunk->memory, cp.ptr->memory, inuse); cp = newchunk; } } ostream &operator << (ostream &s, const EST_Chunk &ch) { char buff[21]; if (ch.size<20) { memcpy(buff, ch.memory, ch.size); buff[ch.size]='\0'; } else { memcpy(buff, ch.memory, 20); buff[20]='\0'; } return (s<< "[" << ch.size << "!" << ch.count << "!" << buff << "]"); } speech_tools/base_class/string/regexp.cc0000644000076400007640000007454410127000717017100 0ustar awbawb/* * regcomp and regexec -- regsub and regerror are elsewhere * * Copyright (c) 1986 by University of Toronto. * Written by Henry Spencer. Not derived from licensed software. * * Permission is granted to anyone to use this software for any * purpose on any computer system, and to redistribute it freely, * subject to the following restrictions: * * 1. The author is not responsible for the consequences of use of * this software, no matter how awful, even if they arise * from defects in it. * * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore, *** hoptoad!gnu, on 27 Dec 1986, to add \n as an alternative to | *** to assist in implementing egrep. *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore, *** hoptoad!gnu, on 27 Dec 1986, to add \< and \> for word-matching *** as in BSD grep and ex. *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore, *** hoptoad!gnu, on 28 Dec 1986, to optimize characters quoted with \. *** THIS IS AN ALTERED VERSION. It was altered by James A. Woods, *** ames!jaw, on 19 June 1987, to quash a regcomp() redundancy. * * Beware that some of this code is subtly aware of the way operator * precedence is structured in regular expressions. Serious changes in * regular-expression syntax might require a total rethink. */ #include #include #include #include #include "regexp.h" #include "regmagic.h" /* * The "internal use only" fields in regexp.h are present to pass info from * compile to execute that permits the execute phase to run lots faster on * simple cases. They are: * * regstart char that must begin a match; '\0' if none obvious * reganch is the match anchored (at beginning-of-line only)? * regmust string (pointer into program) that match must include, or NULL * regmlen length of regmust string * * Regstart and reganch permit very fast decisions on suitable starting points * for a match, cutting down the work a lot. Regmust permits fast rejection * of lines that cannot possibly match. The regmust tests are costly enough * that regcomp() supplies a regmust only if the r.e. contains something * potentially expensive (at present, the only such thing detected is * or + * at the start of the r.e., which can involve a lot of backup). Regmlen is * supplied because the test in regexec() needs it and regcomp() is computing * it anyway. */ /* * Structure for regexp "program". This is essentially a linear encoding * of a nondeterministic finite-state machine (aka syntax charts or * "railroad normal form" in parsing technology). Each node is an opcode * plus a "next" pointer, possibly plus an operand. "Next" pointers of * all nodes except BRANCH implement concatenation; a "next" pointer with * a BRANCH on both ends of it is connecting two alternatives. (Here we * have one of the subtle syntax dependencies: an individual BRANCH (as * opposed to a collection of them) is never concatenated with anything * because of operator precedence.) The operand of some types of node is * a literal string; for others, it is a node leading into a sub-FSM. In * particular, the operand of a BRANCH node is the first node of the branch. * (NB this is *not* a tree structure: the tail of the branch connects * to the thing following the set of BRANCHes.) The opcodes are: */ /* definition number opnd? meaning */ #define END 0 /* no End of program. */ #define BOL 1 /* no Match "" at beginning of line. */ #define EOL 2 /* no Match "" at end of line. */ #define ANY 3 /* no Match any one character. */ #define ANYOF 4 /* str Match any character in this string. */ #define ANYBUT 5 /* str Match any character not in this string. */ #define BRANCH 6 /* node Match this alternative, or the next... */ #define BACK 7 /* no Match "", "next" ptr points backward. */ #define EXACTLY 8 /* str Match this string. */ #define NOTHING 9 /* no Match empty string. */ #define STAR 10 /* node Match this (simple) thing 0 or more times. */ #define PLUS 11 /* node Match this (simple) thing 1 or more times. */ #define WORDA 12 /* no Match "" at wordchar, where prev is nonword */ #define WORDZ 13 /* no Match "" at nonwordchar, where prev is word */ #define OPEN 20 /* no Mark this point in input as start of #n. */ /* OPEN+1 is number 1, etc. */ #define CLOSE 30 /* no Analogous to OPEN. */ /* * Opcode notes: * * BRANCH The set of branches constituting a single choice are hooked * together with their "next" pointers, since precedence prevents * anything being concatenated to any individual branch. The * "next" pointer of the last BRANCH in a choice points to the * thing following the whole choice. This is also where the * final "next" pointer of each individual branch points; each * branch starts with the operand node of a BRANCH node. * * BACK Normal "next" pointers all implicitly point forward; BACK * exists to make loop structures possible. * * STAR,PLUS '?', and complex '*' and '+', are implemented as circular * BRANCH structures using BACK. Simple cases (one character * per match) are implemented with STAR and PLUS for speed * and to minimize recursive plunges. * * OPEN,CLOSE ...are numbered at compile time. */ /* * A node is one char of opcode followed by two chars of "next" pointer. * "Next" pointers are stored as two 8-bit pieces, high order first. The * value is a positive offset from the opcode of the node containing it. * An operand, if any, simply follows the node. (Note that much of the * code generation knows about this implicit relationship.) * * Using two bytes for the "next" pointer is vast overkill for most things, * but allows patterns to get big without disasters. */ #define OP(p) (*(p)) #define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) #define OPERAND(p) ((p) + 3) /* * See regmagic.h for one further detail of program structure. */ /* * Utility definitions. */ #ifndef CHARBITS #define UCHARAT(p) ((int)*(unsigned char *)(p)) #else #define UCHARAT(p) ((int)*(p)&CHARBITS) #endif #define FAIL(m) { hs_regerror(m); return(NULL); } #define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') /* * Flags to be passed up and down. */ #define HASWIDTH 01 /* Known never to match null string. */ #define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ #define SPSTART 04 /* Starts with * or +. */ #define WORST 0 /* Worst case. */ /* * Global work variables for regcomp(). */ static const char *regparse; /* Input-scan pointer. */ static int regnpar; /* () count. */ static char regdummy; static char *regcode; /* Code-emit pointer; ®dummy = don't. */ static long regsize; /* Code size. */ /* * Forward declarations for regcomp()'s friends. */ #ifndef STATIC #define STATIC static #endif STATIC char *reg(int paren, int *flagp); STATIC char *regbranch(int *flagp); STATIC char *regpiece(int *flagp); STATIC char *regatom(int *flagp); STATIC char *regnode(char op); STATIC char *regnext(register char *p); STATIC void regc(char b); STATIC void reginsert(char op, char *opnd); STATIC void regtail(char *p, char *val); STATIC void regoptail(char *p, char *val); #ifdef STRCSPN STATIC int strcspn(); #endif /* - regcomp - compile a regular expression into internal code * * We can't allocate space until we know how big the compiled form will be, * but we can't compile it (and thus know how big it is) until we've got a * place to put the code. So we cheat: we compile it twice, once with code * generation turned off and size counting turned on, and once "for real". * This also means that we don't allocate space until we are sure that the * thing really will compile successfully, and we never have to move the * code and thus invalidate pointers into it. (Note that it has to be in * one piece because free() must be able to free it all.) * * Beware that the optimization-preparation code in here knows about some * of the structure of the compiled regexp. */ hs_regexp * hs_regcomp(const char *exp) { hs_regexp *r; char *scan; char *longest; unsigned int len; int flags; if (exp == NULL) FAIL("NULL argument"); /* First pass: determine size, legality. */ #ifdef notdef if (exp[0] == '.' && exp[1] == '*') exp += 2; /* aid grep */ #endif regparse = exp; regnpar = 1; regsize = 0L; regcode = ®dummy; regc(MAGIC); if (reg(0, &flags) == NULL) return(NULL); /* Small enough for pointer-storage convention? */ if (regsize >= 32767L) /* Probably could be 65535L. */ FAIL("regexp too big"); /* Allocate space. */ r = (hs_regexp *)malloc(sizeof(hs_regexp) + (unsigned)regsize); if (r == NULL) FAIL("out of space"); /* Second pass: emit code. */ regparse = exp; regnpar = 1; regcode = r->program; regc(MAGIC); if (reg(0, &flags) == NULL) return(NULL); /* Dig out information for optimizations. */ r->regstart = '\0'; /* Worst-case defaults. */ r->reganch = 0; r->regmust = NULL; r->regmlen = 0; scan = r->program+1; /* First BRANCH. */ if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ scan = OPERAND(scan); /* Starting-point info. */ if (OP(scan) == EXACTLY) r->regstart = *OPERAND(scan); else if (OP(scan) == BOL) r->reganch++; /* * If there's something expensive in the r.e., find the * longest literal string that must appear and make it the * regmust. Resolve ties in favor of later strings, since * the regstart check works with the beginning of the r.e. * and avoiding duplication strengthens checking. Not a * strong reason, but sufficient in the absence of others. */ if (flags&SPSTART) { longest = NULL; len = 0; for (; scan != NULL; scan = regnext(scan)) if ((OP(scan) == EXACTLY) && (strlen(OPERAND(scan)) >= len)) { longest = OPERAND(scan); len = strlen(OPERAND(scan)); } r->regmust = longest; r->regmlen = len; } } return(r); } /* - reg - regular expression, i.e. main body or parenthesized thing * * Caller must absorb opening parenthesis. * * Combining parenthesis handling with the base level of regular expression * is a trifle forced, but the need to tie the tails of the branches to what * follows makes it hard to avoid. */ static char * reg(int paren, int *flagp) /* Parenthesized? */ { char *ret; char *br; char *ender; int parno=0; int flags; *flagp = HASWIDTH; /* Tentatively. */ /* Make an OPEN node, if parenthesized. */ if (paren) { if (regnpar >= NSUBEXP) FAIL("too many ()"); parno = regnpar; regnpar++; ret = regnode(OPEN+parno); } else ret = NULL; /* Pick up the branches, linking them together. */ br = regbranch(&flags); if (br == NULL) return(NULL); if (ret != NULL) regtail(ret, br); /* OPEN -> first. */ else ret = br; if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; while (*regparse == '|' || *regparse == '\n') { regparse++; br = regbranch(&flags); if (br == NULL) return(NULL); regtail(ret, br); /* BRANCH -> BRANCH. */ if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; } /* Make a closing node, and hook it on the end. */ ender = regnode((paren) ? CLOSE+parno : END); regtail(ret, ender); /* Hook the tails of the branches to the closing node. */ for (br = ret; br != NULL; br = regnext(br)) regoptail(br, ender); /* Check for proper termination. */ if (paren && *regparse++ != ')') { FAIL("unmatched ()"); } else if (!paren && *regparse != '\0') { if (*regparse == ')') { FAIL("unmatched ()"); } else FAIL("junk on end"); /* "Can't happen". */ /* NOTREACHED */ } return(ret); } /* - regbranch - one alternative of an | operator * * Implements the concatenation operator. */ static char * regbranch(int *flagp) { char *ret; char *chain; char *latest; int flags; *flagp = WORST; /* Tentatively. */ ret = regnode(BRANCH); chain = NULL; while (*regparse != '\0' && *regparse != ')' && *regparse != '\n' && *regparse != '|') { latest = regpiece(&flags); if (latest == NULL) return(NULL); *flagp |= flags&HASWIDTH; if (chain == NULL) /* First piece. */ *flagp |= flags&SPSTART; else regtail(chain, latest); chain = latest; } if (chain == NULL) /* Loop ran zero times. */ (void) regnode(NOTHING); return(ret); } /* - regpiece - something followed by possible [*+?] * * Note that the branching code sequences used for ? and the general cases * of * and + are somewhat optimized: they use the same NOTHING node as * both the endmarker for their branch list and the body of the last branch. * It might seem that this node could be dispensed with entirely, but the * endmarker role is not redundant. */ static char * regpiece(int *flagp) { char *ret; char op; char *next; int flags; ret = regatom(&flags); if (ret == NULL) return(NULL); op = *regparse; if (!ISMULT(op)) { *flagp = flags; return(ret); } if (!(flags&HASWIDTH) && op != '?') FAIL("*+ operand could be empty"); *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); if (op == '*' && (flags&SIMPLE)) reginsert(STAR, ret); else if (op == '*') { /* Emit x* as (x&|), where & means "self". */ reginsert(BRANCH, ret); /* Either x */ regoptail(ret, regnode(BACK)); /* and loop */ regoptail(ret, ret); /* back */ regtail(ret, regnode(BRANCH)); /* or */ regtail(ret, regnode(NOTHING)); /* null. */ } else if (op == '+' && (flags&SIMPLE)) reginsert(PLUS, ret); else if (op == '+') { /* Emit x+ as x(&|), where & means "self". */ next = regnode(BRANCH); /* Either */ regtail(ret, next); regtail(regnode(BACK), ret); /* loop back */ regtail(next, regnode(BRANCH)); /* or */ regtail(ret, regnode(NOTHING)); /* null. */ } else if (op == '?') { /* Emit x? as (x|) */ reginsert(BRANCH, ret); /* Either x */ regtail(ret, regnode(BRANCH)); /* or */ next = regnode(NOTHING); /* null. */ regtail(ret, next); regoptail(ret, next); } regparse++; if (ISMULT(*regparse)) FAIL("nested *?+"); return(ret); } /* - regatom - the lowest level * * Optimization: gobbles an entire sequence of ordinary characters so that * it can turn them into a single node, which is smaller to store and * faster to run. Backslashed characters are exceptions, each becoming a * separate node; the code is simpler that way and it's not worth fixing. */ static char * regatom(int *flagp) { char *ret; int flags; *flagp = WORST; /* Tentatively. */ switch (*regparse++) { /* FIXME: these chars only have meaning at beg/end of pat? */ case '^': ret = regnode(BOL); break; case '$': ret = regnode(EOL); break; case '.': ret = regnode(ANY); *flagp |= HASWIDTH|SIMPLE; break; case '[': { int class1; int classend; if (*regparse == '^') { /* Complement of range. */ ret = regnode(ANYBUT); regparse++; } else ret = regnode(ANYOF); if (*regparse == ']' || *regparse == '-') regc(*regparse++); while (*regparse != '\0' && *regparse != ']') { if (*regparse == '-') { regparse++; if (*regparse == ']' || *regparse == '\0') regc('-'); else { class1 = UCHARAT(regparse-2)+1; classend = UCHARAT(regparse); if (class1 > classend+1) FAIL("invalid [] range"); for (; class1 <= classend; class1++) regc(class1); regparse++; } } else regc(*regparse++); } regc('\0'); if (*regparse != ']') FAIL("unmatched []"); regparse++; *flagp |= HASWIDTH|SIMPLE; } break; case '(': ret = reg(1, &flags); if (ret == NULL) return(NULL); *flagp |= flags&(HASWIDTH|SPSTART); break; case '\0': case '|': case '\n': case ')': FAIL("internal urp"); /* Supposed to be caught earlier. */ break; case '?': case '+': case '*': FAIL("?+* follows nothing"); break; case '\\': switch (*regparse++) { case '\0': FAIL("trailing \\"); break; case '<': ret = regnode(WORDA); break; case '>': ret = regnode(WORDZ); break; /* FIXME: Someday handle \1, \2, ... */ default: /* Handle general quoted chars in exact-match routine */ goto de_fault; } break; de_fault: default: /* * Encode a string of characters to be matched exactly. * * This is a bit tricky due to quoted chars and due to * '*', '+', and '?' taking the SINGLE char previous * as their operand. * * On entry, the char at regparse[-1] is going to go * into the string, no matter what it is. (It could be * following a \ if we are entered from the '\' case.) * * Basic idea is to pick up a good char in ch and * examine the next char. If it's *+? then we twiddle. * If it's \ then we frozzle. If it's other magic char * we push ch and terminate the string. If none of the * above, we push ch on the string and go around again. * * regprev is used to remember where "the current char" * starts in the string, if due to a *+? we need to back * up and put the current char in a separate, 1-char, string. * When regprev is NULL, ch is the only char in the * string; this is used in *+? handling, and in setting * flags |= SIMPLE at the end. */ { const char *regprev; char ch = 0; regparse--; /* Look at cur char */ ret = regnode(EXACTLY); for ( regprev = 0 ; ; ) { ch = *regparse++; /* Get current char */ switch (*regparse) { /* look at next one */ default: regc(ch); /* Add cur to string */ break; case '.': case '[': case '(': case ')': case '|': case '\n': case '$': case '^': case '\0': /* FIXME, $ and ^ should not always be magic */ magic: regc(ch); /* dump cur char */ goto done; /* and we are done */ case '?': case '+': case '*': if (!regprev) /* If just ch in str, */ goto magic; /* use it */ /* End mult-char string one early */ regparse = regprev; /* Back up parse */ goto done; case '\\': regc(ch); /* Cur char OK */ switch (regparse[1]){ /* Look after \ */ case '\0': case '<': case '>': /* FIXME: Someday handle \1, \2, ... */ goto done; /* Not quoted */ default: /* Backup point is \, scan * point is after it. */ regprev = regparse; regparse++; continue; /* NOT break; */ } } regprev = regparse; /* Set backup point */ } done: regc('\0'); *flagp |= HASWIDTH; if (!regprev) /* One char? */ *flagp |= SIMPLE; } break; } return(ret); } /* - regnode - emit a node */ static char * /* Location. */ regnode(char op) { char *ret; char *ptr; ret = regcode; if (ret == ®dummy) { regsize += 3; return(ret); } ptr = ret; *ptr++ = op; *ptr++ = '\0'; /* Null "next" pointer. */ *ptr++ = '\0'; regcode = ptr; return(ret); } /* - regc - emit (if appropriate) a byte of code */ static void regc(char b) { if (regcode != ®dummy) *regcode++ = b; else regsize++; } /* - reginsert - insert an operator in front of already-emitted operand * * Means relocating the operand. */ static void reginsert(char op, char *opnd) { char *src; char *dst; char *place; if (regcode == ®dummy) { regsize += 3; return; } src = regcode; regcode += 3; dst = regcode; while (src > opnd) *--dst = *--src; place = opnd; /* Op node, where operand used to be. */ *place++ = op; *place++ = '\0'; *place++ = '\0'; } /* - regtail - set the next-pointer at the end of a node chain */ static void regtail(char *p, char *val) { char *scan; char *temp; int offset; if (p == ®dummy) return; /* Find last node. */ scan = p; for (;;) { temp = regnext(scan); if (temp == NULL) break; scan = temp; } if (OP(scan) == BACK) offset = scan - val; else offset = val - scan; *(scan+1) = (offset>>8)&0377; *(scan+2) = offset&0377; } /* - regoptail - regtail on operand of first argument; nop if operandless */ static void regoptail(char *p, char *val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) return; regtail(OPERAND(p), val); } /* * regexec and friends */ /* * Global work variables for regexec(). */ static const char *reginput; /* EST_String-input pointer. */ static const char *regbol; /* Beginning of input, for ^ check. */ static const char **regstartp; /* Pointer to startp array. */ static const char **regendp; /* Ditto for endp. */ /* * Forwards. */ STATIC int regtry(hs_regexp *prog, const char *string); STATIC int regmatch(char *prog); STATIC int regrepeat(char *p); #ifdef DEBUG FILE *regnarrate = stdout; void regdump(); STATIC char *regprop( char *scan); #endif /* - regexec - match a regexp against a string */ int hs_regexec(const hs_regexp *prog, const char *string) { char *s; /* Be paranoid... */ if (prog == NULL || string == NULL) { hs_regerror("NULL parameter"); return(0); } /* Check validity of program. */ if (UCHARAT(prog->program) != MAGIC) { hs_regerror("corrupted program"); return(0); } /* If there is a "must appear" string, look for it. */ if (prog->regmust != NULL) { s = (char *)string; while ((s = strchr(s, prog->regmust[0])) != NULL) { if (strncmp(s, prog->regmust, prog->regmlen) == 0) break; /* Found it. */ s++; } if (s == NULL) /* Not present. */ return(0); } /* Mark beginning of line for ^ . */ regbol = (char *)string; /* Simplest case: anchored match need be tried only once. */ if (prog->reganch) return(regtry((hs_regexp *)prog, string)); /* Messy cases: unanchored match. */ s = (char *)string; if (prog->regstart != '\0') /* We know what char it must start with. */ while ((s = strchr(s, prog->regstart)) != NULL) { if (regtry((hs_regexp *)prog, s)) return(1); s++; } else /* We don't -- general case. */ do { if (regtry((hs_regexp *)prog, s)) return(1); } while (*s++ != '\0'); /* Failure. */ return(0); } /* - regtry - try match at specific point */ static int /* 0 failure, 1 success */ regtry(hs_regexp *prog, const char *string) { int i; char **sp; char **ep; reginput = string; regstartp = (const char **)prog->startp; regendp = (const char **)prog->endp; sp = prog->startp; ep = prog->endp; for (i = NSUBEXP; i > 0; i--) { *sp++ = NULL; *ep++ = NULL; } if (regmatch(prog->program + 1)) { prog->startp[0] = (char *)string; prog->endp[0] = (char *)reginput; return(1); } else return(0); } /* - regmatch - main matching routine * * Conceptually the strategy is simple: check to see whether the current * node matches, call self recursively to see whether the rest matches, * and then act accordingly. In practice we make some effort to avoid * recursion, in particular by going through "ordinary" nodes (that don't * need to know whether the rest of the match failed) by a loop instead of * by recursion. */ static int /* 0 failure, 1 success */ regmatch(char *prog) { char *scan; /* Current node. */ char *next; /* Next node. */ scan = prog; #ifdef DEBUG if (scan != NULL && regnarrate) fprintf(regnarrate, "%s(\n", regprop(scan)); #endif while (scan != NULL) { #ifdef DEBUG if (regnarrate) fprintf(regnarrate, "%s...\n", regprop(scan)); #endif next = regnext(scan); switch (OP(scan)) { case BOL: if (reginput != regbol) return(0); break; case EOL: if (*reginput != '\0') return(0); break; case WORDA: /* Must be looking at a letter, digit, or _ */ if ((!isalnum((int)*reginput)) && *reginput != '_') return(0); /* Prev must be BOL or nonword */ if (reginput > regbol && (isalnum((int)reginput[-1]) || reginput[-1] == '_')) return(0); break; case WORDZ: /* Must be looking at non letter, digit, or _ */ if (isalnum((int)*reginput) || *reginput == '_') return(0); /* We don't care what the previous char was */ break; case ANY: if (*reginput == '\0') return(0); reginput++; break; case EXACTLY: { int len; char *opnd; opnd = OPERAND(scan); /* Inline the first character, for speed. */ if (*opnd != *reginput) return(0); len = strlen(opnd); if (len > 1 && strncmp(opnd, reginput, len) != 0) return(0); reginput += len; } break; case ANYOF: if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL) return(0); reginput++; break; case ANYBUT: if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL) return(0); reginput++; break; case NOTHING: break; case BACK: break; case OPEN+1: case OPEN+2: case OPEN+3: case OPEN+4: case OPEN+5: case OPEN+6: case OPEN+7: case OPEN+8: case OPEN+9: { int no; const char *save; no = OP(scan) - OPEN; save = reginput; if (regmatch(next)) { /* * Don't set startp if some later * invocation of the same parentheses * already has. */ if (regstartp[no] == NULL) regstartp[no] = save; return(1); } else return(0); } break; case CLOSE+1: case CLOSE+2: case CLOSE+3: case CLOSE+4: case CLOSE+5: case CLOSE+6: case CLOSE+7: case CLOSE+8: case CLOSE+9: { int no; const char *save; no = OP(scan) - CLOSE; save = reginput; if (regmatch(next)) { /* * Don't set endp if some later * invocation of the same parentheses * already has. */ if (regendp[no] == NULL) regendp[no] = save; return(1); } else return(0); } break; case BRANCH: { const char *save; if (OP(next) != BRANCH) /* No choice. */ next = OPERAND(scan); /* Avoid recursion. */ else { do { save = reginput; if (regmatch(OPERAND(scan))) return(1); reginput = save; scan = regnext(scan); } while (scan != NULL && OP(scan) == BRANCH); return(0); /* NOTREACHED */ } } break; case STAR: case PLUS: { char nextch; int no; const char *save; int min; /* * Lookahead to avoid useless match attempts * when we know what character comes next. */ nextch = '\0'; if (OP(next) == EXACTLY) nextch = *OPERAND(next); min = (OP(scan) == STAR) ? 0 : 1; save = reginput; no = regrepeat(OPERAND(scan)); while (no >= min) { /* If it could work, try it. */ if (nextch == '\0' || *reginput == nextch) { if (regmatch(next)) return(1); } /* Couldn't or didn't -- back up. */ no--; reginput = save + no; } return(0); } break; case END: return(1); /* Success! */ break; default: hs_regerror("memory corruption"); return(0); break; } scan = next; } /* * We get here only if there's trouble -- normally "case END" is * the terminating point. */ hs_regerror("corrupted pointers"); return(0); } /* - regrepeat - repeatedly match something simple, report how many */ static int regrepeat(char *p) { int count = 0; const char *scan; char *opnd; scan = reginput; opnd = OPERAND(p); switch (OP(p)) { case ANY: count = strlen(scan); scan += count; break; case EXACTLY: while (*opnd == *scan) { count++; scan++; } break; case ANYOF: while (*scan != '\0' && strchr(opnd, *scan) != NULL) { count++; scan++; } break; case ANYBUT: while (*scan != '\0' && strchr(opnd, *scan) == NULL) { count++; scan++; } break; default: /* Oh dear. Called inappropriately. */ hs_regerror("internal foulup"); count = 0; /* Best compromise. */ break; } reginput = scan; return(count); } /* - regnext - dig the "next" pointer out of a node */ static char * regnext(char *p) { int offset; if (p == ®dummy) return(NULL); offset = NEXT(p); if (offset == 0) return(NULL); if (OP(p) == BACK) return(p-offset); else return(p+offset); } #ifdef DEBUG STATIC char *regprop(char *scan); /* - regdump - dump a regexp onto stdout in vaguely comprehensible form */ void regdump(hs_regexp *r) { char *s; char op = EXACTLY; /* Arbitrary non-END op. */ char *next; s = r->program + 1; while (op != END) { /* While that wasn't END last time... */ op = OP(s); printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ next = regnext(s); if (next == NULL) /* Next ptr. */ printf("(0)"); else printf("(%d)", (s-r->program)+(next-s)); s += 3; if (op == ANYOF || op == ANYBUT || op == EXACTLY) { /* Literal string, where present. */ while (*s != '\0') { putchar(*s); s++; } s++; } putchar('\n'); } /* Header fields of interest. */ if (r->regstart != '\0') printf("start `%c' ", r->regstart); if (r->reganch) printf("anchored "); if (r->regmust != NULL) printf("must have \"%s\"", r->regmust); printf("\n"); } /* - regprop - printable representation of opcode */ static char * regprop(char *op) { char *p=NULL; static char buf[50]; (void) strcpy(buf, ":"); switch (OP(op)) { case BOL: p = "BOL"; break; case EOL: p = "EOL"; break; case ANY: p = "ANY"; break; case ANYOF: p = "ANYOF"; break; case ANYBUT: p = "ANYBUT"; break; case BRANCH: p = "BRANCH"; break; case EXACTLY: p = "EXACTLY"; break; case NOTHING: p = "NOTHING"; break; case BACK: p = "BACK"; break; case END: p = "END"; break; case OPEN+1: case OPEN+2: case OPEN+3: case OPEN+4: case OPEN+5: case OPEN+6: case OPEN+7: case OPEN+8: case OPEN+9: sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); p = NULL; break; case CLOSE+1: case CLOSE+2: case CLOSE+3: case CLOSE+4: case CLOSE+5: case CLOSE+6: case CLOSE+7: case CLOSE+8: case CLOSE+9: sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); p = NULL; break; case STAR: p = "STAR"; break; case PLUS: p = "PLUS"; break; case WORDA: p = "WORDA"; break; case WORDZ: p = "WORDZ"; break; default: hs_regerror("corrupted opcode"); break; } if (p != NULL) (void) strcat(buf, p); return(buf); } #endif /* * The following is provided for those people who do not have strcspn() in * their C libraries. They should get off their butts and do something * about it; at least one public-domain implementation of those (highly * useful) string routines has been published on Usenet. */ #ifdef STRCSPN /* * strcspn - find length of initial segment of s1 consisting entirely * of characters not from s2 */ static int strcspn(s1, s2) char *s1; char *s2; { char *scan1; char *scan2; int count; count = 0; for (scan1 = s1; *scan1 != '\0'; scan1++) { for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */ if (*scan1 == *scan2++) return(count); count++; } return(count); } #endif speech_tools/base_class/string/regerror.c0000644000076400007640000000041307262616577017301 0ustar awbawb#include #include #include "regexp.h" void hs_regerror(s) const char *s; { #ifdef ERRAVAIL error("regexp: %s", s); #else fprintf(stderr, "regexp(3): %s\n", s); exit(1); return; /* let std. egrep handle errors */ #endif /* NOTREACHED */ } speech_tools/base_class/string/regsub.c0000644000076400007640000000371007262605664016737 0ustar awbawb/* * regsub * * Copyright (c) 1986 by University of Toronto. * Written by Henry Spencer. Not derived from licensed software. * * Permission is granted to anyone to use this software for any * purpose on any computer system, and to redistribute it freely, * subject to the following restrictions: * * 1. The author is not responsible for the consequences of use of * this software, no matter how awful, even if they arise * from defects in it. * * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. */ #include #include #include "regexp.h" #include "regmagic.h" #ifndef CHARBITS #define UCHARAT(p) ((int)*(unsigned char *)(p)) #else #define UCHARAT(p) ((int)*(p)&CHARBITS) #endif /* - regsub - perform substitutions after a regexp match */ void hs_regsub(prog, source, dest) const hs_regexp *prog; const char *source; char *dest; { register char *src; register char *dst; register char c; register int no; register int len; if (prog == NULL || source == NULL || dest == NULL) { hs_regerror("NULL parm to regsub"); return; } if (UCHARAT(prog->program) != MAGIC) { hs_regerror("damaged regexp fed to regsub"); return; } src = (char *)source; dst = dest; while ((c = *src++) != '\0') { if (c == '&') no = 0; else if (c == '\\' && '0' <= *src && *src <= '9') no = *src++ - '0'; else no = -1; if (no < 0) { /* Ordinary character. */ if (c == '\\' && (*src == '\\' || *src == '&')) c = *src++; *dst++ = c; } else if (prog->startp[no] != NULL && prog->endp[no] != NULL) { len = prog->endp[no] - prog->startp[no]; (void) strncpy(dst, prog->startp[no], len); dst += len; if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */ hs_regerror("damaged match string"); return; } } } *dst++ = '\0'; } speech_tools/base_class/string/EST_strcasecmp.c0000755000076400007640000001051407262605664020332 0ustar awbawb/* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Modified by RJC to have a new name and to take the collation * table as an optional argument. */ #include "EST_strcasecmp.h" #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* * This array is designed for mapping upper and lower case letter * together for a case independent comparison. The mappings are * based upon ascii character sequences. */ static const unsigned char def_charmap[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, }; int EST_strcasecmp(const char *s1, const char *s2, const unsigned char *charmap) { register const unsigned char *cm = charmap?charmap:def_charmap, *us1 = (const unsigned char *)s1, *us2 = (const unsigned char *)s2; int r; while (cm[*us1] == cm[*us2++]) if (*us1++ == '\0') return (0); r = (cm[*us1] - cm[*--us2]); return r; } int EST_strncasecmp(const char *s1, const char *s2, size_t n, const unsigned char *charmap) { if (n != 0) { register const unsigned char *cm = charmap?charmap:def_charmap, *us1 = (const unsigned char *)s1, *us2 = (const unsigned char *)s2; do { if (cm[*us1] != cm[*us2++]) return (cm[*us1] - cm[*--us2]); if (*us1++ == '\0') break; } while (--n != 0); } return (0); } speech_tools/base_class/string/regexp.h0000644000076400007640000000553107262605664016752 0ustar awbawb/* * Copyright (c) 1986 by University of Toronto. * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley * by Henry Spencer. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)regexp.h 8.1 (Berkeley) 6/2/93 */ #ifndef _REGEXP_H_ #define _REGEXP_H_ /* Added by RJC just to make it compile */ /* end of RJC changes */ /* * Definitions etc. for regexp(3) routines. * * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], * not the System V one. */ #define NSUBEXP 10 typedef struct regexp { char *startp[NSUBEXP]; char *endp[NSUBEXP]; char regstart; /* Internal use only. */ char reganch; /* Internal use only. */ char *regmust; /* Internal use only. */ int regmlen; /* Internal use only. */ char program[1]; /* Unwarranted chumminess with compiler. */ } hs_regexp; /* #include */ hs_regexp *hs_regcomp(const char *); int hs_regexec(const hs_regexp *, const char *); #ifdef __cplusplus extern "C" { #endif void hs_regsub(const hs_regexp *, const char *, char *); void hs_regerror(const char *); #ifdef __cplusplus } #endif #endif /* !_REGEXP_H_ */ speech_tools/base_class/string/regmagic.h0000644000076400007640000000023107262605664017226 0ustar awbawb/* * The first byte of the regexp internal "program" is actually this magic * number; the start node begins in the second byte. */ #define MAGIC 0234 speech_tools/base_class/string/string_version.h0000644000076400007640000000534407262605664020535 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Mon Mar 31 1997 */ /************************************************************************/ #ifndef __STRING_VERSION_H__ #define __STRING_VERSION_H__ #define STRING_VERSION "1.2" #define STRING_DATE "May 1998" #endif speech_tools/base_class/string/Makefile0000644000076400007640000000600407262605664016743 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for string class library # # # #=========================================================================# TOP=../.. DIRNAME=base_class/string H = regexp.h regmagic.h string_version.h CSRCS = regerror.c regsub.c EST_strcasecmp.c TSRCS = CPPSRCS = EST_String.cc EST_Regex.cc EST_Chunk.cc regexp.cc LOCAL_DEFAULT_LIBRARY = eststring SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) FILES = $(SRCS) $(TSRCS) $(H) Makefile LOCAL_INCLUDES=-I. ALL = .buildlibs include $(TOP)/config/common_make_rules speech_tools/base_class/inst_tmpl/list_i_t.cc0000644000076400007640000000612707262605664020131 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(int) Declare_TSortable(int) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(int) Instantiate_TSortable(int) #endif speech_tools/base_class/inst_tmpl/list_si_t.cc0000644000076400007640000000613607262605664020314 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(short) Declare_TSortable(short) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(short) Instantiate_TSortable(short) #endif speech_tools/base_class/inst_tmpl/list_f_t.cc0000644000076400007640000000613707262605664020127 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate float lists. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(float) Declare_TSortable(float) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(float) Instantiate_TSortable(float) #endif speech_tools/base_class/inst_tmpl/list_d_t.cc0000644000076400007640000000614207262605664020121 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate double list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(double) Declare_TSortable(double) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(double) Instantiate_TSortable(double) #endif speech_tools/base_class/inst_tmpl/list_c_t.cc0000644000076400007640000000613207262605664020117 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(char) Declare_TSortable(char) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(char) Instantiate_TSortable(char) #endif speech_tools/base_class/inst_tmpl/list_s_t.cc0000644000076400007640000000632707262605664020145 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate some basic string classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TList.h" #include "EST_TSortable.h" Declare_TList(EST_String) Declare_TSortable(EST_String) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(EST_String) Instantiate_TSortable(EST_String) #endif speech_tools/base_class/inst_tmpl/list_val_t.cc0000644000076400007640000000610107262605664020453 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" #include "EST_Val.h" Declare_TList(EST_Val) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(EST_Val) #endif speech_tools/base_class/inst_tmpl/list_li_t.cc0000644000076400007640000000603307262605664020301 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TList.h" #include "EST_types.h" Declare_TList_T(EST_IList, LIST_INT) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList_T(EST_IList, LIST_INT) #endif speech_tools/base_class/inst_tmpl/list_vs_t.cc0000644000076400007640000000635007262605664020327 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate some basic string classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TList.h" #include "EST_TVector.h" #include "EST_TSortable.h" Declare_TList_T(EST_TVector, VEC_STRING) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" typedef EST_TVector tvector_string_t; Instantiate_TList_T(tvector_string_t, VEC_STRING) #endif speech_tools/base_class/inst_tmpl/list_vi_t.cc0000644000076400007640000000660607262605664020321 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate some basic string classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TList.h" #include "EST_TVector.h" #include "EST_TSimpleVector.h" #include "EST_TSortable.h" Declare_TList_T(EST_TVector, VEC_INT) Declare_TList_T(EST_TSimpleVector, SVEC_INT) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" typedef EST_TVector tvector_int_t; typedef EST_TSimpleVector tsimplevector_int_t; Instantiate_TList_T(tvector_int_t, VEC_INT) Instantiate_TList_T(tsimplevector_int_t, SVEC_INT) #endif speech_tools/base_class/inst_tmpl/matrix_i_t.cc0000644000076400007640000000627207262605664020463 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate int basic matrix classes. */ /* */ /************************************************************************/ #include "EST_TMatrix.h" #include "EST_TSimpleMatrix.h" Declare_TMatrix(int) Declare_TSimpleMatrix(int) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleMatrix.cc" #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(int) Instantiate_TSimpleMatrix(int) #endif speech_tools/base_class/inst_tmpl/matrix_si_t.cc0000644000076400007640000000630207262605664020640 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate short basic matrix classes. */ /* */ /************************************************************************/ #include "EST_TMatrix.h" #include "EST_TSimpleMatrix.h" Declare_TMatrix(short) Declare_TSimpleMatrix(short) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleMatrix.cc" #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(short) Instantiate_TSimpleMatrix(short) #endif speech_tools/base_class/inst_tmpl/matrix_f_t.cc0000644000076400007640000000723407610355251020446 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate float basic matrix classes. */ /* */ /************************************************************************/ #include "EST_TMatrix.h" #include "EST_TSimpleMatrix.h" Declare_TMatrix(float) Declare_TSimpleMatrix(float) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleMatrix.cc" #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(float) Instantiate_TSimpleMatrix(float) EST_write_status save(const EST_String &filename, const EST_TMatrix &a) { int i,j; ostream *outf; EST_String s; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return misc_write_error; for (i=0; i < a.num_rows(); i++) { for (j = 0; j < a.num_columns(); ++j) { *outf << a(i,j) << "\t"; } *outf << endl; } if (outf != &cout) delete outf; return write_ok; } #endif speech_tools/base_class/inst_tmpl/matrix_d_t.cc0000644000076400007640000000630607262605664020454 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate double basic matrix classes. */ /* */ /************************************************************************/ #include "EST_TMatrix.h" #include "EST_TSimpleMatrix.h" Declare_TMatrix(double) Declare_TSimpleMatrix(double) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleMatrix.cc" #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(double) Instantiate_TSimpleMatrix(double) #endif speech_tools/base_class/inst_tmpl/matrix_s_t.cc0000644000076400007640000000613107262605664020467 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate short basic matrix classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TMatrix.h" Declare_TMatrix(EST_String) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(EST_String) #endif speech_tools/base_class/inst_tmpl/matrix_val_t.cc0000644000076400007640000000573607262605664021021 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Paul Taylor */ /* Date: July 1998 */ /* -------------------------------------------------------------------- */ /* Instantiate EST_Val basic matrix classes. */ /************************************************************************/ #include "EST_TMatrix.h" #include "EST_Val.h" Declare_TMatrix(EST_Val) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TMatrix.cc" Instantiate_TMatrix(EST_Val) #endif speech_tools/base_class/inst_tmpl/vector_i_t.cc0000644000076400007640000000625207262605664020457 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate int basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector_Base(int, 0, -123456) Declare_TSimpleVector(int) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(int) Instantiate_TSimpleVector(int) #endif speech_tools/base_class/inst_tmpl/vector_si_t.cc0000644000076400007640000000626307262605664020644 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate short basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector_Base(short, 0, -12345) Declare_TSimpleVector(short) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(short) Instantiate_TSimpleVector(short) #endif speech_tools/base_class/inst_tmpl/vector_f_t.cc0000644000076400007640000000723707610347513020451 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate float basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector_Base(float, 0, -123.456) Declare_TSimpleVector(float) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(float) Instantiate_TSimpleVector(float) EST_write_status save(const EST_String &filename, const EST_TVector &a) { int i; ostream *outf; EST_String s; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return misc_write_error; for (i = 0; i < a.n(); ++i) { *outf << a(i) << "\t"; } *outf << endl; if (outf != &cout) delete outf; return write_ok; } #endif speech_tools/base_class/inst_tmpl/vector_d_t.cc0000644000076400007640000000640207262605664020447 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Aug 26 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate double basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector_Base(double, 0, -123.456) Declare_TSimpleVector(double) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(double) Instantiate_TSimpleVector(double) #endif speech_tools/base_class/inst_tmpl/vector_c_t.cc0000644000076400007640000000625307262605664020452 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate char basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector_Base(char, 0, -123) Declare_TSimpleVector(char) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(char) Instantiate_TSimpleVector(char) #endif speech_tools/base_class/inst_tmpl/vector_s_t.cc0000644000076400007640000000604107262605664020465 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate string vector. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TVector.h" Declare_TVector_Class(EST_String, "", "ERROR") #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" Instantiate_TVector(EST_String) #endif speech_tools/base_class/inst_tmpl/vector_val_t.cc0000644000076400007640000000600607262605664021006 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate int basic vector classes. */ /* */ /************************************************************************/ #include "EST_TVector.h" #include "EST_Val.h" Declare_TVector(EST_Val) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" Instantiate_TVector(EST_Val) #endif speech_tools/base_class/inst_tmpl/vector_ls_t.cc0000644000076400007640000000663011465017154020634 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* -------------------------------------------------------------------- */ /* Instantiate string vector. */ /* */ /************************************************************************/ #include "EST_types.h" #include "EST_TVector.h" #include "EST_TSimpleVector.h" Declare_TVector(EST_StrList) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TSimpleVector.cc" #include "../base_class/EST_TVector.cc" #include "../base_class/EST_Tvectlist.cc" Instantiate_TVector(EST_StrList) #endif int operator !=(const EST_StrList &l1, const EST_StrList &l2) { EST_Litem *p1, *p2; for (p1 = l1.head(), p2 = l2.head(); p1 && p2; p1 = p1->next(),p2 = p2->next()) if (l1(p1) != l2(p2)) return false; if (p1 || p2) return false; return true; } speech_tools/base_class/inst_tmpl/vector_fvector_t.cc0000644000076400007640000000606707262605664021703 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: October 1998 */ /* -------------------------------------------------------------------- */ /* Instantiate vector of float vectors (not a matrix !). */ /* */ /************************************************************************/ #include "EST_types.h" #include "EST_TVector.h" Declare_TVector_T(EST_FVector, tvector_fvector) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" Instantiate_TVector_T(EST_FVector, tvector_fvector) #endif speech_tools/base_class/inst_tmpl/vector_fmatrix_t.cc0000644000076400007640000000713210455716656021701 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: October 1998 */ /* -------------------------------------------------------------------- */ /* Instantiate vector of float matrices. */ /* */ /************************************************************************/ #include "EST_types.h" #include "EST_TVector.h" #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" template class EST_TVector; #endif static const EST_FMatrix def_val_FMatrix; static EST_FMatrix error_return_FMatrix; template <> const EST_FMatrix *EST_TVector::def_val = &def_val_FMatrix; template <> EST_FMatrix *EST_TVector::error_return = &error_return_FMatrix; int operator !=(const EST_FMatrix &fm1, const EST_FMatrix &fm2) { int i,j; if(fm1.num_rows() != fm2.num_rows() || fm1.num_columns() != fm2.num_columns() ) return FALSE; for(i=0;i; #endif static const EST_DVector def_val_DVector; static EST_DVector error_return_DVector; template <> const EST_DVector *EST_TVector::def_val = &def_val_DVector; template <> EST_DVector *EST_TVector::error_return = &error_return_DVector; int operator !=(const EST_DVector &fv1, const EST_DVector &fv2) { int i; if(fv1.length() != fv2.length()) return FALSE; for(i=0;i; #endif static const EST_DMatrix def_val_DMatrix; static EST_DMatrix error_return_DMatrix; template <> const EST_DMatrix *EST_TVector::def_val = &def_val_DMatrix; template <> EST_DMatrix *EST_TVector::error_return = &error_return_DMatrix; int operator !=(const EST_DMatrix &fm1, const EST_DMatrix &fm2) { int i,j; if(fm1.num_rows() != fm2.num_rows() || fm1.num_columns() != fm2.num_columns() ) return FALSE; for(i=0;i float EST_THash::Dummy_Key = 0.0; template <> int EST_THash::Dummy_Value = 0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_THash(float, int) #endif speech_tools/base_class/inst_tmpl/hash_ii_t.cc0000644000076400007640000000601010045431120020212 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash int int base classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_THash.h" template <> int EST_THash::Dummy_Key = 0; template <> int EST_THash::Dummy_Value = 0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_THash(int,int) #endif speech_tools/base_class/inst_tmpl/hash_sd_t.cc0000644000076400007640000000606510045431120020231 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash/L base classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> double EST_THash::Dummy_Value = 0.0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(double) #endif speech_tools/base_class/inst_tmpl/hash_sf_t.cc0000644000076400007640000000606110045431120020227 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash string float classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> float EST_THash::Dummy_Value = 0.0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(float) #endif speech_tools/base_class/inst_tmpl/hash_ss_t.cc0000644000076400007640000000634010045431120020244 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black (awb@cstr.ed.ac.uk) */ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash string string base class. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_String EST_THash::Dummy_Value = "DUMMY"; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(EST_String) #endif speech_tools/base_class/inst_tmpl/hash_si_t.cc0000644000076400007640000000604510045431120020234 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash string int base class. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> int EST_THash::Dummy_Value = 0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(int) #endif speech_tools/base_class/inst_tmpl/hash_sv_t.cc0000644000076400007640000000640610045431120020252 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black (awb@cstr.ed.ac.uk) */ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash string string base class. */ /* */ /************************************************************************/ #include "EST_THash.h" #include "EST_String.h" #include "EST_Val.h" static EST_Val Dummy_Val; template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_Val EST_THash::Dummy_Value = Dummy_Val; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(EST_Val) #endif speech_tools/base_class/inst_tmpl/hash_iv_t.cc0000644000076400007640000000636310045431120020242 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Alan W Black (awb@cstr.ed.ac.uk) */ /* Date: March 1999 */ /* ---------------------------------------------------------------------*/ /* */ /* Instantiate THash int val base class. */ /* */ /************************************************************************/ #include "EST_THash.h" #include "EST_Val.h" static EST_Val Dummy_Val; template <> int EST_THash::Dummy_Key = 0; template <> EST_Val EST_THash::Dummy_Value = Dummy_Val; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_THash(int,EST_Val) #endif speech_tools/base_class/inst_tmpl/hash_sfmp_t.cc0000644000076400007640000000617310045431120020570 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash/L base classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_FMatrix.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_FMatrix *EST_THash::Dummy_Value = NULL; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash_T(EST_FMatrix*,EST_StringFMatrixP) #endif speech_tools/base_class/inst_tmpl/hash_srp.cc0000644000076400007640000000622010045431120020075 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Date: December 1997 */ /* ---------------------------------------------------------------------*/ /* Instantiate THash/L base classes. */ /* */ /************************************************************************/ #include "EST_String.h" #include "ling_class/EST_Relation.h" #include "EST_THash.h" template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_Relation *EST_THash::Dummy_Value = NULL; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash_T_MIN(EST_Relation*,EST_StringRelationP) #endif speech_tools/base_class/inst_tmpl/tbuffer_t.cc0000644000076400007640000000617010044502521020255 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Date: December 1997 */ /* ------------------------------------------------------------------- */ /* Instantiate some basic list classes. */ /* */ /************************************************************************/ #include "EST_TBuffer.h" struct old_tbuffer EST_old_buffers[TBUFFER_N_OLD]; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TBuffer.cc" template class EST_TBuffer; template class EST_TBuffer; template class EST_TBuffer; template class EST_TBuffer; #endif speech_tools/base_class/inst_tmpl/deq_s_t.cc0000644000076400007640000000602507262605664017736 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* ---------------------------------------------------------------------*/ /* Instantiate DEQ string base class. */ /* */ /************************************************************************/ #include "EST_String.h" #include "EST_TDeque.h" Declare_TDEQ_Class(EST_String,"FILLER") #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TDeque.cc" Instantiate_TDEQ(EST_String) #endif speech_tools/base_class/inst_tmpl/deq_i_t.cc0000644000076400007640000000600507262605664017722 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Instantiate queue class for integers. */ /* */ /*************************************************************************/ #include "EST_String.h" #include "EST_TDeque.h" Declare_TDEQ_Base(int,0) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TDeque.cc" Instantiate_TDEQ(int) #endif speech_tools/base_class/inst_tmpl/Makefile0000644000076400007640000000752410463132600017434 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for base class instantiations # # # # Keeping these as different .o files makes the binaries a lot smaller # # # #=========================================================================# TOP=../.. DIRNAME=base_class/inst_tmpl LOCAL_DEFAULT_LIBRARY = estbase TSRCS = list_i_t.cc list_si_t.cc list_f_t.cc list_d_t.cc \ list_c_t.cc list_s_t.cc \ list_val_t.cc \ list_li_t.cc list_vs_t.cc list_vi_t.cc \ \ matrix_i_t.cc matrix_si_t.cc matrix_f_t.cc matrix_d_t.cc \ matrix_s_t.cc \ matrix_val_t.cc \ \ vector_i_t.cc vector_si_t.cc vector_f_t.cc vector_d_t.cc \ vector_c_t.cc vector_s_t.cc \ vector_val_t.cc vector_ls_t.cc \ vector_fvector_t.cc vector_fmatrix_t.cc \ vector_dvector_t.cc vector_dmatrix_t.cc \ \ kvl_fi_t.cc kvl_ii_t.cc kvl_sd_t.cc kvl_sf_t.cc \ kvl_ss_t.cc kvl_si_t.cc kvl_sv_t.cc kvl_rs_t.cc kvl_vpi_t.cc \ \ hash_fi_t.cc hash_ii_t.cc hash_sd_t.cc hash_sf_t.cc \ hash_ss_t.cc hash_si_t.cc hash_sv_t.cc hash_iv_t.cc \ hash_sfmp_t.cc hash_srp.cc \ \ tbuffer_t.cc \ \ deq_s_t.cc deq_i_t.cc \ \ # kvl_srcfmp_t.cc kvl_scsmm_t.cc matrix_c_t.cc CPPSRCS = $(TSRCS) SRCS = $(CPPSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) Makefile timeindex_tr.cc ALL = .buildlib $(BUILD_DIRS) include $(TOP)/config/common_make_rules speech_tools/base_class/inst_tmpl/timeindex_tr.cc0000644000076400007640000000726507262605664021022 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Mar 25 1998 */ /* -------------------------------------------------------------------- */ /* Instantiate the templates for time index on tracks. */ /* */ /*************************************************************************/ #include "EST_TTimeIndex.h" #include "EST_Track.h" static EST_TTI_Entry def_val_s; static EST_TTI_Entry error_return_s; const EST_TTI_Entry *EST_TVector >::def_val(&def_val_s); EST_TTI_Entry *EST_TVector >::error_return(&error_return_s); #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TTimeIndex.cc" #include "../base_class/EST_TVector.cc" template class EST_TTimeIndex; template class EST_TTI_Entry; template class EST_TVector >; template int operator !=(const EST_TTI_Entry &e1, const EST_TTI_Entry &e2); template ostream& operator <<(ostream &s, const EST_TTI_Entry &e); #endif speech_tools/ling_class/EST_Item.cc0000644000076400007640000004064010327756134015733 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* Linguistic items (e.g. words, phones etc) held as part of Relations */ /* */ /* These objects may be held in relations within an utterance. They */ /* fact contain two sections, a structural part and a contents part */ /* (EST_Item_Content) though the user will usually only see the whole */ /* object. The content part may be shared between linguistic items in */ /* other relations, e.g. the word item may appear both in the word */ /* relation and the syntax relation. */ /* */ /* Each linguistic item is in a particular relation but it is easy */ /* to link to that item in another relation. Traversal of the relation */ /* for an item in it is trivial. */ /* */ /*=======================================================================*/ #include #include #include #include #include "ling_class/EST_Item.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_Utterance.h" #include "EST_TKVL.h" #include "EST_UList.h" #include "EST_string_aux.h" #include "ling_class_init.h" /* Class initialisation. This is where you should register * feature functions and so on. */ void EST_Item::class_init(void) { #ifdef EST_DEBUGGING cerr << "Calling EST_Item init\n"; #endif ling_class_init::use(); EST_register_feature_functions(standard); #ifdef EST_DEBUGGING cerr << "Finished EST_Item init\n"; #endif } EST_Item::EST_Item() { p_relation = 0; p_contents = 0; n=p=u=d=0; set_contents(0); } void EST_Item::copy(const EST_Item &s) { // You can't really do this in general as a node is doubly // linked to its neighbours and item. Copying all the fields would // mean it was no longer true (unless you copied everything). // So all you get for this is a *copy* of the contents (not a reference // to) p_relation = 0; p_contents = 0; n=p=u=d=0; set_contents(0); // get an empty contents structure *p_contents = *s.p_contents; } EST_Item::EST_Item(const EST_Item &i) { copy(i); } EST_Item::~EST_Item() { // Delete this item and its daughters (and the contents with no // other links) // Assumes a tree structure EST_Item *ds,*nds; // Tidy up pointers to this if (n != 0) { n->p = p; n->u = u; // when deleting first daughter. } if (p != 0) p->n = n; if (u != 0) u->d = n; if (p_relation) { if (p_relation->p_head == this) p_relation->p_head = n; if (p_relation->p_tail == this) p_relation->p_tail = p; } // A little cleverer with the daughters for (ds=d; ds != 0; ds=nds) { nds=ds->n; delete ds; } unref_contents(); } EST_Item::EST_Item(EST_Relation *rel) { p_relation = rel; p_contents = 0; n=p=u=d=0; } // all internal ids are found by getting the next id number from // the utterance and prefixing a "_" to show that this is internally // generated. static void assign_id(EST_Item *s) { if (s->f_present("id")) return; EST_Utterance *u = get_utt(s); if (u != 0) s->set("id", "_" + itoString(u->next_id())); } EST_Item::EST_Item(EST_Relation *rel, EST_Item *li) { p_relation = rel; p_contents = 0; n=p=u=d=0; set_contents(li->contents()); assign_id(this); } void EST_Item::evaluate_features() { evaluate(this,p_contents->f); } void EST_Item::unref_contents() { // Unref the related contents to this item, delete if no-one else is // referencing it if (p_contents != 0) { if (p_contents->unref_relation(relation_name())) delete p_contents; p_contents = 0; } } void EST_Item::unref_all() { // Unreference this item from all its relations, deleting its contents p_contents->unref_and_delete(); } const EST_String &EST_Item::relation_name() const { return ((this == 0) || (p_relation == 0)) ? EST_String::Empty : p_relation->name(); } void EST_Item::set_contents(EST_Item_Content *new_contents) { // This function is for internal use only, general use of this // is likely to be unsafe. EST_Item_Content *c; if (new_contents == 0) c = new EST_Item_Content; else c = new_contents; if (p_contents != c) { unref_contents(); p_contents = c; EST_Item *nn_item = p_contents->Relation(relation_name()); if (nn_item) // this is already linked to this relation { // can't recurse on set_contents nn_item->p_contents = new EST_Item_Content; nn_item->p_contents->relations.add_item(relation_name(), est_val(nn_item)); } p_contents->relations.add_item(relation_name(),est_val(this)); } } int EST_Item::length() const { int i=0; EST_Item *nn = (EST_Item *)(void *)this; for (; nn; nn=nn->n,i++); return i; } EST_Item *EST_Item::insert_after(EST_Item *si) { // Create a new item and add it after t, and return it. // Include the cross link from this new item's contents to si, and // from si's relations fields back to the new node EST_Item *new_node = new EST_Item(p_relation,si); new_node->p = this; new_node->n = this->n; if (new_node->n != 0) new_node->n->p = new_node; this->n = new_node; if (p_relation && (p_relation->p_tail == this)) p_relation->p_tail = new_node; return new_node; } EST_Item *EST_Item::insert_before(EST_Item *si) { // Create a new node and add it before this, and return it. EST_Item *new_node = new EST_Item(p_relation,si); new_node->n = this; new_node->p = this->p; if (new_node->p != 0) new_node->p->n = new_node; this->p = new_node; // This makes an assumption that we represent trees with only // the first daughter pointing to the parent if (this->u) { new_node->u = this->u; new_node->u->d = new_node; this->u = 0; } if (p_relation && (p_relation->p_head == this)) p_relation->p_head = new_node; return new_node; } EST_Item *EST_Item::insert_below(EST_Item *si) { // Create a new node and add it below this, and return it. EST_Item *new_node = new EST_Item(p_relation,si); new_node->u = this; new_node->d = this->d; if (new_node->d != 0) new_node->d->u = new_node; this->d = new_node; return new_node; } EST_Item *EST_Item::insert_above(EST_Item *si) { // Create a new node and add it above this, and return it. EST_Item *new_node = new EST_Item(p_relation,si); new_node->d = this; new_node->u = this->u; if (new_node->u != 0) new_node->u->d = new_node; this->u = new_node; if (p_relation && (p_relation->p_head == this)) p_relation->p_head = new_node; if (p_relation && (p_relation->p_tail == this)) p_relation->p_tail = new_node; return new_node; } EST_Item *EST_Item::insert_parent(EST_Item *si) { // Insert new parent here, by added a new below node and moving // the contents down to it. if (this == 0) return 0; insert_below(0); down()->set_contents(grab_contents()); if (si != 0) set_contents(si->grab_contents()); else set_contents(0); return this; } EST_Item *EST_Item::last() const { // To get round the const access to this EST_Item *node = (EST_Item *)(void *)this; if (this == 0) return 0; for (; node->n != 0; node=node->n); return node; } EST_Item *EST_Item::first() const { // To get round the const access to this EST_Item *node = (EST_Item *)(void *)this; if (this == 0) return 0; for (; node->p != 0; node=node->p); return node; } EST_Item *EST_Item::top() const { EST_Item *node = (EST_Item *)(void *)this; if (this == 0) return 0; for (; parent(node) != 0; node=parent(node)); return node; } EST_Item *EST_Item::next_leaf() const { if (this == 0) return 0; else if (next() != 0) return next()->first_leaf(); else return parent(this)->next_leaf(); } EST_Item *EST_Item::next_item() const { // For traversal through a relation, in pre-order (root then daughters) if (this == 0) return 0; else if (down() != 0) return down(); else if (next() != 0) return next(); else { // at the right most leaf so go up until you find a parent with a next for (EST_Item *pp = parent(this); pp != 0; pp = parent(pp)) if (pp->next()) return pp->next(); return 0; } } EST_Item *EST_Item::first_leaf() const { // Leafs are defined as those nodes with no daughters if (this == 0) return 0; if (down() == 0) return (EST_Item *)(void *)this; else return down()->first_leaf(); } EST_Item *EST_Item::last_leaf() const { // Leafs are defined as those nodes with no daughters if (this == 0) return 0; else if (next()) return next()->last_leaf(); else if (down()) return down()->last_leaf(); else return (EST_Item *)(void *)this; } EST_Item *first_leaf_in_tree(const EST_Item *root) { return root->first_leaf(); } EST_Item *last_leaf_in_tree(const EST_Item *root) { if (root == 0) return 0; else if (root->down() == 0) return (EST_Item *)(void *)root; else return root->down()->last_leaf(); } EST_Item *EST_Item::append_daughter(EST_Item *si) { if (this == 0) return 0; EST_Item *nnode; EST_Item *its_downs; // Because we don't distinguish forests properly we need // to do nasty things if this si is already associated to a // this relation and its "in the top list" EST_Item *c = si->as_relation(relation_name()); if (in_list(c,p_relation->head())) { // need to save its daughters to put on the new node its_downs = c->d; c->d = 0; // otherwise it could delete its sub tree if (its_downs) its_downs->u = 0; if (down() == 0) nnode = insert_below(si); else nnode = down()->last()->insert_after(si); // put daughters back on the new item if (its_downs) { its_downs->u = nnode; nnode->d = its_downs; } delete c; // delete its old form from the top level } else if (down() == 0) nnode = insert_below(si); else nnode = down()->last()->insert_after(si); return nnode; } EST_Item *EST_Item::prepend_daughter(EST_Item *si) { if (this == 0) return 0; EST_Item *nnode; EST_Item *its_downs; // Because we don't distinguish forests properly we need // to do nasty things if this si is already associated to a // this relation and its "in the top list" EST_Item *c = si->as_relation(relation_name()); if (in_list(c,p_relation->head())) { // need to save its daughters to put on the new node its_downs = c->d; c->d = 0; // otherwise it could delete its sub tree if (its_downs) its_downs->u = 0; if (down() == 0) nnode = insert_below(si); else nnode = down()->insert_before(si); // put daughters back on the new item if (its_downs) { its_downs->u = nnode; nnode->d = its_downs; } delete c; // delete its old form from the top level } else if (down() == 0) nnode = insert_below(si); else nnode = down()->insert_before(si); return nnode; } EST_Item *EST_Item::grab_daughters() { EST_Item *dd = down(); if (dd) { dd->u = 0; d = 0; } return dd; } EST_Item_Content *EST_Item::grab_contents(void) { // Unreference contents, but don't delete them if that's the // last reference. It is the caller's responsibility to deal // with these contents, typically they are just about to be set // as contents of someone else so are only orphaned for a short // time EST_Item_Content *c = contents(); c->unref_relation(relation_name()); p_contents = 0; set_contents(0); // can't sit without contents return c; } void copy_node_tree(EST_Item *from, EST_Item *to) { // Copy this node and all its siblings and daughters if (from->next() != 0) copy_node_tree(from->next(),to->insert_after(from->next())); if (from->down() != 0) copy_node_tree(from->down(),to->insert_below(from->down())); } void copy_node_tree_contents(EST_Item *from, EST_Item *to) { // Copy this node and all its siblings and daughters // also copy the item's contents if (from->next() != 0) { EST_Item i = *from->next(); // copies the contents copy_node_tree_contents(from->next(),to->insert_after(&i)); } if (from->down() != 0) { EST_Item i = *from->down(); copy_node_tree_contents(from->down(),to->insert_below(&i)); } } int EST_Item::verify() const { // Return FALSE if this node and its neighbours aren't // properly linked if (this == 0) return TRUE; if (((d == 0) || (d->u == this)) && ((n == 0) || (n->p == this)) && (d->verify()) && (n->verify())) return TRUE; else return FALSE; } EST_Item *append_daughter(EST_Item *n, EST_Item *p) { return n->append_daughter(p); } EST_Item *append_daughter(EST_Item *n,const char *relname, EST_Item *p) { return append_daughter(as(n,relname),p); } EST_Item *prepend_daughter(EST_Item *n, EST_Item *p) { return n->prepend_daughter(p); } EST_Item *prepend_daughter(EST_Item *n, const char *relname, EST_Item *p) { return prepend_daughter(as(n,relname),p); } void remove_item(EST_Item *l, const char *relname) { EST_Item *lr = l->as_relation(relname); EST_Relation *r = lr->relation(); if ((lr != 0) && (r != 0)) r->remove_item(lr); } EST_Item &EST_Item::operator=(const EST_Item &s) { copy(s); return *this; } ostream& operator << (ostream &s, const EST_Item &a) { a.features().save(s); return s; } void evaluate(EST_Item *a,EST_Features &f) { EST_Features::RwEntries p; for(p.begin(f); p; ++p) if (p->v.type() == val_type_featfunc) { if (featfunc(p->v) != NULL) p->v = (featfunc(p->v))(a); else { fprintf(stderr, "NULL %s function\n", (const char *) p->k ); p->v = EST_Features::feature_default_value; } } } VAL_REGISTER_CLASS_NODEL(item,EST_Item) speech_tools/ling_class/EST_Item_Content.cc0000644000076400007640000001156011465017155017421 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* Content part of a linguistic item, normally only referenced from */ /* EST_Item */ /* */ /*=======================================================================*/ #include #include #include #include "ling_class/EST_Item_Content.h" #include "ling_class/EST_Item.h" #include "EST_error.h" void EST_Item_Content::copy(const EST_Item_Content &x) { f = x.f; // don't copy the relations as they have relation dependencies } EST_Item_Content::~EST_Item_Content() { if (relations.length() != 0) { // Shouldn't get here, but just in case. cerr << "EST_Contents: contents still referenced by Relations" << endl; } } int EST_Item_Content::unref_relation(const EST_String &relname) { // Unreference this item from this relation. Returns TRUE // if no one else is referencing it, FALSE otherwise if (this != 0) { if ((relname == "") && (relations.length() == 1)) { // sigh, something to with isolated EST_Items and // SunCC causes a problems in exit(), so hit it with // a bigger stick relations.clear(); return TRUE; } if (relations.present(relname)) relations.remove_item(relname); else printf("failed to find %s in %s at %g\n", (const char *)relname, (const char *)name(), f.F("end",0.0)); if (relations.length() == 0) return TRUE; } return FALSE; } int EST_Item_Content::unref_and_delete() { // Unreference from all relations and delete EST_Item *np; EST_Litem *p; for (p=relations.list.head(); p;) { np = ::item(relations.list(p).v); p=p->next(); delete np; } // When the last relation is deleted this contents itself will be // delete too, from underneath us. return 0; } EST_Item_Content &EST_Item_Content::operator=(const EST_Item_Content &x) { copy(x); return *this; } ostream& operator << (ostream &s, const EST_Item_Content &a) { EST_Litem *p; s << a.name() << " ; "; s << a.f; s << "Relations"; for (p=a.relations.list.head(); p; p = p->next()) s << " " << a.relations.list(p).k; s << endl; return s; } VAL_REGISTER_CLASS_NODEL(icontent,EST_Item_Content) speech_tools/ling_class/item_aux.cc0000644000076400007640000002113411465017155016127 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* Various auxiliary item/relation functions for tree manipulation */ /* */ /*=======================================================================*/ #include #include #include #include #include "ling_class/EST_Item.h" #include "ling_class/EST_Item_Content.h" #include "ling_class/EST_Relation.h" int in_list(const EST_Item *c,const EST_Item *l) { const EST_Item *i; for (i=l; i != 0; i=i->next()) if (i == c) return TRUE; return FALSE; } int in_tree(const EST_Item *c,const EST_Item *t) { EST_Item *i; if (t == c) return TRUE; else { for (i=daughter1(t); i != 0; i=next_sibling(i)) if (in_tree(c,i)) return TRUE; return FALSE; } } void remove_item_list(EST_Relation *rel, EST_Item *item) { if (item==NULL) return; EST_Item *p = item->prev(); EST_Item *n = item->next(); rel->remove_item(item); EST_Item::splice(p,n); } int merge_item(EST_Item *from, EST_Item *to) { // Make all references to from be references to to and merge // from's features into to EST_Item *i; merge_features(to->features(),from->features()); EST_Litem *r; for (r = from->relations().list.head(); r; r=r->next()) { i = item(from->relations().list(r).v); if (i != from) i->set_contents(to->contents()); } from->set_contents(to->contents()); return TRUE; } void merge_features(EST_Item *to, EST_Item *from, int keep_id) { // Merge item features, but with option of preserving ids EST_String keep; if (keep_id) keep = to->S("id", "0"); merge_features(to->features(),from->features()); if (keep_id) to->set("id", keep); } int move_item(EST_Item *from, EST_Item *to) { // from's contents be to's contents, deleting from and all // its daughters from to's relation. EST_Item *rfrom = from->as_relation(to->relation_name()); to->set_contents(from->contents()); if (rfrom != 0) // from is current in this relation delete rfrom; // so delete it and its daughters return TRUE; } int move_sub_tree(EST_Item *from, EST_Item *to) { // make from's contents be to's contents, delete all of to's // daughters and rebuild from's descendants beneath to. EST_Item *rfrom = from->as_relation(to->relation_name()); EST_Item *d,*r,*nr; if (in_tree(to,from)) return FALSE; // can't do that to->set_contents(from->contents()); // Remove current daughters, but don't delete them // until after the copy in case from is within to's daughters d = to->grab_daughters(); if (rfrom == d) d = d->next(); if ((rfrom != 0) && (daughter1(rfrom))) { // copy the descendant structure copy_node_tree(daughter1(rfrom),to->insert_below(daughter1(rfrom))); delete rfrom; } for (r=d; r; r=nr) { nr = r->next(); delete r; } return TRUE; } int exchange_sub_trees(EST_Item *from,EST_Item *to) { // Take contents of from and its daughters and replace // them with contents of to and its daughters (and the reverse) EST_Item *rfrom = from->as_relation(to->relation_name()); if ((!rfrom) || (in_tree(rfrom,to)) || (in_tree(to,rfrom))) return FALSE; // one or other in the other EST_Item_Content *toc = to->grab_contents(); EST_Item_Content *fromc = rfrom->grab_contents(); EST_Item *from_d = rfrom->grab_daughters(); EST_Item *to_d = to->grab_daughters(); to->set_contents(fromc); rfrom->set_contents(toc); if (from_d) copy_node_tree(from_d,to->insert_below(from_d)); if (to_d) copy_node_tree(to_d,from->insert_below(to_d)); return TRUE; } EST_Item *item_jump(EST_Item *from, const EST_String &to) { // This function jumps around standard festival relation structures. // Designed to be fast rather than anything else. // Behaviour is undefined for non standard structures. // Gives the first of non-unique items. int f=0,t=0; if (to == "Segment") t=1; else if (to == "Syllable") t=2; else if (to == "Word") t=3; else if (to == "IntEvent") t=4; if (from->in_relation("Segment")) f=1; else if (from->in_relation("Syllable")) f=2; else if (from->in_relation("Word")) f=3; else if (from->in_relation("IntEvent")) f=4; if ( t == 0 || f == 0 ) return 0; if ( t == f ) return from; switch(f) { case 1: // from Segment switch(t) { case 2: // Syllable return(from->as_relation("SylStructure")->up()->as_relation("Syllable")); case 3: // Word return(from->as_relation("SylStructure")->up()->up()->as_relation("Word")); case 4: // IntEvent return(from->as_relation("SylStructure")->up()->as_relation("Intonation")->down()->as_relation("IntEvent")); } case 2: // from Syllable switch(t) { case 1: // Segment return(from->as_relation("SylStructure")->down()->as_relation("Segment")); case 3: // Word return(from->as_relation("SylStructure")->up()->as_relation("Word")); // IntEvent case 4: return(from->as_relation("Intonation")->down()->as_relation("IntEvent")); } case 3: // from Word switch(t) { case 1: // Segment return(from->as_relation("SylStructure")->down()->down()->as_relation("Segment")); case 2: // Syllable return(from->as_relation("SylStructure")->down()->as_relation("Syllable")); case 4: return(from->as_relation("SylStructure")->down()->as_relation("Intonation")->down()->as_relation("IntEvent")); } case 4: // from IntEvent switch(t) { case 1: // Segment return(from->as_relation("Intonation")->up()->as_relation("SylStructure")->down()->as_relation("Segment")); case 2: // Syllable return(from->as_relation("Intonation")->up()->as_relation("Syllable")); case 3: // Word return(from->as_relation("Intonation")->up()->as_relation("SylStructure")->up()->as_relation("Word")); } } return NULL; } speech_tools/ling_class/EST_relation_aux.cc0000644000076400007640000004436011465017155017527 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Simon King */ /* Date : June 1995 */ /*-----------------------------------------------------------------------*/ /* Relation class auxiliary routines */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_types.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_relation_aux.h" #include "EST_string_aux.h" #include "EST_io_aux.h" #include "EST_Option.h" #include "EST_Token.h" static int is_in_class(const EST_String &name, EST_StrList &s); bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, float ins, float del, float sub); float start(EST_Item *n) { return (n->prev() == 0) ? 0.0 : n->prev()->F("end"); } float duration(EST_Item *n) { return n->F("end") - start(n); } void quantize(EST_Relation &a, float q) { EST_Item *a_ptr; float end; for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) { end = a_ptr->F("end") / q; end = rint(end); end = end * q; a_ptr->set("end", end); } } // edit labels using a sed file to do the editing int edit_labels(EST_Relation &a, EST_String sedfile) { EST_Item *a_ptr; char command[100], name[100], newname[100], sf[100]; FILE *fp; strcpy(sf, sedfile); EST_String file1, file2; file1 = make_tmp_filename(); file2 = make_tmp_filename(); fp = fopen(file1, "wb"); if (fp == NULL) { fprintf(stderr,"edit_labels: cannot open \"%s\" for writing\n", (const char *)file1); return -1; } for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) { strcpy(name, a_ptr->name()); fprintf(fp, "%s\n", name); } fclose(fp); strcpy(command, "cat "); strcat(command, file1); strcat(command, " | sed -f "); strcat(command, sedfile); strcat(command, " > "); strcat(command, file2); printf("command: %s\n", command); system(command); fp = fopen(file2, "rb"); if (fp == NULL) { fprintf(stderr,"edit_labels: cannot open \"%s\" for reading\n", (const char *)file2); return -1; } for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) { fscanf(fp, "%s", newname); // cout << "oldname: " << a_ptr->name() << " newname: " << newname << endl; a_ptr->set_name(newname); } fclose(fp); return 0; } // make new EST_Relation from start and end points. void extract(const EST_Relation &orig, float s, float e, EST_Relation &ex) { EST_Item *a; EST_Item *tmp; for (a = orig.head(); a != 0; a = a->next()) if ((a->F("end") > s) && (start(a) < e)) { tmp = ex.append(a); if ((a->F("end") > e)) tmp->set("end", e); } } void merge_all_label(EST_Relation &seg, const EST_String &labtype) { EST_Item *a_ptr, *n_ptr; (void)labtype; // unused parameter for (a_ptr = seg.head(); a_ptr != seg.tail(); a_ptr = n_ptr) { n_ptr = a_ptr->next(); if (a_ptr->name() == a_ptr->next()->name()) seg.remove_item(a_ptr); } } void change_label(EST_Relation &seg, const EST_String &oname, const EST_String &nname) { EST_Item *a_ptr; for (a_ptr = seg.head(); a_ptr != 0; a_ptr = a_ptr->next()) if (a_ptr->name() == oname) a_ptr->set_name(nname); } void change_label(EST_Relation &seg, const EST_StrList &oname, const EST_String &nname) { EST_Item *a_ptr; EST_Litem *p; for (a_ptr = seg.head(); a_ptr != 0; a_ptr = a_ptr->next()) for (p = oname.head(); p ; p = p->next()) if (a_ptr->name() == oname(p)) a_ptr->set_name(nname); } static int is_in_class(const EST_String &name, EST_StrList &s) { EST_Litem *p; for (p = s.head(); p; p = p->next()) if (name == s(p)) return TRUE; return FALSE; } int check_vocab(EST_Relation &a, EST_StrList &vocab) { EST_Item *s; for (s = a.head(); s; s = s->next()) if (!is_in_class(s->name(), vocab)) { cerr<<"Illegal entry in file " <next()) if (is_in_class(a_ptr->name(), pos_list)) a_ptr->set(broad_name, (polarity) ? 1 : 0); else a_ptr->set(broad_name, (polarity) ? 0 : 1); } void label_map(EST_Relation &seg, EST_Option &map) { EST_Item *p, *n; for (p = seg.head(); p != 0; n = p) { n = p->next(); if (map.present(p->name())) { if (map.val(p->name()) == "!DELETE") seg.remove_item(p); else p->set_name(map.val(p->name())); } } } void shift_label(EST_Relation &seg, float shift) { //shift every end time by adding x seconds. EST_Item *a_ptr; for (a_ptr = seg.head(); a_ptr != 0; a_ptr = a_ptr->next()) a_ptr->set("end", a_ptr->F("end") + shift); } void RelationList_select(EST_RelationList &mlf, EST_StrList filenames, bool exact_match) { // select only files in 'filenames' // remove all others from mlf EST_Litem *fptr, *ptr; bool flag; // if not exact match, only match basenames EST_StrList tmp_filenames; for (ptr = filenames.head(); ptr != NULL; ptr = ptr->next()) if(exact_match) tmp_filenames.append( filenames(ptr) ); else tmp_filenames.append( basename(filenames(ptr)) ); for(fptr=mlf.head(); fptr != NULL;) { flag=false; for (ptr = tmp_filenames.head(); ptr != NULL; ptr = ptr->next()) if(exact_match) { if(tmp_filenames(ptr) == mlf(fptr).name()) { flag=true; break; } } else if(mlf(fptr).name().contains(tmp_filenames(ptr))) { flag=true; break; } if(!flag) { fptr = mlf.remove(fptr); if(fptr==0) // must have removed head of list fptr=mlf.head(); else fptr=fptr->next(); } else fptr=fptr->next(); } tmp_filenames.clear(); } // look for a single file called "filename" and make a EST_Relation out of // this EST_Relation RelationList_extract(EST_RelationList &mlf, const EST_String &filename, bool base) { EST_Litem *p; EST_String test, ref; if (base) for (p = mlf.head(); p; p = p->next()) { if (basename(mlf(p).name(), "*")==basename(filename, "*")) return mlf(p); } else for (p = mlf.head(); p; p = p->next()) { if (basename(mlf(p).name()) == filename) return mlf(p); } cerr << "No match for file " << filename << " found in mlf\n"; EST_Relation d; return d; } // combine all relation in MLF into a single relation. EST_Relation RelationList_combine(EST_RelationList &mlf) { EST_Litem *p; EST_Relation all; EST_Item *s, *t = 0; float last = 0.0; for (p = mlf.head(); p; p = p->next()) { for (s = mlf(p).head(); s; s = s->next()) { t = all.append(); t->set("name", s->S("name")); t->set("end", s->F("end") + last); cout << "appended t " << t << endl; } last = (t != 0) ? t->F("end") : 0.0; } return all; } EST_Relation RelationList_combine(EST_RelationList &mlf, EST_Relation &key) { EST_Litem *p; EST_Relation all; EST_Item *s, *t = 0, *k; float st; if (key.length() != mlf.length()) { cerr << "RelationList has " << mlf.length() << " elements: expected " << key.length() << " from key file\n"; return all; } for (k = key.head(), p = mlf.head(); p; p = p->next(), k = k->next()) { st = start(k); for (s = mlf(p).head(); s; s = s->next()) { t = all.append(); t->set("name", s->S("name")); t->set("end", (s->F("end") + st)); } } return all; } int relation_divide(EST_RelationList &slist, EST_Relation &lab, EST_Relation &keylab, EST_StrList &blank, EST_String ext) { // divides a single relation into multiple chunks according to the // keylab relation. If the keylab boundary falls in the middle of a label, // the label is assigned to the chunk which has the most overlap with // it. Some labels may be specified in the "blank" list which means thy // are duplicated across boundaries. EST_Relation a, newkey; EST_Item *s, *k, *t = 0, *n; EST_String filename; float kstart; slist.clear(); if ((keylab.tail())->F("end") < (lab.tail())->F("end")) { cerr << "Key file must extend beyond end of label file\n"; return -1; } // find a the first keylab that will make a non-empty file for (k = keylab.head(); k ; k = k->next()) if (k->F("end") > lab.head()->F("end")) break; filename = (EST_String)k->f("file"); a.f.set("name", (filename + ext)); kstart = 0.0; for (s = lab.head(); s; s = s->next()) { n = s->next(); if (n == 0) { t = a.append(s); t->set("end", (s->F("end") - kstart)); break; } if (n->F("end") > k->F("end")) { if (((n->F("end") - k->F("end")) < (k->F("end") - start(n))) || is_in_class(n->name(), blank)) { a.append(s); t->set("end", (s->F("end") - kstart)); t = a.append(n); t->set("end", (k->F("end") - kstart)); if (!is_in_class(n->name(), blank)) s = s->next(); } else { t = a.append(s); t->set("end", (k->F("end") - kstart)); } slist.append(a); k = k->next(); kstart = start(k); a.clear(); filename = (EST_String)k->f("file"); a.f.set("name", (filename + ext)); } else { t = a.append(s); t->set("end", (s->F("end") - kstart)); } } slist.append(a); return 0; } int relation_divide2(EST_RelationList &mlf, EST_Relation &lab, EST_Relation &keylab, EST_String ext) { EST_Relation a, newkey; EST_Item *s, *k, *t; float kstart; mlf.clear(); if ((keylab.tail())->F("end") < (lab.tail())->F("end")) { cerr << "Key file must extend beyond end of label file\n"; return -1; } k = keylab.head(); a.f.set("name", (k->name() + ext)); kstart = 0.0; for (s = lab.head(); s; s = s->next()) { t = a.append(); t->set_name(s->name()); t->set("end", (s->F("end") - kstart)); if (s->F("end") > k->F("end")) { cout << "appending " << a; mlf.append(a); kstart = s->F("end"); k->set("end", (s->F("end"))); k = k->next(); a.clear(); a.f.set("name", (k->name() + ext)); } } cout << "appending " << a; mlf.append(a); return 0; } void map_match_times(EST_Relation &target, const EST_String &match_name, const EST_String &time_name, bool do_start) { EST_Item *s, *t, *p; float prev_end, inc, first_end, last_end; int i; // first pass, copy times as appropriate, and find first // and last defined ends // This is hacky and certainly won't work for many cases first_end = -1.0; prev_end = 0.0; last_end = 0.0; // cout << "surface: " << surface << endl; for (s = target.head(); s; s = s->next()) { if ((t = daughter1(s->as_relation(match_name))) != 0) { s->set(time_name + "end", t->F("end")); if (do_start) s->set(time_name + "start", t->F("start")); last_end = t->F("end"); if (first_end < 0.0) first_end = t->F("end"); } } if (!target.head()->f_present(time_name + "end")) { target.head()->set(time_name + "end", first_end / 2.0); if (do_start) target.head()->set(time_name + "start", 0.0); } if (!target.tail()->f_present(time_name + "end")) { target.tail()->set(time_name + "end", last_end + 0.01); if (do_start) target.tail()->set(time_name + "start", last_end); } for (s = target.head(); s; s = s->next()) { if (!s->f_present(time_name + "end")) { // cout << "missing end feature for " << *s << endl; for (i = 1, p = s; p; p = p->next(), ++i) if (p->f_present(time_name + "end")) break; inc = (p->F(time_name + "end") - prev_end) / ((float) i); // cout << "inc is : " << inc << endl; // cout << "stop phone is " << *p << endl; for (i = 1; s !=p ; s = s->next(), ++i) { s->set(time_name + "end", (prev_end + ((float) i * inc))); if (do_start) s->set(time_name + "start", (prev_end+((float) (i - 1 )* inc))); } } prev_end = s->F("end"); } } void dp_time_align(EST_Utterance &utt, const EST_String &source_name, const EST_String &target_name, const EST_String &time_name, bool do_start) { utt.create_relation("Match"); dp_match(*utt.relation(target_name), *utt.relation(source_name), *utt.relation("Match"), 7.0, 7.0, 7.0); map_match_times(*utt.relation(target_name), "Match", time_name, do_start); } EST_Litem *RelationList_ptr_extract(EST_RelationList &mlf, const EST_String &filename, bool base) { EST_Litem *p; EST_String test, ref; if (base) for (p = mlf.head(); p; p = p->next()) { if (basename(mlf(p).name(), "*")==basename(filename, "*")) return p; } else for (p = mlf.head(); p; p = p->next()) if (mlf(p).name() == filename) return p; cerr << "No match for file " << filename << " found in mlf\n"; return 0; } void relation_convert(EST_Relation &lab, EST_Option &al, EST_Option &op) { if (al.present("-shift")) shift_label(lab, al.fval("-shift")); // fix option later. if (al.present("-extend")) al.override_fval("-length", al.fval("-extend",0) * lab.tail()->F("end")); // quantize (ie round up or down) label times if (al.present("-q")) quantize(lab, al.fval("-q")); if (al.present("-start")) { if (!al.present("-end")) cerr << "-start option must be used with -end option\n"; else extract(lab, al.fval("-start"), al.fval("-end"), lab); } if (al.present("-class")) convert_to_broad_class(lab, al.val("-class"), op); else if (al.present("-pos")) { EST_StrList bclass; StringtoStrList(al.val("-lablist"), bclass); convert_to_broad(lab, bclass); } else if (al.present("-sed")) edit_labels(lab, al.val("-sed")); else if (al.present("-map")) { EST_Option map; if (map.load(al.val("-map")) != format_ok) return; label_map(lab, map); } } void print_relation_features(EST_Relation &stream) { EST_Item *s; EST_Features::Entries p; for (s = stream.head(); s; s = s->next()) { cout << s->name() << "\t:"; for(p.begin(s->features()); p; ++p) cout << p->k << " " << p->v << "; "; cout << endl; } } void build_RelationList_hash_table(EST_RelationList &mlf, EST_hashedRelationList &hash_table, const bool base) { EST_Litem *p; if (base) for (p = mlf.head(); p; p = p->next()) hash_table.add_item(basename(mlf(p).name(), "*"), &(mlf(p))); else for (p = mlf.head(); p; p = p->next()) hash_table.add_item(mlf(p).name(), &(mlf(p))); } bool hashed_RelationList_extract(EST_Relation* &rel, const EST_hashedRelationList &hash_table, const EST_String &filename, bool base) { EST_Relation *d; EST_String fname = filename; int found; if (base) fname=basename(filename, "*"); d=hash_table.val(fname,found); if(found) { rel = d; return true; } cerr << "No match for file " << fname << " found in mlf\n"; return false; } speech_tools/ling_class/EST_relation_track.cc0000644000076400007640000001464111465017155020035 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Simon King */ /* Date : June 1995 */ /*-----------------------------------------------------------------------*/ /* Stream class auxiliary routines that refer to tracks */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_types.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_relation_aux.h" #include "EST_track_aux.h" #include "EST_string_aux.h" #include "EST_io_aux.h" #include "EST_Option.h" static int pos_phone(const EST_Relation &seg, float x, float shift); void track_to_label(const EST_Track &tr, EST_Relation &lab, float thresh) { int i; EST_Item *tmp_seg; int p_pos = FALSE; int c_pos = FALSE; for (i = 0; i < tr.num_frames(); ++i) { if (tr.a(i) > thresh) c_pos = TRUE; else c_pos = FALSE; if (c_pos == p_pos) { p_pos = c_pos; continue; } tmp_seg = lab.append(); if (c_pos == TRUE) tmp_seg->set_name("neg"); else tmp_seg->set_name("pos"); tmp_seg->set("end", tr.t(i - 1)); p_pos = c_pos; } tmp_seg = lab.append(); if (c_pos) tmp_seg->set_name("pos"); else tmp_seg->set_name("neg"); tmp_seg->set("end", tr.t(i - 1)); } void track_to_pm(const EST_Track &tr, int sample_rate, EST_Relation &lab) { int i; EST_Item *tmp_seg; bool have_offset = tr.has_channel(channel_offset); bool have_length = tr.has_channel(channel_length); for (i = 0; i < tr.num_frames(); ++i) { float c, b, e=0.0; if (have_length) if (have_offset) get_frame_o(tr, sample_rate, i, b, c, e); else get_frame(tr, sample_rate, i, b, c, e); else c = tr.t(i); if (have_length) { tmp_seg = lab.append(); tmp_seg->set_name("b"); tmp_seg->set("end", b); } tmp_seg = lab.append(); tmp_seg->set_name("pm"); tmp_seg->set("end", c); if (have_length) { tmp_seg = lab.append(); tmp_seg->set_name("e"); tmp_seg->set("end", e); } } } void label_to_track(const EST_Relation &lab, EST_Track &tr, float shift, float offset, float range, float req_l, const EST_String &pad) { EST_Item tmp_seg; int i; int n, endn; n = (int)ceil(lab.tail()->F("end")/shift); endn = (req_l > 0.0) ? (int)(req_l /shift) : n; // cout << req_l << endl; // cout << "shift " << shift << endl; // cout << "endn is " << endn << endl; // cout << lab.tail()->f.F("end") << " " << shift << endl; tr.resize(endn, 1); tr.fill_time(shift); for (i = 0; i < n; ++i) { tr.a(i) = (pos_phone(lab, tr.t(i), shift) * range) + offset; tr.set_value(i); } for (; i < endn; ++i) { tr.a(i) = (pad == "high") ? range + offset : offset; tr.set_value(i); } } void label_to_track(const EST_Relation &lab, const EST_Option &al, const EST_Option &op, EST_Track &tr) { float shift = op.present("frame_shift") ? op.fval("frame_shift"): 0.01; float offset = op.present("label_offset")? op.fval("label_offset"):0.0; float range = op.present("label_range") ? op.fval("label_range"): 1.0; float length = al.present("-length") ? al.fval("-length") : -1.0; label_to_track(lab, tr, shift, offset, range, length, al.val("-pad", 0)); // tr.amin = 0.0; // tr.amax = 3.0; } static int pos_phone(const EST_Relation &seg, float x, float shift) { // returns true if x is in a positive segment. The decision is // slightly biased towards positive inclusion when x is near // a boundary. EST_Item *p; for (p = seg.head(); p != 0; p = p->next()) if (p->f("pos") == 1) if ((x < (p->F("end") + (shift / 2.0))) && (x > (start(p) - (shift / 2.0)))) return 1; return 0; } speech_tools/ling_class/relation_io.cc0000644000076400007640000004021711465017155016623 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor updated by awb */ /* Date : Feb 1999 */ /*-----------------------------------------------------------------------*/ /* Relation class file i/o, label files */ /* */ /*=======================================================================*/ #include #include #include #include "EST_unix.h" #include "EST_types.h" #include "ling_class/EST_Relation.h" #include "EST_string_aux.h" #include "EST_cutils.h" #include "EST_TList.h" #include "EST_Option.h" #include "relation_io.h" #define DEF_SAMPLE_RATE 16000 #define HTK_UNITS_PER_SECOND 10000000 static EST_Regex RXleadingwhitespace("^[ \t\n\r][ \t\n\r]*.*$"); EST_read_status read_label_portion(EST_TokenStream &ts, EST_Relation &s, int sample); EST_read_status load_esps_label(EST_TokenStream &ts,EST_Relation &rel) { ts.set_SingleCharSymbols(";"); ts.set_quotes('"','\\'); EST_String key, val; // Skip the header while (!ts.eof()) { key = ts.get().string(); if (key == "#") break; val = ts.get_upto_eoln().string(); // delete leading whitespace if (val.matches(RXleadingwhitespace)) val = val.after(RXwhite); rel.f.set(key, val); } if (ts.peek() == "") return format_ok; while (!ts.eof()) { EST_Item *si = rel.append(); EST_String name; si->set("end",(float)atof(ts.get().string())); ts.get(); // skip the color; for (name = ""; (!ts.eoln()) && (ts.peek() != ";"); ) { EST_Token &t = ts.get(); if (name.length() > 0) // preserve internal whitespace name += t.whitespace(); name += t.string(); } si->set_name(name); if (ts.peek().string() == ";") // absorb separator { ts.get(); si->features().load(ts); } } return format_ok; } EST_write_status save_esps_label(const EST_String &filename, const EST_Relation &s, bool evaluate_ff) { ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_esps_label: can't open label output file \"" << filename << "\"" << endl; return write_fail; } EST_write_status st=save_esps_label(outf, s, evaluate_ff); if (outf != &cout) delete outf; return st; } EST_write_status save_esps_label(ostream *outf, const EST_Relation &s, bool evaluate_ff) { EST_Item *ptr; *outf << "separator ;\n"; if (!s.f.present("nfields")) *outf << "nfields 1\n"; EST_Features::Entries p; for (p.begin(s.f); p; ++p) *outf << p->k << " " << p->v << endl; *outf << "#\n"; /* if (f("timing_style") == "event") *outf << "timing_style event\n"; else if (f("timing_style") == "unit") *outf << "timing_style unit\n"; */ for (ptr = s.head(); ptr != 0; ptr = ptr->next()) { *outf << "\t"; outf->precision(5); outf->setf(ios::fixed, ios::floatfield); outf->width(8); // outf->fill('0'); if (s.f("timing_style","0") == "event") *outf << ptr->F("time",0); else *outf << ptr->F("end",0); *outf << " 26 \t" << ptr->S("name","0"); EST_Features f2; f2 = ptr->features(); f2.remove("name"); f2.remove("end"); if (evaluate_ff) evaluate(ptr,f2); if (f2.length() > 0) { *outf << " ; "; f2.save(*outf); } *outf << endl; } return write_ok; } EST_read_status load_ogi_label(EST_TokenStream &ts, EST_Relation &s) { // This function reads OGI style label files. The start, end // time and names of the labels are mandatory. EST_String key, val; float sr; int isr; // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); // Skip over header while(!ts.eof()) { if ((ts.peek().col() == 0) && (ts.peek() == "END")) { if (ts.peek() == "END") { // read rest of header ts.get(); ts.get(); ts.get(); } break; } key = ts.get().string(); val = ts.get().string(); } sr = 1000.0 / atof(val); isr = (int)sr; if (ts.eof()) { cerr << "Error: couldn't find header in label file " << ts.filename() << endl; return wrong_format; } if (read_label_portion(ts, s, isr) == misc_read_error) { cerr << "error: in label file " << ts.filename() << " at line " << ts.linenum() << endl; return misc_read_error; } return format_ok; } EST_read_status load_words_label(EST_TokenStream &ts, EST_Relation &s) { // This function reads label files in the form of simple word strings // with no timing information. EST_Item *item; while (!ts.eof()) { item = s.append(); item->set("name",(EST_String)ts.get()); item->set("end",0.0); } return format_ok; } static float convert_long_num_string_to_time(const char *s,int sample) { // For those label files that think 100 nanosecond times are cool // we have to provide a special function to convert them as // this quickly gets beyond the capabilities of ints. if (strlen(s) < 15) return atof(s)/sample; else { double a = 0,d; int i=0; for (i=0; (strchr(" \n\r\t",s[i]) != NULL) && (s[i] != '\0'); i++); for ( ; (s[i] != '\0') && (s[i] >= '0') && (s[i] <= '9'); i++) { a = a*10; d = s[i]-'0'; a += (d/(double)sample); } return a; } } EST_read_status read_label_portion(EST_TokenStream &ts, EST_Relation &s, int sample) { EST_Item *item; float hstart, hend; EST_String str; while(!ts.eof()) { str = ts.get().string(); if (str == ".") return format_ok; item = s.append(); hstart = convert_long_num_string_to_time(str,sample); str = ts.get().string(); hend = convert_long_num_string_to_time(str,sample); item->set("end",hend); // time item->set("name",ts.get().string()); // name if (!ts.eoln()) item->set("rest_lab",ts.get_upto_eoln().string()); } return format_ok; } EST_read_status load_sample_label(EST_TokenStream &ts, EST_Relation &s, int sample) { if (sample == 0) // maybe this should be an error sample = DEF_SAMPLE_RATE; // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); s.clear(); if (read_label_portion(ts, s, sample) == misc_read_error) { cerr << "error: in label file " << ts.filename() << " at line " << ts.linenum() << endl; return misc_read_error; } return format_ok; } EST_write_status save_htk_label(const EST_String &filename, const EST_Relation &a) { ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_htk_label: can't open label output file \"" << filename << "\"" << endl; return write_fail; } EST_write_status s = save_htk_label(outf, a); if (outf != &cout) delete outf; return s; } EST_write_status save_htk_label(ostream *outf, const EST_Relation &a) { EST_Item *ptr; float end,start; outf->precision(6); start = end = 0; for (ptr = a.head(); ptr != 0; ptr = ptr->next()) { outf->width(15); cout.setf(ios::left,ios::adjustfield); *outf << (int)(start * HTK_UNITS_PER_SECOND); outf->width(15); end = ptr->F("end",0.0); *outf << (int)(end * HTK_UNITS_PER_SECOND); *outf << " " << ptr->name() << endl; start = end; } return write_ok; } #if 0 EST_write_status save_label_spn(const EST_String &filename, const EST_Relation &a) { EST_Stream_Item *ptr; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_label_spn: can't open label output file \"" << filename << "\"" << endl; return write_fail; } ptr = a.head(); outf->precision(3); outf->setf(ios::left, ios::adjustfield); outf->width(8); *outf << ptr->name(); outf->setf(ios::fixed, ios::floatfield); outf->width(8); *outf << (ptr->dur() * 1000.0) << "\t (0,140)" << endl; for (; next(ptr) != 0; ptr = ptr->next()) { outf->precision(3); outf->setf(ios::left, ios::adjustfield); outf->width(8); *outf << ptr->name(); outf->setf(ios::fixed, ios::floatfield); outf->width(8); *outf << (ptr->dur() * 1000.0) << endl; } // outf->precision(3); // outf->setf(ios::left, ios::adjustfield); outf->width(8); *outf << ptr->name(); outf->setf(ios::fixed, ios::floatfield); outf->width(8); *outf << (ptr->dur() * 1000.0) << "\t (99,80)" << endl; if (outf != &cout) delete outf; return write_ok; } EST_write_status save_label_names(const EST_String &filename, const EST_Relation &a, const EST_String &features) { EST_Stream_Item *ptr; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_label_name: can't open label output file \"" << filename << "\"" << endl; return misc_write_error; } for (ptr = a.head(); next(ptr) != 0; ptr = ptr->next()) { *outf << ptr->name(); if ((features != "") && (features != "OneLine")) *outf << endl; else *outf << " "; } *outf << ptr->name() << endl; if (outf != &cout) delete outf; return write_ok; } #endif EST_write_status save_RelationList(const EST_String &filename, const EST_RelationList &plist, int time, int path) { EST_Litem *p; EST_Item *ptr; EST_String outname; float start,end; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_StreamList: can't open MLF output file \"" << filename << "\"\n"; return write_fail; } *outf << "#!MLF!#\n"; // MLF header/identifier outf->precision(6); start = end = 0; for (p = plist.head(); p != 0; p = p->next()) { outname = path ? plist(p).name() : basename(plist(p).name()); *outf << "\"*/" << outname<<"\"\n"; for (ptr = plist(p).head(); ptr != 0; ptr = ptr->next()) { if (time) { outf->width(15); cout.setf(ios::left,ios::adjustfield); *outf << (int)(start * HTK_UNITS_PER_SECOND); outf->width(15); end = ptr->F("end",0.0); *outf << (int)(end * HTK_UNITS_PER_SECOND) << " "; start = end; } *outf << ptr->S("name","0") << endl; } *outf << ".\n"; } if (outf != &cout) delete outf; return write_ok; } EST_write_status save_WordList(const EST_String &filename, const EST_RelationList &plist, int style) { EST_Litem *p; EST_Item *ptr; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save:WordList: can't open WordList output file \"" << filename << "\"\n"; return write_fail; } for (p = plist.head(); p != 0; p = p->next()) { for (ptr = plist(p).head(); ptr->next() != 0; ptr = ptr->next()) { *outf << ptr->name(); if (style == 0) *outf << endl; else *outf << " "; } if (ptr != 0) *outf << ptr->name() << endl; } if (outf != &cout) delete outf; return write_ok; } EST_write_status save_ind_RelationList(const EST_String &filename, const EST_RelationList &plist, const EST_String &features, int path) { EST_Litem *p; EST_String outname; (void) filename; (void) features; for (p = plist.head(); p != 0; p = p->next()) { outname = path ? plist(p).name() : basename(plist(p).name()); if (plist(p).save(outname,false) != write_ok) return misc_write_error; } return write_ok; } EST_read_status load_RelationList(const EST_String &filename, EST_RelationList &plist) { EST_TokenStream ts; EST_String fns, name; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open label input file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); // Skip over header if (ts.get().string() != "#!MLF!#") { cerr << "Not MLF file\n"; return wrong_format; } while(!ts.eof()) { // put filename in as stream name. The filename is usually surrounded // by quotes, so remove these. fns = ts.get().string(); strip_quotes(fns); EST_Relation s(fns); s.f.set("name", fns); // simonk plist.append(s); if (read_label_portion(ts, plist.last(), 10000000) == misc_read_error) { cerr << "error: in reading MLF file\n"; cerr << "section for file " << fns << " at line " << ts.linenum() << " is badly formatted\n"; return misc_read_error; } } return format_ok; } static void pad_ends(EST_Relation &s, float length) { // add evenly spaced dummy end values to Relation EST_Item *p; int i; for (i = 0, p = s.head(); p; p = p->next(), ++i) p->set("end",(length * float(i)/float(s.length()))); } EST_read_status read_RelationList(EST_RelationList &plist, EST_StrList &files, EST_Option &al) { EST_Litem *p, *plp; if (al.val("-itype", 0) == "mlf") { if (load_RelationList(files.first(), plist) != format_ok) exit (-1); } else for (p = files.head(); p; p = p->next()) { EST_Relation s(files(p)); plist.append(s); plp = plist.tail(); if (al.present("-itype")) { if (plist(plp).load(files(p), al.val("-itype")) != format_ok) exit (-1); } else if (plist(plp).load(files(p)) != format_ok) exit (-1); if ((al.val("-itype", 0) == "words") && (al.present("-length"))) pad_ends(s, al.fval("-length")); } return format_ok; } speech_tools/ling_class/EST_relation_compare.cc0000644000076400007640000006656311465017155020371 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Simon King */ /* Date : June 1995 */ /*-----------------------------------------------------------------------*/ /* Stream class auxiliary routines */ /* */ /*=======================================================================*/ #include #include #include #include "EST_types.h" #include "EST_FMatrix.h" #include "ling_class/EST_Relation.h" #include "EST_Token.h" #include "EST_string_aux.h" #include "ling_class/EST_relation_aux.h" #include "ling_class/EST_relation_compare.h" #include "EST_io_aux.h" int close_enough(EST_Item &a, EST_Item &b) { return ((start(&b) < a.F("end")) && (start(&a) < b.F("end"))); } // WATCH - this uses what should be private access to Keyval class. void monotonic_match(EST_II_KVL &a, EST_II_KVL &b) { EST_Litem *ptr; for (ptr = a.list.head(); ptr != 0; ptr= ptr->next()) { if (a.val(ptr) == -1) continue; if (b.val(a.val(ptr)) == a.key(ptr)) // cout << "ok\n"; continue; else a.change_key(ptr, -1); } for (ptr = b.list.head(); ptr != 0; ptr= ptr->next()) { if (b.val(ptr) == -1) continue; if (a.val(b.val(ptr)) == b.key(ptr)) // cout << "ok\n"; continue; else a.change_key(ptr, -1); } } void function_match(EST_II_KVL &u, EST_Relation &a, EST_Relation &b) { (void)u; (void)a; (void)b; #if 0 EST_Item *a_ptr; EST_Litem *i_ptr; int i; for (i = 0, a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next(), ++i) { if (a_ptr->f("pos")==1) { u.add_item(a_ptr->addr(), -1); for (i_ptr = a_ptr->link(b.stream_name())->head(); i_ptr != 0; i_ptr = i_ptr->next()) u.change_val(a_ptr->addr(), a_ptr->link(b.stream_name())->item(i_ptr)); } } #endif } void relation_match(EST_Relation &a, EST_Relation &b) { EST_Item *a_ptr, *b_ptr; for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) if (a_ptr->f("pos")==1) for (b_ptr = b.head(); b_ptr != 0; b_ptr = b_ptr->next()) { if ((b_ptr->f("pos")==1) &&(close_enough(*a_ptr, *b_ptr))) { // cout << "linked\n"; #if 0 link(*a_ptr, *b_ptr); #endif } } // if ((b.pos(b_ptr->name())) // &&(close_enough(*a_ptr, *b_ptr))) // link(*a_ptr, *b_ptr); } void compare_labels(EST_Relation &reflab, EST_Relation &testlab) { EST_II_KVL uref, utest; relation_match(reflab, testlab); // many-to-many mapping cout << "Ref\n" << reflab; cout << "Test\n" << testlab; function_match(uref, reflab, testlab); // one-to-many mapping function_match(utest, testlab, reflab); // one-to-many mapping cout << "Ref\n" << reflab; cout << "Test\n" << testlab; cout << "Keyval REF\n" << uref; cout << "Keyval TEST\n" << utest; // cout << "Keyval REF\n" << uref; // cout << "Keyval TEST\n" << utest; monotonic_match(uref, utest); // one-to-one mapping reassign_links(reflab, uref, testlab.name()); reassign_links(testlab, utest, reflab.name()); cout << "Keyval REF\n" << uref; cout << "Keyval TEST\n" << utest; // temporary !!! cout.setf(ios::left,ios::adjustfield); cout << "Total: "; cout.width(10); cout << uref.length(); cout << "Deletions: "; cout.width(10); cout << insdel(uref); cout << "Insertions: "; cout.width(10); cout<< insdel(utest) << endl; } EST_Item *nthpos(EST_Relation &a, int n) { EST_Item *a_ptr; int i = 0; for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) if (a_ptr->f("pos") == 1) { if (n == i) return a_ptr; ++i; } return 0; } // measures amount of total overlap between segments float label_distance1(EST_Item &ref, EST_Item &test) { float s, e; s = fabs(start(&ref) - start(&test)); e = fabs(ref.F("end") - test.F("end")); return (s + e) / duration(&ref); } // Only penalises a test segment that extends beyond the boundaries of // a ref segment float label_distance2(EST_Item &ref, EST_Item &test) { float s, e; s = (start(&test) < start(&ref)) ? start(&ref) - start(&test) : 0; e = (ref.F("end") < test.F("end")) ? test.F("end") - ref.F("end") : 0; return (s + e) / duration(&ref); } int lowest_pos(EST_FMatrix &m, int j) { float val = 1000.0; int i, pos=0; for (i = 0; i < m.num_rows(); ++i) if ((m(i, j) > -0.01) && (m(i, j) < val)) { val = m(i, j); pos = i; } return pos; } void minimise_matrix_by_column(EST_FMatrix &m) { float val = 1000.0; int i; for (int j = 0; j < m.num_columns(); ++j) { val = 1000.0; for (i = 0; i < m.num_rows(); ++i) if (m(i, j) < val) val = m(i, j); for (i = 0; i < m.num_rows(); ++i) if (m(i, j) > val) m(i, j) = -1.0; } } void minimise_matrix_by_row(EST_FMatrix &m) { float val; int i, j; for (i = 0; i < m.num_rows(); ++i) { val = 1000.0; for (j = 0; j < m.num_columns(); ++j) if ((m(i, j) < val) && (m(i, j) > -0.01)) val = m(i, j); for (j = 0; j < m.num_columns(); ++j) if (m(i, j) > val) m(i, j) = -1.0; } } void matrix_ceiling(EST_FMatrix &m, float max) { int i, j; for (i = 0; i < m.num_rows(); ++i) for (j = 0; j < m.num_columns(); ++j) if (m(i, j) > max) m(i, j) = -1.0; } int matrix_insertions(EST_FMatrix &m) { int i, j; int n = 0; for (i = 0; i < m.num_rows(); ++i) for (j = 0; j < m.num_columns(); ++j) if (m(i, j) > -1.0) ++n; return (m.num_rows() - n); } int major_matrix_insertions(EST_FMatrix &m, EST_Relation &ref_lab) { int i, j; int n = 0; EST_Item *s; for (i = 0; i < m.num_rows(); ++i) { s = nthpos(ref_lab, i); // cout << s->name() << ": f:" << s->f("minor")<< endl; if (s->f("minor") == 1) ++n; else for (j = 0; j < m.num_columns(); ++j) if (m(i, j) > -1.0) ++n; } return (m.num_rows() - n); } int matrix_deletions(EST_FMatrix &m) { int i, j; int n = 0; for (j = 0; j < m.num_columns(); ++j) for (i = 0; i < m.num_rows(); ++i) if (m(i, j) > -1.0) ++n; return (m.num_columns() - n); } int major_matrix_deletions(EST_FMatrix &m, EST_Relation &ref_lab) { int i, j; int n = 0; EST_Item *s; for (j = 0; j < m.num_columns(); ++j) { s = nthpos(ref_lab, j); // cout << s->name() << ": f:" << s->f("minor")<< endl; if (s->f("minor") == 1) ++n; else for (i = 0; i < m.num_rows(); ++i) if (m(i, j) > -1.0) ++n; } return (m.num_columns() - n); } int lowest_pos(float *m, int n) { float val = 1000.0; int i, pos=0; for (i = 0; i < n; ++i) if (m[i] < val) { val = m[i]; pos = i; } return pos; } void threshold_labels(EST_Relation &reflab, float t) { (void)reflab; (void)t; #if 0 EST_Item *r_ptr; float score=0.0; int a; for (r_ptr = reflab.head(); r_ptr != 0; r_ptr = r_ptr->next()) if (r_ptr->f("pos")==1) { // REORG - temp comment // score = atof(r_ptr->fields()); cout << "score is" << score << endl; a = r_ptr->rlink("blank").first(); cout << "score is" << score << " address: " << a << endl; if (score > t) cout << "delete\n"; } #endif } /* Check through relations of each ref label, and make there aren't multiple ref labels related to the same test label. If this is discovered, compare scores of all the relevant labels and delete the relations of all but the lowest. At this stage, each ref label should have one and only one relation to the test labels. */ void multiple_labels(EST_Relation &reflab) { (void)reflab; #if 0 EST_Item *r_ptr, *s_ptr, *t_ptr;; EST_Litem *p; int a, pos, i; EST_TList la; float *score; score = new float[reflab.length()]; for (r_ptr = reflab.head(); r_ptr != 0; r_ptr = r_ptr->next()) if (r_ptr->f("pos")==1) { la.clear(); // clear list and add address of current ref label la.append(r_ptr->addr()); a = r_ptr->rlink("test").first(); cout << a << endl; // check remainer of ref labels and add any that have same // relations address as r_ptr. for (s_ptr = r_ptr->next(); s_ptr != 0; s_ptr = s_ptr->next()) if (s_ptr->f("pos")==1) if (s_ptr->rlink("test").first() == a) la.append(s_ptr->addr()); cout << "la: " << la; if (la.length() > 1) // true if the are multiple relations { // find scores of all relevant labels for (i = 0, p = la.head(); p!= 0; p = p->next(), ++i) { t_ptr = reflab.item(la.item(p)); // REORG - temp comment // score[i] = atof(reflab.item(la.item(p))->fields()); } pos = lowest_pos(score, i); // find position of lowest score cout << "best is " << pos << endl; // delete relations of all but lowest score for (i = 0, p = la.head(); p!= 0; p = p->next(), ++i) if (i != pos) { t_ptr = reflab.item(la.item(p)); t_ptr->rlink("test").clear(); } } } #endif } /* Compare 2 sets of labels by matrix method. This involves making a M (number of test labels) x N (number of ref labels) matrix, and calculating the distance from each label in the test set to each label in the reference set. The lowest score for each reference is then recorded. A test is carried out to make sure that no two reference labels point to the same test label. Then any ref label above a certain distance is classified as incorrect. The numbers of insertions and deletions are then calculated. */ EST_FMatrix matrix_compare(EST_Relation &reflab, EST_Relation &testlab, int method, float t, int v) { int i, j, pos; int num_ref, num_test; EST_Item *r_ptr, *t_ptr; EST_String fns; (void)v; num_ref = num_test = 0; // calculate size of matrix, based on *significant* labels for (r_ptr = testlab.head(); r_ptr != 0; r_ptr = r_ptr->next()) if (r_ptr->f("pos")==1) ++num_test; for (r_ptr = reflab.head(); r_ptr != 0; r_ptr = r_ptr->next()) if (r_ptr->f("pos")==1) ++num_ref; EST_FMatrix m(num_test, num_ref); if ((m.num_rows() == 0) || (m.num_columns() == 0)) return m; // nothing to analyse, hence empty matrix // fill matrix values by comparing each test with each reference // reference is columns, test is rows for (i = 0, t_ptr = testlab.head(); t_ptr != 0; t_ptr = t_ptr->next()) if (t_ptr->f("pos")==1) { for (j = 0, r_ptr = reflab.head(); r_ptr != 0; r_ptr = r_ptr->next()) if (r_ptr->f("pos")==1) { if (method == 1) m(i, j) = label_distance1(*r_ptr, *t_ptr); else if (method == 2) m(i, j) = label_distance2(*r_ptr, *t_ptr); else cerr << "Unknown comparision method" << method << endl; ++j; } ++i; } // cout << "orig M\n"; // print_matrix_scores(reflab, testlab, m); minimise_matrix_by_column(m); minimise_matrix_by_row(m); matrix_ceiling(m, t); // for each ref label, find closest matching test label. for (j = 0, r_ptr = reflab.head(); r_ptr != 0; r_ptr = r_ptr->next()) { if (r_ptr->f("pos")==1) { pos = lowest_pos(m, j); // REORG - temp comment // r_ptr->set_field_names(r_ptr->fields() +ftoString(m(pos, j))); ++j; } } return m; } void multiple_matrix_compare(EST_RelationList &rlist, EST_RelationList &tlist, EST_FMatrix &m, EST_String rpos, EST_String tpos, int method, float t, int v) { EST_Litem *pr, *pt; EST_String filename; EST_Relation reflab, testlab; EST_StrList rposlist, tposlist, rminorlist, tminorlist; float ra, rc, mra, mrc; StringtoStrList(rpos, rposlist); StringtoStrList(tpos, tposlist); StringtoStrList("m l mrb mfb lrb lfb", rminorlist); StringtoStrList("m l mrb mfb lrb lfb", tminorlist); int tot, del, ins, ltot, ldel, lins, lmdel, mdel, lmins, mins; tot = del = ins = mdel = mins = 0; for (pt = tlist.head(); pt; pt = pt->next()) { pr = RelationList_ptr_extract(rlist, tlist(pt).name(), TRUE); if (pr != 0) { reflab = rlist(pr); testlab = tlist(pt); /* convert_to_broad(reflab, rposlist); convert_to_broad(testlab, tposlist); convert_to_broad(reflab, rminorlist, "minor"); convert_to_broad(testlab, tminorlist, "minor"); */ // cout << "ref\n" << reflab; // cout << "test\n" << testlab; // cout << "features\n"; // print_stream_features(reflab); m = matrix_compare(reflab, testlab, method, t, v); ltot = m.num_columns(); ldel = matrix_deletions(m); lmdel = major_matrix_deletions(m, reflab); lins = matrix_insertions(m); lmins = major_matrix_insertions(m, testlab); print_results(reflab, testlab, m, ltot, ldel, lins, v); // cout << "Major Deletions: " << lmdel << endl << endl;; tot += ltot; del += ldel; mdel += lmdel; ins += lins; mins += lmins; } } rc = float(tot - del)/(float)tot * 100.0; ra = float(tot - del -ins)/(float)tot *100.0; mrc = float(tot - mdel)/(float)tot * 100.0; mra = float(tot - mdel - mins)/(float)tot *100.0; if (v) { cout << "Total " << tot << " del: " << del << " ins: " << ins << endl; cout << "Total " << tot << " major del " << mdel << " major ins" << mins << endl; } cout << "Correct " << rc << "% Accuracy " << ra << "%" << endl; cout << "Major Correct " << mrc << "% Accuracy " << mra << "%" << endl; } void error_location(EST_Relation &e, EST_FMatrix &m, int ref) { int i; EST_Item *s; // reference if (ref) { for (i = 0, s = e.head(); s; s = s->next()) if ((int)s->f("pos")) { if (column_hit(m, i) >= 0) s->set("hit", 1); else s->set("hit", 0); ++i; } } else for (i = 0, s = e.head(); s; s = s->next()) if ((int)s->f("pos")) { if (row_hit(m, i) >= 0) s->set("hit", 1); else s->set("hit", 0); ++i; } } int insdel(EST_II_KVL &a) { int n = 0; EST_Litem *ptr; for (ptr = a.list.head(); ptr != 0; ptr= ptr->next()) if (a.val(ptr) == -1) ++n; return n; } int compare_labels(EST_Utterance &ref, EST_Utterance &test, EST_String name, EST_II_KVL &uref, EST_II_KVL &utest) { // many-to-many mapping (void)ref; (void)test; (void)name; (void)uref; (void)utest; #if 0 relation_match(ref.stream(name), test.stream(name)); // one-to-many mapping function_match(uref, ref.stream(name), test.stream(name)); function_match(utest, test.stream(name), ref.stream(name)); monotonic_match(uref, utest); // one-to-one mapping // temporary !!! // reassign_links(ref.stream(name), uref, name); // reassign_links(test.stream(name), utest, name); // cout << "Keyval REF\n" << uref; // cout << "Keyval TEST\n" << utest; #endif return 0; } void reassign_links(EST_Relation &a, EST_Relation &b, EST_II_KVL &ua, EST_II_KVL &ub) { (void)a; (void)b; (void)ua; (void)ub; #if 0 EST_Item *a_ptr, *b_ptr; for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) { a_ptr->link(b.stream_name())->clear(); if ((a_ptr->f("pos")==1) && (ua.val(a_ptr->addr()) != -1)) a_ptr->make_link(b.stream_name(), ua.val(a_ptr->addr())); } for (b_ptr = b.head(); b_ptr != 0; b_ptr = b_ptr->next()) { b_ptr->link(a.stream_name())->clear(); if ((b_ptr->f("pos")==1) && (ub.val(b_ptr->addr()) != -1)) b_ptr->make_link(a.stream_name(), ub.val(b_ptr->addr())); } #endif } void reassign_links(EST_Relation &a, EST_II_KVL &u, EST_String stream_type) { (void)a; (void)u; (void)stream_type; #if 0 EST_Item *a_ptr; for (a_ptr = a.head(); a_ptr != 0; a_ptr = a_ptr->next()) { a_ptr->link(stream_type)->clear(); if ((a_ptr->f("pos")==1) && (u.val(a_ptr->addr()) != -1)) a_ptr->make_link(stream_type, u.val(a_ptr->addr())); } #endif } int commutate(EST_Item *a_ptr, EST_II_KVL &f1, EST_II_KVL &f2, EST_II_KVL &lref, EST_II_KVL <est) { int b, c, d, v; (void)lref; // unused parameter (void)a_ptr; // v = a_ptr->addr(); v = 0; b = f2.val(v); c = (b == -1) ? -1: ltest.val(b); d = (c == -1) ? -1: f1.val(c); return d; // c = ltest.val(f2.val(v)); // d = f1.val(ltest.val(f2.val(v))); } // REF TEST // f1 // S -----------> S // ^ ^ // lr | | lt // | f2 | // E -----------> E // // For a given element in E(ref), "e", if // lr(e) == f1(lt(f2(e))) // Then ei has been recognised fully. void test_labels(EST_Utterance &ref, EST_Utterance &test, EST_Option &op) { (void)ref; (void)test; (void)op; #if 0 EST_II_KVL f2, inv_f2, inv_f1, f1, lref, ltest; compare_labels(ref, test, "Event", f2, inv_f2); compare_labels(ref, test, "Syllable", f1, inv_f1); if (op.present("print_syllable") && op.present("print_map")) { cout << "Syllable mapping from ref to test\n" << f1; cout << "Syllable mapping from test to ref\n" << inv_f1; } if (op.present("print_event") && op.present("print_map")) { cout << "Event mapping from ref to test\n" << f2; cout << "Event mapping from test to ref\n" << inv_f2; } if (op.present("print_syllable") && op.present("print_ins")) cout << "Syllable_insertions: " << insdel(inv_f1) << endl; if (op.present("print_syllable") && op.present("print_del")) cout << "Syllable_deletions: " << insdel(f1) << endl; if (op.present("print_event") && op.present("print_ins")) cout << "Event_insertions: " << insdel(inv_f2) << endl; if (op.present("print_event") && op.present("print_del")) cout << "Event_deletions: " << insdel(f2) << endl; // cout << "Ref\n" << ref.stream("Event") << ref.stream("Syllable"); // cout << "Test\n" << test.stream("Event") << test.stream("Syllable"); function_match(lref, ref.stream("Event"), ref.stream("Syllable")); function_match(ltest, test.stream("Event"), test.stream("Syllable")); if (op.present("print_functions")) { cout << "Lref\n" << lref; cout << "Ltest\n" << ltest; cout << "f1\n" << f1; cout << "f2\n" << f2; } EST_Item *a_ptr; int correct, n_ev, n_syl; correct = n_ev = n_syl = 0; for (a_ptr = ref.stream("Event").head(); a_ptr != 0; a_ptr = a_ptr->next()) if (a_ptr->f("pos")==1) { ++n_ev; if (lref.val(a_ptr->addr()) == commutate(a_ptr, f1, f2, lref, ltest)) ++correct; } for (a_ptr = ref.stream("Syllable").head();a_ptr != 0; a_ptr = a_ptr->next()) if (a_ptr->f("pos")==1) ++n_syl; if (op.present("print_syllable") && op.present("print_total")) cout << "Number_of_Syllables: " << n_syl << endl; if (op.present("print_event") && op.present("print_total")) cout << "Number_of_Events: " << n_ev << endl; if (op.present("print_link")) cout << "Correct_links: " << correct <next()) { if (a_ptr->f("pos")==1) { cout << "Lr(ei): " << lref.val(a_ptr->addr()) << endl; cout << "f2(ei): " << f2.val(a_ptr->addr()) << endl; cout << "Lt(f2(ei)): " << ltest.val(f2.val(a_ptr->addr())) << endl; cout << "f1(Lt(f2(ei))): " << f1.val(ltest.val(f2.val(a_ptr->addr()))) << endl; } cout << "Event " << *a_ptr; if ( lref.val(a_ptr->addr()) == f1.val(ltest.val(f2.val(a_ptr->addr())))) cout << " is correct\n"; else cout << " is incorrect\n"; } } #endif } void print_i_d_scores(EST_FMatrix &m) { cout.setf(ios::left,ios::adjustfield); cout << "Total: "; cout.width(10); cout << m.num_columns(); cout << "Deletions: "; cout.width(10); cout << matrix_deletions(m); cout << "Insertions: "; cout.width(10); cout<< matrix_insertions(m) << endl; } void print_matrix_scores(EST_Relation &ref, EST_Relation &test, EST_FMatrix &a) { int i, j; EST_Item *r_ptr, *t_ptr; cout << " "; for (r_ptr = ref.head(); r_ptr != 0; r_ptr = r_ptr->next()) { if (r_ptr->f("pos")==1) { // cout.width(5); // cout.setf(ios::right); cout << r_ptr->name() << " "; cout.width(6); cout.setf(ios::right); cout<< r_ptr->F("end") << " "; } } cout << endl; for (t_ptr = test.head(), i = 0; i < a.num_rows(); t_ptr = t_ptr->next()) { if (t_ptr->f("pos")==1) { cout << t_ptr->name() << " "; for (j = 0; j < a.num_columns(); ++j) { cout.width(10); cout.precision(3); cout.setf(ios::right); cout.setf(ios::fixed, ios::floatfield); cout << a(i, j) << " "; } cout << endl; ++i; } } } int row_hit(EST_FMatrix &m, int r) { int i; for (i = 0; i < m.num_columns(); ++i) if (m(r, i) > 0.0) return i; return -1; } // return the row index of the first positive entry in column c int column_hit(EST_FMatrix &m, int c) { int i; for (i = 0; i < m.num_rows(); ++i) if (m(i, c) > 0.0) return i; return -1; } int num_b_insertions(EST_FMatrix &m, int last, int current) { int c1, c2; c1 = column_hit(m, last); c2 = column_hit(m, current); return c2 - c1 -1; } int num_b_deletions(EST_FMatrix &m, int last, int current) { int c1, c2; c1 = row_hit(m, last); c2 = row_hit(m, current); return c2 - c1 -1; } void print_s_trans(EST_Relation &a, int width) { (void)a; (void)width; // for (int i = 0; i < a.length(); ++i) // { // cout << (int)a.nth(i)->f("pos") << " XX " << a.nth(i)->name() << endl; /* if ((a.nth(i)->f("pos")==1) || (a.nth(i)->name() == " ")) { // cout.setf(ios::fixed, ios::floatfield); cout.width(width); cout << a.nth(i)->name() << " "; } } */ cout << endl; } void make_hit_and_miss(EST_Relation &a) { EST_Item *s; for (s = a.head(); s; s = s->next()) { if (s->f("pos") == 0) s->set_name("."); else if (s->f("hit") == 1) s->set_name("HIT"); else s->set_name("MISS"); s->features().clear(); } } void pos_only(EST_Relation &lab) { EST_Item *a, *n; for (a = lab.head(); a; a = n) { n = a->next(); if (!a->f_present("pos")) lab.remove_item(a); } } // Warning this is bugged - slight misalignments occur. void print_aligned_trans(EST_Relation &ref, EST_Relation &test, EST_FMatrix &m) { (void)ref; (void)test; (void)m; /* int i, j, n; EST_Relation al, refal, testal; EST_Item *p; EST_Item pos, blank; blank.set_name(" "); pos.f.set("pos", 1); blank.f.set("pos", 0); pos_only(test); pos_only(ref); // first check for empty matrices - indicates all insertions or deletions if ((m.num_columns() == 0) && (m.num_rows() != 0)) { cout << "REC: "; print_s_trans(test); return; } else if ((m.num_columns() != 0) && (m.num_rows() == 0)) { cout << "LAB: "; print_s_trans(ref); return; } else if ((m.num_columns() == 0) && (m.num_rows() == 0)) { cout << "LAB: "; print_s_trans(ref); return; } int l; l = 0; // cout << "ref: " << ref.name() << endl << ref; // cout << "test: " << test.name() << endl << test; if (m(0, 0) < 0) refal.append(blank); pos.set_name(ref.head()->name()); refal.append(pos); for (i = 1, p = ref.head()->next(); p; p = p->next(), ++i) { n = num_b_insertions(m, l, i); for (j = 0; j < n; ++j) refal.append(blank); if (n > -0.5) l = i; pos.set_name(p->name()); refal.append(pos); } l = 0; pos.set_name(test.head()->name()); testal.append(pos); for (i = 1, p = test.head()->next(); p; p = p->next(), ++i) { n = num_b_deletions(m, l, i); // cout << *p << "last " << l << " current " << i << // " insertions " << n << endl; for (j = 0; j < n; ++j) testal.append(blank); if (n > -0.5) l = i; pos.set_name(p->name()); testal.append(pos); } cout << "LAB: "; print_s_trans(refal, 3); cout << "REC: "; print_s_trans(testal, 3); */ } void print_results(EST_Relation &ref, EST_Relation &test, EST_FMatrix &m, int tot, int del, int ins, int v) { (void) tot; (void) del; (void) ins; if (v == 0) return; // v == 1 prints out total insertions etc if (v == 2) { cout << basename(ref.name(), "") << endl; print_i_d_scores(m); cout << endl; } else if (v == 3) { cout << basename(ref.name(), "") << endl; print_aligned_trans(ref, test, m); print_i_d_scores(m); cout << endl; } else if (v == 4) { cout << basename(ref.name(), "") << endl; print_matrix_scores(ref, test, m); print_i_d_scores(m); cout << endl; } else if (v == 5) { cout << basename(ref.name(), "") << endl; print_matrix_scores(ref, test, m); print_aligned_trans(ref, test, m); print_i_d_scores(m); cout << endl; } else if (v == 6) { print_matrix_scores(ref, test, m); error_location(ref, m, 1); make_hit_and_miss(ref); error_location(test, m, 0); make_hit_and_miss(test); ref.save("ref.error"); test.save("test.errors"); } else if (v == 7) { error_location(ref, m, 1); make_hit_and_miss(ref); error_location(test, m, 0); make_hit_and_miss(test); ref.save("ref.error"); test.save("test.error"); } } speech_tools/ling_class/standard_feature_functions.cc0000644000076400007640000001736211465017155021727 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Originally: Paul Taylor (pault@cstr,ed,ac,uk) */ /* -------------------------------------------------------------------- */ /* Some generally useful feature functions. */ /* */ /* Mostly not very general and way too specific, these shouldn't be here */ /* */ /*************************************************************************/ #include "ling_class/EST_Item.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item_Content.h" #include "ling_class/EST_item_aux.h" EST_Val ff_duration(EST_Item *s) { if (s->prev()) return s->F("end")-s->prev()->F("end"); else return s->F("end"); } EST_Val ff_start(EST_Item *s) { /* Changed by awb 12/07/05, to make this actually a generic function */ /* no longer changes relation view to Segment -- may affect tilt and */ /* other pault things */ return (s->prev() == 0) ? 0.0 : s->prev()->F("end"); } EST_Val ff_tilt_phrase_position(EST_Item *s) { EST_String rel_name = s->S("time_path"); EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) { cerr << "item: " << *s << endl; EST_error("No relation %s for item\n", (const char *) rel_name); } a = parent(t); cout << "us features phrase pos\n"; //cout << "dereferencing syllable: " << *a << endl; cout << "start: " << a->F("start") << endl; cout << "end: " << a->F("end") << endl; if (s->S("name","0") == "phrase_start") return a->F("start"); else return a->F("end"); } EST_Val ff_tilt_event_position(EST_Item *s) { EST_String rel_name = s->S("time_path"); EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) EST_error("No relation %s for item\n", (const char *) rel_name); a = parent(t); cout << "us features tilt pos\n"; cout << "dereferencing syllable: " << *a << endl; cout << "vowel_start: " << a->F("vowel_start") << endl; cout << "start: " << a->F("start") << endl; cout << "end: " << a->F("end") << endl; return a->F("vowel_start") + s->F("rel_pos",0.0); } EST_Val ff_leaf_end(EST_Item *s) { if (!s->f_present("time_path")) EST_error("Attempted to use leaf end() feature function on " "item with no time_path feature set: %s\n", (const char *)s->relation()->name()); EST_String rel_name = s->S("time_path"); EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) EST_error("No relation %s for item\n", (const char *) rel_name); a = last_leaf_in_tree(t); float def = -1.0; EST_feat_status stat; return getFloat(*a, "end", def, stat); } EST_Val ff_leaf_start(EST_Item *s) { if (!s->f_present("time_path")) EST_error("Attempted to use leaf start() feature function on " "item with no time_path feature set: %s\n", (const char *)s->relation()->name()); EST_String rel_name = s->S("time_path"); EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) EST_error("No relation %s for item\n", (const char *) rel_name); a = first_leaf_in_tree(t); // cout << "this is the first node of the tree\n"; //cout << *a << endl; float def = -1.0; EST_feat_status stat; return getFloat(*a, "start", def, stat); } EST_Val ff_int_start(EST_Item *s) { EST_String rel_name = "IntonationPhrase"; EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) EST_error("No relation %s for item\n", (const char *) rel_name); a = first_leaf_in_tree(parent(t)->as_relation("MetricalTree")); float def = -1.0; EST_feat_status stat; return getFloat(*a, "start", def, stat); } EST_Val ff_int_end(EST_Item *s) { EST_String rel_name = "IntonationPhrase"; EST_Item *t, *a; if ((t = s->as_relation(rel_name)) == 0) EST_error("No relation %s for item\n", (const char *) rel_name); a = last_leaf_in_tree(parent(t)->as_relation("MetricalTree")); float def = -1.0; EST_feat_status stat; return getFloat(*a, "end", def, stat); } void register_standard_feature_functions(EST_FeatureFunctionPackage &p) { #ifdef EST_DEBUGGING cerr << "register_standard_feature_functions()\n"; #endif p.register_func("duration", ff_duration); p.register_func("start", ff_start); p.register_func("leaf_end", ff_leaf_end); p.register_func("leaf_start", ff_leaf_start); p.register_func("int_end", ff_int_end); p.register_func("int_start", ff_int_start); p.register_func("tilt_event_position", ff_tilt_event_position); p.register_func("tilt_phrase_position", ff_tilt_phrase_position); p.register_func("unisyn_duration", ff_duration); p.register_func("unisyn_start", ff_start); p.register_func("unisyn_leaf_end", ff_leaf_end); p.register_func("unisyn_leaf_start", ff_leaf_start); p.register_func("unisyn_int_end", ff_int_end); p.register_func("unisyn_int_start", ff_int_start); p.register_func("unisyn_tilt_event_position", ff_tilt_event_position); p.register_func("unisyn_tilt_phrase_position", ff_tilt_phrase_position); #ifdef EST_DEBUGGING cerr << "finished register_standard_feature_functions()\n"; #endif } speech_tools/ling_class/EST_Relation_mls.cc0000644000076400007640000001247310127000720017445 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : April 1999 */ /*-----------------------------------------------------------------------*/ /* Multi-linear list relations */ /* */ /* These are to allow to linear list relations to have relations */ /* between one item in one list and a list of items in the other */ /* */ /* */ /* Ehh I'll explain how I do this once its done */ /* */ /* */ /*=======================================================================*/ #include #include #include "ling_class/EST_Item.h" int linked(EST_Item *from, EST_Item *to) { EST_Item *i; for (i=link1(from); i; i=next_link(i)) if (i == to) return TRUE; return FALSE; } void add_link(EST_Item *from, EST_Item *to) { EST_Item *d,*q; // structurally add it d = from->down(); if (!d) d = from->append_daughter(); q = d->append_daughter()->append_daughter(to); // Also add it to the simple list of the relation so traversal works // append q } #if 0 /* nope all wrong */ static void mls_insert_up(EST_Item *c,EST_Item *d) { if (c->up() == 0) c->insert_above(d); else c->up()->last()->insert_after(d); } static void mls_insert_below(EST_Item *c,EST_Item *d) { if (c->down() == 0) c->insert_below(d); else c->down()->last()->insert_after(d); } static void mls_linked_down(EST_Item *c,EST_Item *d) { return in_list(d,c->down()); } static void mls_linked_up(EST_Item *c,EST_Item *d) { return in_list(d,c->up()); } int link_items(EST_Relation *mlsrel,EST_Item *i1, EST_item *i2) { if ((i1->in_relation(mlsrel->name())) && (i2->in_relation(mlsrel->name()))) { EST_error("can't link two items already in %s\n", (const char *)mlsrel->name()); return FALSE; } else if (i1->in_relation(mlsrel->name())) { EST_Item *c = mls_cluster(as(i1,mlsrel->name())); if (mls_linked_down(c,i1)) mls_insert_up(c,i2); else mls_insert_down(c,i2); } else if (i2->in_relation(mlsrel->name())) { EST_Item *c = mls_cluster(as(i2,mlsrel->name())); if (mls_linked_down(c,i2)) mls_insert_up(c,i1); else mls_insert_down(c,i1); } else { // neither in MLS so create new cluster EST_Item *c = mlsrel->append(); mls_insert_linked_up(c,i1); mls_insert_linked_down(c,i1); } return TRUE; } #endif void remove_link(EST_Item *from, EST_Item *to) { (void)from; (void)to; fprintf(stderr,"remove_link not written yet\n"); } speech_tools/ling_class/EST_item_aux.cc0000644000076400007640000001015610355751100016634 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Auxiliary functions related to items. */ /* */ /*************************************************************************/ #include "ling_class/EST_item_aux.h" #include "ling_class/EST_Item.h" #include "EST_String.h" #include "EST_error.h" #include "../base_class/EST_get_function_template.h" defineGetFunction(EST_Item, f, EST_Val, getVal) defineGetFunction(EST_Item, f, EST_String, getString) defineGetFunction(EST_Item, f, float, getFloat) defineGetFunction(EST_Item, f, int, getInteger) float start(const EST_Item &item) { float v=0; EST_feat_status status=efs_ok; EST_Item * pp; v = getFloat(item, "start", -1.0, status); if (v<0.0) { if ((pp = item.prev()) != NULL) v = getFloat(*pp, "end", -1.0, status); } return v; } float mid(const EST_Item &item) { float v = 0; EST_feat_status status=efs_ok; v = getFloat(item, "mid", -1.0, status); if (v<0.0) v = (start(item)+end(item))/2.0; return v; } float time(const EST_Item &item) { float v = 0; EST_feat_status status=efs_ok; v = getFloat(item, "time", -1.0, status); if (v<0.0) v = mid(item); return v; } float end(const EST_Item &item) { float v=0; EST_feat_status status=efs_ok; EST_Item * nn; v = getFloat(item, "end", -1.0, status); if (v < 0.0) { if ((nn = item.next()) != NULL) v = getFloat(*nn, "start", -1.0, status); } return v; } speech_tools/ling_class/EST_item_content_aux.cc0000644000076400007640000001434307262605664020410 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Auxiliary functions related to item_contents. */ /* */ /*************************************************************************/ #include "ling_class/EST_item_content_aux.h" #include "ling_class/EST_item_aux.h" #include "ling_class/EST_Item_Content.h" #include "EST_String.h" #include "EST_error.h" #include "../base_class/EST_get_function_template.h" defineGetFunction(EST_Item_Content, f.val, EST_Val, getValI) defineGetFunction(EST_Item_Content, f.val, EST_String, getStringI) defineGetFunction(EST_Item_Content, f.val, float, getFloatI) defineGetFunction(EST_Item_Content, f.val, int, getIntegerI) EST_Val getVal(const EST_Item_Content &f, const EST_String name, const EST_Val &def, EST_feat_status &s) { if (f.relations.length() == 0) return getValI(f, name, def, s); else { EST_Litem *p; p = f.relations.head(); EST_Item *i = item(f.relations.list(p).v); return getVal(*i, name, def, s); } } EST_String getString(const EST_Item_Content &f, const EST_String name, const EST_String &def, EST_feat_status &s) { if (f.relations.length() == 0) return getStringI(f, name, def, s); else { EST_Litem *p; p = f.relations.head(); EST_Item *i = item(f.relations.list(p).v); return getString(*i, name, def, s); } } int getInteger(const EST_Item_Content &f, const EST_String name, const int &def, EST_feat_status &s) { if (f.relations.length() == 0) return getIntegerI(f, name, def, s); else { EST_Litem *p; p = f.relations.head(); EST_Item *i = item(f.relations.list(p).v); return getInteger(*i, name, def, s); } } float getFloat(const EST_Item_Content &f, const EST_String name, const float &def, EST_feat_status &s) { if (f.relations.length() == 0) return getFloatI(f, name, def, s); else { EST_Litem *p; p = f.relations.head(); EST_Item *i = item(f.relations.list(p).v); return getFloat(*i, name, def, s); } } float start(const EST_Item_Content &item_content) { if (item_content.relations.length() == 0) { float v=0; EST_feat_status status=efs_ok; v = getFloat(item_content, "start", -1.0, status); return v; } else { EST_Litem *p; p = item_content.relations.head(); EST_Item *i = item(item_content.relations.list(p).v); return start(*i); } } float mid(const EST_Item_Content &item_content) { if (item_content.relations.length() == 0) { float v = 0; EST_feat_status status=efs_ok; v = getFloat(item_content, "mid", -1.0, status); if (v < 0.0) v = (start(item_content)+end(item_content))/2.0; return v; } else { EST_Litem *p; p = item_content.relations.head(); EST_Item *i = item(item_content.relations.list(p).v); return mid(*i); } } float time(const EST_Item_Content &item_content) { if (item_content.relations.length() == 0) { float v = 0; EST_feat_status status=efs_ok; v = getFloat(item_content, "time", -1.0, status); if (v < 0.0) v = mid(item_content); return v; } else { EST_Litem *p; p = item_content.relations.head(); EST_Item *i = item(item_content.relations.list(p).v); return time(*i); } } float end(const EST_Item_Content &item_content) { if (item_content.relations.length() == 0) { float v=0; EST_feat_status status=efs_ok; v = getFloat(item_content, "end", -1.0, status); return v; } else { EST_Litem *p; p = item_content.relations.head(); EST_Item *i = item(item_content.relations.list(p).v); return end(*i); } } speech_tools/ling_class/EST_Relation.cc0000644000076400007640000004326211465017155016612 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /*-----------------------------------------------------------------------*/ /* Generalised relations in utterances */ /* */ /*=======================================================================*/ #include #include #include #include #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" #include "relation_io.h" VAL_REGISTER_CLASS(relation,EST_Relation) EST_Relation::EST_Relation(const EST_String &name) { p_name = name; p_head = 0; p_tail = 0; p_utt = 0; } EST_Relation::EST_Relation() { p_head = 0; p_tail = 0; p_utt = 0; } void EST_Relation::copy(const EST_Relation &r) { // Do a *full* copy include the contents of all the items // But not the name (?) EST_String tmp_name; p_name = r.p_name; p_head = 0; p_tail = 0; p_utt = 0; // can't be in the same utterance as r tmp_name = f.S("name", ""); f = r.f; f.set("name", tmp_name); if (r.root() != 0) { EST_Item i = *r.root(); EST_Item *to_root = append(&i); copy_node_tree_contents(r.root(),to_root); } } EST_Item *EST_Relation::append(EST_Item *si) { EST_Item *nn; if (this == 0) { EST_warning("EST_Relation: no relation to append to"); return 0; } else if (p_tail == 0) { nn = new EST_Item(this, si); p_head = nn; } else nn = p_tail->insert_after(si); p_tail = nn; // if (!si->f_present("id") && utt()) // si->fset("id", utt()->next_id()); return nn; } EST_Item *EST_Relation::append() { return append(0); } EST_Item *EST_Relation::prepend() { return prepend(0); } EST_Item *EST_Relation::prepend(EST_Item *si) { EST_Item *nn; if (this == 0) { EST_warning("EST_Relation: no relation to prepend to"); return 0; } else if (p_head == 0) { nn = new EST_Item(this,si); p_tail = nn; } else nn = p_head->insert_before(si); p_head = nn; return nn; } EST_Relation::~EST_Relation() { clear(); } int EST_Relation::length() const { EST_Item *node; int i; if (this == 0) return 0; for (i=0,node=p_head; node; node=node->next()) i++; return i; } void EST_Relation::evaluate_item_features() { for (EST_Item *s = head(); s; s = s->next()) s->evaluate_features(); } void EST_Relation::clear() { EST_Item *nn,*nnn; for (nn = p_head; nn != 0; nn = nnn) { nnn = nn->next(); delete nn; } p_head = p_tail = 0; } void EST_Relation::remove_item(EST_Item *node) { if (p_head == node) p_head = node->next(); if (p_tail == node) p_tail = node->prev(); delete node; } void EST_Relation::remove_item_feature(const EST_String &name) { for (EST_Item *s = p_head; s; s = next_item(s)) s->f_remove(name); } void copy_relation(const EST_Relation &from, EST_Relation &to) { // clone the relation structure from into to, deleting any existing // nodes in to. to.clear(); if (from.root() != 0) { EST_Item *to_root = to.append(from.root()); copy_node_tree(from.root(),to_root); } } EST_write_status EST_Relation::save(ostream &outf, const EST_String &type, bool evaluate_ff) const { if (type == "esps") return save_esps_label(&outf,*this,evaluate_ff); else if (type == "htk") return save_htk_label(&outf,*this); else { EST_warning("EST_Relation: unsupported type: \"%s\"", (const char *)type); return write_fail; } } EST_write_status EST_Relation::save(const EST_String &filename, const EST_String &type, bool evaluate_ff) const { if (type == "esps") return save_esps_label(filename,*this,evaluate_ff); else if (type == "htk") return save_htk_label(filename,*this); else { EST_warning("EST_Relation: unsupported type: \"%s\"", (const char *)type); return write_fail; } } EST_write_status EST_Relation::save(const EST_String &filename, bool evaluate_ff) const { return save(filename,"esps",evaluate_ff); } EST_write_status EST_Relation::save(ostream &outf, EST_TKVL contents) const { EST_TKVL nodenames; int node_count = 1; outf << "Relation " << name() << " ; "; f.save(outf); outf << endl; save_items(p_head,outf,contents,nodenames,node_count); outf << "End_of_Relation" << endl; return write_ok; } EST_write_status EST_Relation::save_items(EST_Item *node, ostream &outf, EST_TKVL &cnames, EST_TKVL &nodenames, int &node_count) const { if (node != 0) { EST_Item *n = node; int myname; while (n) { myname = node_count++; nodenames.add_item(n,myname); n = n->next(); } n = node; while (n) { // This will need to be expanded if the we make Relations // have more complex structures save_items(n->down(),outf,cnames,nodenames,node_count); outf << nodenames.val(n) << " " << (n->contents() == 0 ? 0 : cnames.val(n->contents())) << " " << (n->up() == 0 ? 0 : nodenames.val(n->up())) << " " << (n->down() == 0 ? 0 : nodenames.val(n->down())) << " " << (n->next() == 0 ? 0 : nodenames.val(n->next())) << " " << (n->prev() == 0 ? 0 : nodenames.val(n->prev())) << endl; n = n->next(); } } return write_ok; } #if 0 EST_read_status EST_Relation::load(EST_TokenStream &ts, const EST_THash &contents) { if (ts.get() != "Relation") { cerr << "load_relation: " << ts.pos_description() << " no new Relation" << endl; return misc_read_error; } p_name = ts.get().string(); if (ts.get() != ";") { cerr << "load_relation: " << ts.pos_description() << " semicolon missing after Relation name \"" << p_name << "\"" << endl; return misc_read_error; } if (f.load(ts) != format_ok) return misc_read_error; if (load_items(ts,contents) != format_ok) return misc_read_error; return format_ok; } #endif EST_read_status EST_Relation::load(EST_TokenStream &ts, const EST_TVector < EST_Item_Content * > &contents ) { if (ts.get() != "Relation") { cerr << "load_relation: " << ts.pos_description() << " no new Relation" << endl; return misc_read_error; } p_name = ts.get().string(); if (ts.get() != ";") { cerr << "load_relation: " << ts.pos_description() << " semicolon missing after Relation name \"" << p_name << "\"" << endl; return misc_read_error; } if (f.load(ts) != format_ok) return misc_read_error; if (load_items(ts,contents) != format_ok) return misc_read_error; return format_ok; } void EST_Relation::node_tidy_up_val(int &k, EST_Val &v) { // Called to delete the nodes in the hash table when a load // fails (void)k; EST_Item *node = item(v); node->u = 0; node->d = 0; node->n = 0; node->p = 0; delete node; } void EST_Relation::node_tidy_up(int &k, EST_Item *node) { // Called to delete the nodes in the hash table when a load // fails (void)k; node->u = 0; node->d = 0; node->n = 0; node->p = 0; delete node; } #if 0 EST_read_status EST_Relation::load_items(EST_TokenStream &ts, const EST_THash &contents) { // Load a set of nodes from a TokenStream, the file contains node // descriptions one per line as 5 ints, this nodes name, the // stream item it is to be related to, then the name of the // nodes above, below, before and after it. EST_THash nodenames(100); EST_read_status r = format_ok; EST_Item *node = 0; EST_Relation *rel=NULL; // int expect_links=0; while (ts.peek() != "End_of_Relation") { int name = atoi(ts.get().string()); int siname; node = get_item_from_name(nodenames,name); if (!node) EST_error("Unknown item %d", name); if (rel==NULL) { rel=node->relation(); // EST_String type = rel->f.S("type", ""); // expect_links = (type == "ladder"); } siname = atoi(ts.get().string()); if (siname != 0) { int found; EST_Val v = contents.val(siname,found); if (!found) { cerr << "load_nodes: " << ts.pos_description() << " node's item contents" << siname << " doesn't exist\n"; r = misc_read_error; break; } else node->set_contents(icontent(v)); } // up down next previous node->u = get_item_from_name(nodenames,atoi(ts.get().string())); node->d = get_item_from_name(nodenames,atoi(ts.get().string())); node->n = get_item_from_name(nodenames,atoi(ts.get().string())); node->p = get_item_from_name(nodenames,atoi(ts.get().string())); // Read ladder links #if 0 if (expect_links) { int numlinks = atoi(ts.get().string()); // node->link_feats.set("num_links",numlinks); for (int i=0;ilink_feats.set_val("link" + itoString(i),est_val(item)); } } #endif } ts.get(); // skip End_of_Relation if (r == format_ok) { if (node != 0) // at least one node { p_head = get_item_from_name(nodenames,1); p_tail = p_head->last(); if (!p_head->verify()) { cerr << "load_nodes: " << ts.pos_description() << " nodes do not form consistent graph" << endl; r = misc_read_error; } } } if (r != format_ok) { // failed to read this relation so clear the created nodes // before returning, no idea what state the links are in so // explicitly unlink them before deleting them nodenames.map(node_tidy_up_val); } return r; } #endif EST_read_status EST_Relation::load_items(EST_TokenStream &ts, const EST_TVector < EST_Item_Content * > &contents ) { // Load a set of nodes from a TokenStream, the file contains node // descriptions one per line as 5 ints, this nodes name, the // stream item it is to be related to, then the name of the // nodes above, below, before and after it. EST_TVector < EST_Item * > nodenames(100); // EST_THash nodenames(100); EST_read_status r = format_ok; EST_Item *node = 0; EST_Relation *rel=NULL; // int expect_links=0; while (ts.peek() != "End_of_Relation") { int name = atoi(ts.get().string()); int siname; node = get_item_from_name(nodenames,name); if (!node) EST_error("Unknown item %d", name); if (rel==NULL) { rel=node->relation(); // EST_String type = rel->f.S("type", ""); // expect_links = (type == "ladder"); } siname = atoi(ts.get().string()); if (siname != 0) { EST_Item_Content *c = contents(siname); if (c==NULL) { cerr << "load_nodes: " << ts.pos_description() << " node's stream item " << siname << " doesn't exist\n"; r = misc_read_error; break; } else node->set_contents(c); } // up down next previous node->u = get_item_from_name(nodenames,atoi(ts.get().string())); node->d = get_item_from_name(nodenames,atoi(ts.get().string())); node->n = get_item_from_name(nodenames,atoi(ts.get().string())); node->p = get_item_from_name(nodenames,atoi(ts.get().string())); #if 0 // Read ladder links if (expect_links) { int numlinks = atoi(ts.get().string()); // node->link_feats.set("num_links",numlinks); for (int i=0;ilink_feats.set_val("link" + itoString(i),est_val(item)); } } #endif } ts.get(); // skip End_of_Relation if (r == format_ok) { if (node != 0) // at least one node p_head = get_item_from_name(nodenames,1); p_tail = p_head->last(); if (!p_head->verify()) { cerr << "load_nodes: " << ts.pos_description() << " nodes do not form consistent graph" << endl; r = misc_read_error; } } if (r != format_ok) { // failed to read this relation so clear the created nodes // before returning, no idea what state the links are in so // explicitly unlink them before deleting them for(int ni=0; ni &nodenames, int name) { // Return node named by name or create a new one if it doesn't // already exist EST_Item *node; int found; if (name == 0) return 0; EST_Val v = nodenames.val(name,found); if (!found) { node = new EST_Item(this, 0); nodenames.add_item(name,est_val(node)); } else node = item(v); return node; } EST_Item *EST_Relation::get_item_from_name(EST_TVector< EST_Item * > &nodenames, int name) { // Return node named by name or create a new one if it doesn't // already exist if (name == 0) return 0; if (name >= nodenames.length()) { nodenames.resize(name*2, 1); } EST_Item *node = nodenames(name); if (node==NULL) { node = new EST_Item(this, 0); nodenames[name] = node; } return node; } EST_read_status EST_Relation::load(const EST_String &filename, EST_TokenStream &ts, const EST_String &type) { EST_read_status r; f.set("filename",filename); if (type == "esps") r = load_esps_label(ts,*this); else if (type == "ogi") r = load_ogi_label(ts,*this); else if (type == "htk") r = load_sample_label(ts,*this,10000000); else if ((type == "ascii") || (type == "timit")) r = load_sample_label(ts,*this,1); else if (type == "words") r = load_words_label(ts,*this); else // currently esps is the default r = load_esps_label(ts,*this); return r; } EST_read_status EST_Relation::load(const EST_String &filename, const EST_String &type) { // Load an isolated relation from a file, assuming Xlabel format EST_TokenStream ts; EST_read_status r; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "load_relation: can't open relation input file " << filename << endl; return misc_read_error; } r = load(filename, ts, type); ts.close(); return r; } int num_leaves(const EST_Item *h) { int count = 0; EST_Item *n; for (n = h->first_leaf(); n != 0; n=n->next_leaf()) count++; return count; } EST_Item *EST_Relation::first_leaf() const { return head()->first_leaf(); } EST_Item *EST_Relation::last_leaf() const { return head()->last_leaf(); } EST_Utterance *get_utt(EST_Item *s) { // Occasionally you need to get the utterance from a stream_item // This finds any relations in s and follows them to the utterance // If there aren't any Relations the this streamitem isn't in an // utterances if (s == 0) return 0; if (s->relation()) return s->relation()->utt(); else return 0; // can't find an utterance } EST_Relation &EST_Relation::operator=(const EST_Relation &s) { copy(s); return *this; } ostream& operator << (ostream &s, const EST_Relation &a) { s << a.f << endl; for (EST_Item *p = a.head(); p; p = p->next()) s << *p << endl; return s; } speech_tools/ling_class/EST_UtteranceFile.cc0000644000076400007640000004254710127000720017554 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Functions to load and save utterances in various formats. */ /* */ /*************************************************************************/ #include #include #include #include #include "EST_string_aux.h" #include "EST_FileType.h" #include "EST_Token.h" #include "ling_class/EST_Utterance.h" #include "EST_UtteranceFile.h" static EST_read_status load_all_contents(EST_TokenStream &ts, // EST_THash &sitems, EST_TVector < EST_Item_Content * > &sitems, int &max_id); static EST_read_status load_relations(EST_TokenStream &ts, EST_Utterance &utt, const EST_TVector < EST_Item_Content * > &sitems // const EST_THash &sitems ); // static EST_write_status save_est_ascii(ostream &outf,const EST_Utterance &utt); static EST_write_status utt_save_all_contents(ostream &outf, const EST_Utterance &utt, EST_TKVL &sinames); static EST_write_status utt_save_all_contents(ostream &outf, EST_Item *n, EST_TKVL &sinames, int &si_count); static EST_write_status utt_save_ling_content(ostream &outf, EST_Item *si, EST_TKVL &sinames, int &si_count); static void node_tidy_up(int &k, EST_Item_Content *node) { // Called to delete the nodes in the hash table when a load (void)k; if (node->unref_relation("__READ__")) delete node; } EST_read_status EST_UtteranceFile::load_est_ascii(EST_TokenStream &ts, EST_Utterance &u, int &max_id) { EST_Option hinfo; bool ascii; EST_EstFileType t; EST_read_status r; // EST_THash sitems(100); EST_TVector< EST_Item_Content * > sitems(100); // set up the character constant values for this stream ts.set_SingleCharSymbols(";()"); ts.set_quotes('"','\\'); if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_utterance) return misc_read_error; if (hinfo.ival("version") != 2) { if (hinfo.ival("version") == 3) EST_warning("Loading est utterance format version 3, ladders will not be understood"); else { EST_error("utt_load: %s wrong version of utterance format expected 2 (or 3) but found %d", (const char *)ts.pos_description(), hinfo.ival("version")); } } // Utterance features if (ts.get() != "Features") { cerr << "utt_load: " << ts.pos_description() << " missing utterance features section" << endl; return misc_read_error; } else u.f.load(ts); // items if (ts.get() != "Stream_Items") { cerr << "utt_load: " << ts.pos_description() << " missing Items section" << endl; return misc_read_error; } max_id = 0; r = load_all_contents(ts, sitems, max_id); // Only exist in older form utterances so soon wont be necessary if (ts.peek() == "Streams") { cerr << "utt.load: streams found in utterance file, " << "no longer supported" << endl; return misc_read_error; } // Relations if ((r == format_ok) && (ts.get() != "Relations")) { cerr << "utt_load: " << ts.pos_description() << " missing Relations section" << endl; return misc_read_error; } r = load_relations(ts, u, sitems); if ((r == format_ok) && (ts.get() != "End_of_Utterance")) { cerr << "utt_load: " << ts.pos_description() << " End_of_Utterance expected but not found" << endl; return misc_read_error; } // if (r != format_ok) // { // This works because even if some of these si's have been // linked to nodes they will be unlink when the si is destroyed for(int ni=0; ni < sitems.length(); ni++) { EST_Item_Content *c = sitems[ni]; if (c != NULL) node_tidy_up(ni, c); } // } return r; } static EST_read_status load_all_contents(EST_TokenStream &ts, // EST_THash &sitems, EST_TVector < EST_Item_Content * > &sitems, int &max_id) { // Load items into table with names for later reference // by relations EST_String Sid; bool ok; int id,idval; while (ts.peek() != "End_of_Stream_Items") { EST_Item_Content *si = new EST_Item_Content; si->relations.add_item("__READ__", est_val((EST_Item *)NULL), 1); id = 0; Sid = ts.get().string(); id = Sid.Int(ok); if (!ok) { cerr << "utt_load: " << ts.pos_description() << " Item name not a number: " << Sid << endl; return misc_read_error; } if (id >= sitems.length()) { sitems.resize(id*2, 1); } sitems[id] = si; // sitems.add_item(id,est_val(si)); if (si->f.load(ts) != format_ok) return misc_read_error; idval = si->f.I("id",0); if (idval > max_id) max_id = idval; if (ts.eof()) return misc_read_error; // just in case this happens } ts.get(); // skip "End_of_Stream_Items" return format_ok; } static EST_read_status load_relations(EST_TokenStream &ts, EST_Utterance &utt, const EST_TVector < EST_Item_Content * > &sitems // const EST_THash &sitems ) { // Load relations while (ts.peek() != "End_of_Relations") { // can't use create relation as we don't know its name until // after its loaded EST_Relation *r = new EST_Relation; if (r->load(ts,sitems) != format_ok) return misc_read_error; r->set_utt(&utt); utt.relations.set_val(r->name(),est_val(r)); if (ts.eof()) return misc_read_error; } ts.get(); // Skip "End_of_Relations" return format_ok; } EST_write_status EST_UtteranceFile::save_est_ascii(ostream &outf,const EST_Utterance &utt) { EST_write_status v = write_ok; outf.precision(8); outf.setf(ios::fixed, ios::floatfield); outf.width(8); outf << "EST_File utterance\n"; // EST header identifier. outf << "DataType ascii\n"; outf << "version 2\n"; outf << "EST_Header_End\n"; // EST end of header identifier. // Utterance features outf << "Features "; utt.f.save(outf); outf << endl; outf << "Stream_Items\n"; EST_TKVL sinames; v = utt_save_all_contents(outf,utt,sinames); if (v == write_fail) return v; outf << "End_of_Stream_Items\n"; // Relations outf << "Relations\n"; EST_Features::Entries p; for (p.begin(utt.relations); p; p++) { v = relation(p->v)->save(outf,sinames); if (v == write_fail) return v; } outf << "End_of_Relations\n"; outf << "End_of_Utterance\n"; return write_ok; } static EST_write_status utt_save_all_contents(ostream &outf, const EST_Utterance &utt, EST_TKVL &sinames) { // Write out all stream items in the utterance, as they may appear in // various places in an utterance keep a record of which ones // have been printed and related them to names for reference by // the Relations (and older Stream architecture). int si_count = 1; EST_write_status v = write_ok; // Find the stream items in the relations EST_Features::Entries p; for (p.begin(utt.relations); p; p++) { v = utt_save_all_contents(outf,relation(p->v)->head(), sinames,si_count); if (v == write_fail) return v; } return v; } static EST_write_status utt_save_all_contents(ostream &outf, EST_Item *n, EST_TKVL &sinames, int &si_count) { if (n == 0) return write_ok; else { utt_save_ling_content(outf,n,sinames,si_count); // As we have more complex structures this will need to // be updated (i.e. we'll need a marking method for nodes) utt_save_all_contents(outf,n->next(),sinames,si_count); utt_save_all_contents(outf,n->down(),sinames,si_count); } return write_ok; } static EST_write_status utt_save_ling_content(ostream &outf, EST_Item *si, EST_TKVL &sinames, int &si_count) { // Save item and features if not already saved if ((si != 0) && (!sinames.present(si->contents()))) { sinames.add_item(si->contents(),si_count); outf << si_count << " "; si->features().save(outf); outf << endl; si_count++; } return write_ok; } EST_read_status EST_UtteranceFile::load_xlabel(EST_TokenStream &ts, EST_Utterance &u, int &max_id) { (void)max_id; EST_read_status status = read_ok; u.clear(); EST_Relation *rel = u.create_relation("labels"); status = rel->load("", ts, "esps"); EST_Item *i = rel->head(); float t=0.0; while (i != NULL) { i->set("start", t); t = i->F("end"); i = i->next(); } return status; } EST_write_status EST_UtteranceFile::save_xlabel(ostream &outf, const EST_Utterance &utt) { EST_write_status status = write_error; EST_Relation *rel; EST_Features::Entries p; for (p.begin(utt.relations); p; p++) { rel = ::relation(p->v); EST_Item * hd = rel->head(); while (hd) { if (hd->up() || hd->down()) break; hd=hd->next(); } // didn't find anything => this is linear if(!hd) return rel->save(outf, "esps", 0); } // Found no linear relations return status; } #if defined(INCLUDE_XML_FORMATS) #include "genxml.h" #include "apml.h" // APML support EST_read_status EST_UtteranceFile::load_apml(EST_TokenStream &ts, EST_Utterance &u, int &max_id) { FILE *stream; if ((stream=ts.filedescriptor())==NULL) return read_error; long pos=ftell(stream); { char buf[80]; fgets(buf, 80, stream); if (strncmp(buf, " features(20); EST_Features::Entries p; for (p.begin(utt.relations); p; ++p) { EST_Relation *rel = ::relation(p->v); EST_Item * hd = rel->head(); while (hd) { EST_Features::Entries fp; for (fp.begin(hd->features()); fp; ++fp) features.add_item(fp->k, 1); hd=hd->next(); } } outf << "\n"; outf << "::Entries f; outf << "\tk != "id") { outf << "\t\t" << f->k << "\tCDATA #IMPLIED\n"; } } outf << "\t\t>\n"; outf << "\t]>\n"; outf << "\n"; outf << "\n"; for (p.begin(utt.relations); p; ++p) { EST_Relation *rel = ::relation(p->v); EST_Item * hd = rel->head(); while (hd) { if (hd->up() || hd->down()) break; hd=hd->next(); } // didn't find anything => this is linear if(!hd) { outf << "\n"; hd = rel->head(); while (hd) { outf << " features()); p; ++p) if (p->k != "estContentFeature") outf << " " << p->k << "='" << p->v << "'\n"; outf << " />\n"; hd=hd->next(); } outf << "\n"; } else // for now give an error for non-linear relations status=write_partial; } outf << "\n"; return status; ; } #endif EST_String EST_UtteranceFile::options_short(void) { EST_String s(""); for(int n=0; n< EST_UtteranceFile::map.n() ; n++) { EST_UtteranceFileType type = EST_UtteranceFile::map.nth_token(n); if (type != uff_none) { for(int ni=0; ni #include #include #include "EST_TDeque.h" #include "EST_THash.h" #include "EST_error.h" #include "genxml.h" #include "rxp/XML_Parser.h" #include "ling_class_init.h" #if defined(ESTLIBDIRC) # define __STRINGIZE(X) #X # define ESTLIBDIR __STRINGIZE(ESTLIBDIRC) #endif static EST_Regex simpleIDRegex("[^#]*#id(\\([-a-z0-9]+\\))"); static EST_Regex rangeIDRegex("[^#]*#id(\\([a-z]*\\)\\([0-9]*\\)\\(-\\([0-9]+\\)\\)*).*id(\\([a-z]*\\)\\([0-9]*\\)\\(-\\([0-9]+\\)\\)*)"); static EST_Regex featureDefRegex("\\([^:]*\\):\\(.*\\)"); // Separator between feature names in attributes. static EST_String feat_sep(","); // I'd like to get rid of this. It is a maximum for the number of features // which can be named in an attribute, say for copying to the utterance. #define MAX_FEATS (50) // Parse state. class GenXML_Parse_State { public: int depth; int open_depth; int rel_start_depth; EST_TDeque depth_stack; EST_String relName; bool linear; EST_Utterance *utt; EST_Relation *rel; EST_Item *parent; EST_Item *current; EST_String contentAttr; // used to force a given ID on a node. EST_String id; EST_TStringHash contents; GenXML_Parse_State() : contents(100) {} }; class GenXML_Parser_Class : public XML_Parser_Class { protected: virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); }; static void print_attributes(XML_Attribute_List &attributes); XML_Parser_Class *EST_GenXML::pclass; void EST_GenXML::class_init(void) { ling_class_init::use(); pclass = new GenXML_Parser_Class(); #ifdef DEBUGGING printf("Register estlib in genxml %s\n", ESTLIBDIR "/\\1.dtd"); #endif pclass->register_id("//CSTR EST//DTD \\(.*\\)//[A-Z]*", ESTLIBDIR "/\\1.dtd"); pclass->register_id("//CSTR EST//ENTITIES \\(.*\\)//[A-Z]*", ESTLIBDIR "/\\1.ent"); } void EST_GenXML::register_id(const EST_String pattern, const EST_String result) { EST_GenXML::pclass->register_id(pattern, result); } void EST_GenXML::registered_ids(EST_StrList &list) { EST_GenXML::pclass->registered_ids(list); } InputSource EST_GenXML::try_and_open(Entity ent) { return EST_GenXML::pclass->try_and_open(ent); } EST_read_status EST_GenXML::read_xml(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id) { (void)max_id; (void)print_attributes; // just to shut -Wall up. GenXML_Parse_State state; u.clear(); state.utt=&u; XML_Parser *parser = EST_GenXML::pclass->make_parser(file, name, &state); parser->track_context(TRUE); CATCH_ERRORS() return read_format_error; parser->go(); END_CATCH_ERRORS(); return read_ok; } static void ensure_relation(GenXML_Parse_State *state, EST_String name) { if (state->rel!=NULL && name == state->relName) return; state->rel = state->utt->create_relation(state->relName=name); } static EST_Item_Content *get_contents(GenXML_Parse_State *state, EST_String id) { EST_Item_Content *c = state->contents.val(id); if (c==NULL) { c = new EST_Item_Content(); state->contents.add_item(id, c); c->f.set("id", id); } else { if (c->relations.present(state->relName)) return NULL; } return c; } static EST_String make_new_id(const char *root) { char buf[100]; static int count=0; sprintf(buf, "%s%d", root, ++count); return buf; } static void extract_ids(XML_Attribute_List &attributes, EST_TList &ids) { EST_String val; if (attributes.present("id")) { val = attributes.val("id"); #if defined(EST_DEBUGGING) fprintf(stderr, "ID %s\n", (const char *)val); #endif ids.append(val); } else if (attributes.present("href")) { val = attributes.val("href"); int starts[EST_Regex_max_subexpressions]; int ends[EST_Regex_max_subexpressions]; if (val.matches(simpleIDRegex, 0, starts, ends)) { EST_String n = val.at(starts[1], ends[1]-starts[1]); #if defined(EST_DEBUGGING) fprintf(stderr, "SIMPLE %s\n", (const char *)n); #endif ids.append(n); } else if (val.matches(rangeIDRegex, 0, starts, ends)) { EST_String prefix1 = val.at(starts[1], ends[1]-starts[1]); int n1 = atoi(val.at(starts[2], ends[2]-starts[2])); EST_String postfix1 = val.at(starts[4], ends[4]-starts[4]); EST_String prefix2 = val.at(starts[5], ends[5]-starts[5]); int n2 = atoi(val.at(starts[6], ends[6]-starts[6])); EST_String postfix2 = val.at(starts[8], ends[8]-starts[8]); #if defined(EST_DEBUGGING) fprintf(stderr, "RANGE '%s' %d - '%s' // '%s' %d - '%s'\n", (const char *)prefix1, n1, (const char *)postfix1, (const char *)prefix2, n2, (const char *)postfix2 ); #endif if (prefix1==prefix2) prefix2=""; char buf[100]; if (n1==n2) { int c; if (postfix1.length()==0) { sprintf(buf, "%s%s%d", (const char *)prefix1, (const char *)prefix2, n1 ); ids.append(buf); c=1; } else c=atoi(postfix1); if (postfix2.length()>0) for (; c<=atoi(postfix2); c++) { sprintf(buf, "%s%s%d-%d", (const char *)prefix1, (const char *)prefix2, n1, c ); ids.append(buf); } } else { for(int i=n1; i<=n2; i++) { if (i==n2 && postfix2.length()>0) { sprintf(buf, "%s%s%d", (const char *)prefix1, (const char *)prefix2, i ); ids.append(buf); for (int c=1; c<=atoi(postfix2); c++) { sprintf(buf, "%s%s%d-%d", (const char *)prefix1, (const char *)prefix2, i, c ); ids.append(buf); } } else { if ( postfix1.length()>0) sprintf(buf, "%s%s%d-%s", (const char *)prefix1, (const char *)prefix2, i, (const char *)postfix1 ); else sprintf(buf, "%s%s%d", (const char *)prefix1, (const char *)prefix2, i ); ids.append(buf); } postfix1=""; } } } else EST_warning("element with bad ID or HREF '%s'", (const char *)val); } else ids.append(make_new_id("n")); // cout << ids << "\n"; } /* For debugging. */ static void print_attributes(XML_Attribute_List &attributes) { XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) printf(" %s='%s'", (const char *)them->k, (const char *)them->v); } /** Now we define the callbacks. */ void GenXML_Parser_Class::document_open(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; GenXML_Parse_State *state = (GenXML_Parse_State *)data; state->depth=1; state->open_depth=-1; state->rel_start_depth=-1; state->depth_stack.clear(); state->rel=NULL; state->parent=NULL; state->current=NULL; state->id=""; } void GenXML_Parser_Class::document_close(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; } static void proccess_features(EST_String name, EST_String defs, XML_Attribute_List &attributes, EST_Features &f) { EST_String names[MAX_FEATS]; int starts[EST_Regex_max_subexpressions]; int ends[EST_Regex_max_subexpressions]; int n = split(defs, names, MAX_FEATS, feat_sep); for(int i=0; idepth++; EST_String val, ig; // Features to copy to utterance if (state->utt != NULL && (val=attributes.val("estUttFeats")) != EST_String::Empty) proccess_features(name, val, attributes, state->utt->f); // Features to copy to relation if (state->rel != NULL && (val=attributes.val("estRelFeats")) != EST_String::Empty) proccess_features(name, val, attributes, state->rel->f); if ((val=attributes.val("estRelationElementAttr")) != EST_String::Empty) { // All nodes inside this element are in the given relation EST_String relName = attributes.val(val); if (relName == EST_String::Empty) { relName = "UNNAMED"; EST_warning("%s\nNo feature '%s' to name relation\n", get_error(p), (const char *)val); } EST_String relationType = attributes.val("estRelationTypeAttr"); ensure_relation(state, relName); state->rel_start_depth=state->depth; state->linear=(attributes.val(relationType) == "linear"|| attributes.val(relationType) == "list"); #ifdef DEBUGGING printf("start of relation depth=%d name=%s type=%s\n", state->depth, (const char *)relName, state->linear?"linear":"tree"); #endif } else if ((state->rel_start_depth >= 0 && (ig=attributes.val("estRelationIgnore")) == EST_String::Empty) || (val=attributes.val("estRelationNode")) != EST_String::Empty) { // This node defines an Item in a relation. #ifdef DEBUGGING printf("push depth=%d name=%s ig=%s\n", state->depth, name, (const char *)ig); #endif if (val != EST_String::Empty) ensure_relation(state, val); state->depth_stack.push(state->open_depth); state->open_depth=state->depth; EST_TList ids; if (state->id == EST_String::Empty) { extract_ids(attributes, ids); } else ids.append(state->id); switch (ids.length()) { case 0: XML_Parser_Class::error(c, p, data, EST_String("Element With No Id")); break; case 1: { EST_String id = ids.first(); if (id==EST_String::Empty) XML_Parser_Class::error(c, p, data, EST_String("Element With No Id")); EST_Item_Content *cont = get_contents(state, id); if (!cont) XML_Parser_Class::error(c, p, data, EST_String("Repeated Id ") + id); XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) { EST_String k = them->k; EST_String v = them->v; cont->f.set(k,v); } cont->f.set("id", id); EST_Item *item; if (state->linear) if (state->current == NULL) item = state->rel->append(); else item = state->current->insert_after(); else if (state->current == NULL) if (state->parent == NULL) item = state->rel->append(); else item = state->parent->append_daughter(); else if (state->parent == NULL) item = state->current->insert_after(); else item = state->parent->append_daughter(); item->set_contents(cont); state->current=NULL; state->parent=item; } break; default: { bool embed = (attributes.val("estExpansion") == "embed"); if (embed) { state->id=make_new_id("e"); element_open(c, p, data, name, attributes); state->id=""; } EST_Litem *idp = ids.head(); bool first=TRUE; for(; idp!= NULL; idp = idp->next()) { EST_String id = ids(idp); if (id==EST_String::Empty) XML_Parser_Class::error(c, p, data, EST_String("Element With No Id")); if (!first) element_close(c, p, data, name); else first=FALSE; state->id=id; element_open(c, p, data, name, attributes); state->id=EST_String::Empty; } if (embed) { element_close(c, p, data, name); } } } if (state->parent!=NULL) state->contentAttr = attributes.val("estContentFeature"); #ifdef DEBUGGING printf("\t current=%s parent=%s contA=%s\n", (const char *)state->current->name(), (const char *)state->parent->name(), (const char *)state->contentAttr); #endif } else ; // Skip } void GenXML_Parser_Class::element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; GenXML_Parse_State *state = (GenXML_Parse_State *)data; (void)state; element_open(c, p, data, name, attributes); element_close(c, p, data, name); } void GenXML_Parser_Class::element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) { (void)c; (void)p; (void)name; GenXML_Parse_State *state = (GenXML_Parse_State *)data; EST_String val; if (state->depth == state->rel_start_depth ) { #ifdef DEBUGGING printf("end of relation depth=%d name=%s\n", state->depth, name); #endif state->rel_start_depth=-1; } if ( state->depth == state->open_depth) { #ifdef DEBUGGING printf("pop depth=%d name=%s\n", state->depth, name); #endif state->current = state->parent; state->parent=parent(state->parent); state->open_depth = state->depth_stack.pop(); #ifdef DEBUGGING printf("\t current=%s parent=%s\n", (const char *)state->current->name(), (const char *)state->parent->name()); #endif } state->depth--; } void GenXML_Parser_Class::pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; GenXML_Parse_State *state = (GenXML_Parse_State *)data; if ( state->parent != NULL && state->contentAttr != EST_String::Empty) state->parent->set(state->contentAttr, chars); #ifdef DEBUGGING printf("GEN XML Parser [pcdata[%s]] %d\n", chars, state->depth); #endif } void GenXML_Parser_Class::cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; (void)data; (void)chars; // GenXML_Parse_State *state = (GenXML_Parse_State *)data; #ifdef DEBUGGING printf("GEN XML Parser [cdata[%s]] %d\n", chars, state->depth); #endif } void GenXML_Parser_Class::processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) { (void)c; (void)p; (void)instruction; GenXML_Parse_State *state = (GenXML_Parse_State *)data; (void)state; #ifdef DEBUGGING printf("GEN XML Parser [proc[%s]] %d\n", instruction, state->depth); #endif } void GenXML_Parser_Class::error(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; // GenXML_Parse_State *state = (GenXML_Parse_State *)data; EST_error("GEN XML Parser %s", get_error(p)); est_error_throw(); } template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_Item_Content *EST_THash::Dummy_Value = NULL; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash_T(EST_Item_Content *, THash_String_ItemC_P) #endif speech_tools/ling_class/EST_utterance_aux.cc0000644000076400007640000001053110044502522017662 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Auxiliary operations on utterance structures. */ /* */ /*************************************************************************/ #include "ling_class/EST_utterance_aux.h" #include "EST_UtteranceFile.h" #include "genxml.h" EST_String options_utterance_filetypes(void) { // Returns list of currently support utterance filetypes // Should be extracted from the list in EST_Utterance return EST_UtteranceFile::options_short(); } EST_String options_utterance_filetypes_long(void) { // Returns list of currently support utterance filetypes // Should be extracted from the list in EST_Utterance return EST_UtteranceFile::options_supported(); } /*************************************************************************/ /* */ /* XML related functions. the first two are stubs if RXP is not */ /* available. The third is not available at all. */ /* */ /*************************************************************************/ void utterance_xml_register_id(const EST_String pattern, const EST_String result) { (void)pattern; (void)result; #if defined(INCLUDE_XML_FORMATS) EST_GenXML::register_id(pattern, result); #endif } void utterance_xml_registered_ids(EST_StrList &list) { (void)list; #if defined(INCLUDE_XML_FORMATS) EST_GenXML::registered_ids(list); #endif } #if defined(INCLUDE_XML_FORMATS) #include "ling_class/EST_utterance_xml.h" InputSource utterance_xml_try_and_open(Entity ent) { return EST_GenXML::try_and_open(ent); } #endif speech_tools/ling_class/ling_class_init.cc0000644000076400007640000000636107262605664017472 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Force initialisation of ling_class code. */ /* */ /*************************************************************************/ #include "ling_class/EST_Item.h" #include "EST_FeatureFunctionContext.h" #ifdef INCLUDE_XML_FORMATS # include "genxml.h" #endif #include "ling_class_init.h" ling_class_init ling_class_init::init; ling_class_init::ling_class_init(void) { EST_FeatureFunctionContext::class_init(); EST_Item::class_init(); #ifdef INCLUDE_XML_FORMATS EST_GenXML::class_init(); #endif } void ling_class_init::use(void) { } speech_tools/ling_class/ling_t.cc0000644000076400007640000000621707263200535015572 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : June 1995 */ /*-----------------------------------------------------------------------*/ /* Instantiation of template functions */ /* */ /*=======================================================================*/ #include "EST_TList.h" #include "EST_String.h" #include "ling_class/EST_Relation.h" Declare_TVector(EST_Item) Declare_TList(EST_Relation) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" #include "../base_class/EST_TList.cc" Instantiate_TVector(EST_Item) Instantiate_TList(EST_Relation) #endif speech_tools/ling_class/EST_Utterance.cc0000644000076400007640000003705511465017155016772 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* EST_Utterance class source file */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_error.h" #include "EST_string_aux.h" #include "ling_class/EST_Utterance.h" #include "EST_UtteranceFile.h" #include "EST_string_aux.h" const EST_String DEF_FILE_TYPE = "est_ascii"; static void clear_up_sisilist(EST_TKVL &s); static EST_Item *map_ling_item(EST_Item *si, EST_TKVL &s); static void copy_relation(EST_Item *to,EST_Item *from, EST_TKVL &slist); Declare_KVL_T(EST_Item_Content *, EST_Item *, KVL_ICP_IP) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TKVL.cc" Instantiate_KVL_T(EST_Item_Content *, EST_Item *, KVL_ICP_IP) #endif EST_Utterance::EST_Utterance() { init(); } void EST_Utterance::init() { highest_id = 0; f.set("max_id", 0); } int EST_Utterance::next_id() { int i = f.val("max_id").Int(); f.set("max_id", i+1); return i+1; } void EST_Utterance::clear() { relations.clear(); } void EST_Utterance::clear_relations() { EST_Features::Entries p; for (p.begin(relations); p; p++) ::relation(p->v)->clear(); } EST_Relation *EST_Utterance::create_relation(const EST_String &n) { EST_Relation *r = relation(n,FALSE); if (r) // there is one already, so clear it r->clear(); else { r = new EST_Relation(n); r->set_utt(this); relations.set_val(n,est_val(r)); } return r; } static EST_Item *item_id(EST_Item *p, const EST_String &n) { EST_Item *s, *t; t = 0; if ((p == 0) || (p->S("id","0") == n)) return p; for (s = daughter1(p); s; s = s->next()) { t = item_id(s, n); if (t != 0) return t; } return 0; } EST_Item *EST_Utterance::id(const EST_String &n) const { EST_Item *s, *t; EST_Features::Entries p; for (p.begin(relations); p; p++) for (s = ::relation(p->v)->head(); s; s = next_item(s)) if ((t = item_id(s, n)) != 0) return t; EST_error("Could not find item matching id %s\n", (const char *)n); return 0; } void EST_Utterance::evaluate_all_features() { EST_Features::Entries p; for (p.begin(relations); p; p++) ::relation(p->v)->evaluate_item_features(); } void EST_Utterance::remove_relation(const EST_String &n) { EST_Relation *r = relation(n,FALSE); if (r != 0) relations.remove(n); } EST_Relation *EST_Utterance::relation(const char *name,int err) const { if (err) return ::relation(relations.f(name)); else { EST_Relation *r = 0; return ::relation(relations.f(name,est_val(r))); } } bool EST_Utterance::relation_present(const EST_String name) const { if (!name.contains("(")) return relations.present(name); EST_StrList s; BracketStringtoStrList(name, s); return relation_present(s); } bool EST_Utterance::relation_present(EST_StrList &names) const { for (EST_Litem *p = names.head(); p ; p = p->next()) if (!relations.present(names(p))) return false; return true; } EST_Utterance &EST_Utterance::operator=(const EST_Utterance &s) { copy(s); return *this; } ostream& operator << (ostream &st, const EST_Utterance &u) { u.save(st,"est_ascii"); return st; } void EST_Utterance::copy(const EST_Utterance &u) { // Make a copy of the utterance EST_TKVL sisilist; EST_Relation *nrel; EST_Item *rnode; clear(); f = u.f; EST_Features::Entries r; for (r.begin(u.relations); r; r++) { EST_Relation *rr = ::relation(r->v); nrel = create_relation(rr->name()); nrel->f = rr->f; if (rr->head() != 0) { rnode = nrel->append(map_ling_item(rr->head(),sisilist)); copy_relation(rnode,rr->head(),sisilist); } } clear_up_sisilist(sisilist); } static void extra_sub_utterance(EST_Utterance &u,EST_Item *i) { sub_utterance(u,i); } void EST_Utterance::sub_utterance(EST_Item *i) { extra_sub_utterance(*this,i); } static void merge_tree(EST_Relation *urel, EST_Relation *rel, EST_Item *uroot, EST_Item *root, EST_Features &items, EST_String feature) { EST_Item *n=0; merge_features(uroot->features(), root->features()); // copy horizontally if (root->next()!= NULL) { EST_Item *old = item(items.f(root->next()->S(feature),est_val(n))); EST_Item *new_root = old?uroot->insert_after(old):uroot->insert_after(); merge_tree(urel, rel, new_root, root->next(), items, feature); } // vertically if (root->down()!= NULL) { EST_Item *old = item(items.f(root->down()->S(feature),est_val(n))); EST_Item *new_root = old?uroot->insert_below(old):uroot->insert_below(); merge_tree(urel, rel, new_root, root->down(), items, feature); } } int utterance_merge(EST_Utterance &utt, EST_Utterance &extra, EST_String feature) { // Global merge. Uses the feature to determine which items correspond. // First build a table of existing contents. EST_Features items; EST_Features::Entries ri; for(ri.begin(utt.relations); ri; ri++) { EST_Relation *rel = relation(ri->v); for(EST_Item *i=rel->head(); i != NULL; i=i->next_item()) { EST_String id = i->S(feature); items.set_val(id,est_val(i)); } } EST_Features::Entries eri; for(eri.begin(extra.relations); eri; eri++) { EST_Relation *rel = relation(eri->v); EST_String rel_name = rel->name(); while (utt.relation_present(rel_name)) rel_name += "+"; EST_Relation *urel = utt.create_relation(rel_name); if (rel->head() != NULL) { EST_Item *n = 0; EST_Item *old = item(items.f(rel->head()->S(feature),est_val(n))); EST_Item *new_root = old?urel->append(old):urel->append(); merge_tree(urel, rel, new_root, rel->head(), items, feature); } } return TRUE; } int utterance_merge(EST_Utterance &utt, EST_Utterance &sub_utt, EST_Item *utt_root, EST_Item *sub_root) { // Joins sub_utt to utt at ling_item at, merging the root // of relname in sub_utt with ling_item at. All other relations // in sub_utt get their root's appended (not merged) with the // corresponding relations in utt (and created if necessary). EST_TKVL sisilist; EST_Item *rnode; EST_Relation *nrel; if (utt_root->relation_name() != sub_root->relation_name()) EST_error("utterance_merge: items not is same relation"); if ((utt_root == 0) || (sub_root == 0)) EST_error("utterance_merge: items are null"); // merge features but preserve root id EST_String root_id = utt_root->S("id"); merge_features(utt_root->features(), sub_root->features()); utt_root->set("id", root_id); // in case root item in sub is referenced elsewhere in the structure sisilist.add_item(sub_root->contents(),utt_root); copy_relation(utt_root,sub_root,sisilist); EST_Features::Entries r; for (r.begin(sub_utt.relations); r; r++) { EST_Relation *rr = ::relation(r->v); if (rr->name() != utt_root->relation_name()) { if (!utt.relation_present(rr->name())) nrel = utt.create_relation(rr->name()); else nrel = utt.relation(rr->name()); if (rr->head() != 0) { EST_Item *nn = map_ling_item(rr->head(),sisilist); rnode = nrel->append(nn); copy_relation(rnode,rr->head(),sisilist); } } } sisilist.remove_item(sub_root->contents()); clear_up_sisilist(sisilist); return TRUE; } static void copy_relation(EST_Item *to,EST_Item *from, EST_TKVL &slist) { // Construct next and down nodes of from, into to, mapping // stream_items through slist if (from->next()) copy_relation(to->insert_after(map_ling_item(from->next(),slist)), from->next(), slist); if (from->down()) copy_relation(to->insert_below(map_ling_item(from->down(),slist)), from->down(), slist); } static EST_Item *map_ling_item(EST_Item *si, EST_TKVL &s) { // If si is already in s return its map otherwise copy // si and add it to the list EST_Item *msi; EST_Item *def = 0; msi = s.val_def(si->contents(),def); if (msi == def) { // First time, so copy it and add to map list msi = new EST_Item(*si); msi->f_remove("id"); s.add_item(si->contents(),msi); } return msi; } static void clear_up_sisilist(EST_TKVL &s) { // The EST_Items in the value of this need to be freed, its // contents however will not be freed as they will be referenced // somewhere in the copied utterance for (EST_Litem *r=s.list.head(); r != 0; r=r->next()) delete s.list(r).v; } static EST_Item *mapped_parent(EST_Item *i,const EST_String &relname, EST_TKVL &s) { EST_Item *p; if ((p=parent(i,relname)) == 0) return 0; else if (s.present(p->contents())) return map_ling_item(p,s)->as_relation(relname); else return 0; } static void sub_utt_copy(EST_Utterance &sub,EST_Item *i, EST_TKVL &s) { if (s.present(i->contents())) return; else { EST_Item *np,*d; EST_Litem *r; EST_Item *ni = map_ling_item(i,s); for (r = i->relations().list.head(); r; r = r->next()) { EST_String relname = i->relations().list(r).k; if (!sub.relation_present(relname)) sub.create_relation(relname)->append(ni); else if ((np=mapped_parent(i,relname,s)) != 0) np->append_daughter(ni); else sub.relation(relname)->append(ni); // Do its daughters for (d = daughter1(i,relname); d ; d=d->next()) sub_utt_copy(sub,d,s); } } } void sub_utterance(EST_Utterance &sub,EST_Item *i) { // Extract i and all its relations, and daughters ... to build // a new utterance in sub. EST_TKVL sisilist; sub.clear(); sub_utt_copy(sub,i,sisilist); clear_up_sisilist(sisilist); } EST_read_status EST_Utterance::load(const EST_String &filename) { EST_TokenStream ts; EST_read_status v=format_ok; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "load_utt: can't open utterance input file " << filename << endl; return misc_read_error; } v = load(ts); if (v == read_ok) f.set("filename", filename); ts.close(); return v; } EST_read_status EST_Utterance::load(EST_TokenStream &ts) { EST_read_status stat=read_error; int pos = ts.tell(); int max_id; init(); // we're committed to reading something so clear utterance for(int n=0; n< EST_UtteranceFile::map.n() ; n++) { EST_UtteranceFileType t = EST_UtteranceFile::map.token(n); if (t == uff_none) continue; EST_UtteranceFile::Info *info = &(EST_UtteranceFile::map.info(t)); if (! info->recognise) continue; EST_UtteranceFile::Load_TokenStream * l_fun = info->load; if (l_fun == NULL) continue; ts.seek(pos); stat = (*l_fun)(ts, *this, max_id); if (stat == read_ok) { // set_file_type(EST_UtteranceFile::map.value(t)); break; } } highest_id = max_id; return stat; } EST_write_status EST_Utterance::save(const EST_String &filename, const EST_String &type) const { EST_write_status v; ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; v = save(*outf,type); if (outf != &cout) delete outf; return v; } EST_write_status EST_Utterance::save(ostream &outf, const EST_String &type) const { EST_String save_type = (type == "") ? DEF_FILE_TYPE : type; EST_UtteranceFileType t = EST_UtteranceFile::map.token(save_type); if (t == uff_none) { cerr << "Utterance: unknown filetype in saving " << save_type << endl; return write_fail; } EST_UtteranceFile::Save_TokenStream * s_fun = EST_UtteranceFile::map.info(t).save; if (s_fun == NULL) { cerr << "Can't save utterances to files type " << save_type << endl; return write_fail; } return (*s_fun)(outf, *this); } void utt_2_flat_repr( const EST_Utterance &utt, EST_String &flat_repr ) { EST_Item *phrase = utt.relation("Phrase")->head(); for( ; phrase; phrase=phrase->next() ){ flat_repr += "<"; EST_Item *word = daughter1(phrase); for( ; word; word=word->next() ){ flat_repr += "{"; EST_Item *syllable = daughter1(word, "SylStructure"); for( ; syllable; syllable=syllable->next() ){ flat_repr += EST_String::cat( "(", syllable->S("stress") ); EST_Item *phone = daughter1(syllable); for( ; phone; phone=phone->next() ) flat_repr += EST_String::cat( " ", phone->S("name"), " " ); flat_repr += ")"; } flat_repr += "}"; } flat_repr += EST_String::cat( "> _", phrase->S("name"), " " ); } } speech_tools/ling_class/item_feats.cc0000644000076400007640000001302510330403606016422 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : June 1998 */ /*-----------------------------------------------------------------------*/ /* Support for feature functions for EST_Items */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_THash.h" #include "ling_class/EST_Item.h" #include "ling_class/EST_Item_Content.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_FeatureFunctionPackage.h" #include "EST_FeatureFunctionContext.h" const char *error_name(EST_Item_featfunc f) { (void)f; return "<>"; } const EST_Item_featfunc get_featfunc(const EST_String &name,int must) { const EST_Item_featfunc f = EST_FeatureFunctionContext::global->get_featfunc(name, must); return f; } void register_featfunc(const EST_String &name, const EST_Item_featfunc func) { if (EST_FeatureFunctionContext::global->get_featfunc("standard", name,0) != 0) cerr << "item featfunc \"" << name << "\" redefined definition" << endl; EST_FeatureFunctionPackage *package = EST_FeatureFunctionContext::global->get_package("standard"); package->register_func(name,func); } EST_String get_featname(const EST_Item_featfunc func) { int found; EST_String name = EST_FeatureFunctionContext::global->get_featfunc_name(func, found); if (!found) EST_error("featfunc %p has no name", func); return name; } void EST_register_feature_function_package(const char *name, void (*init_fn)(EST_FeatureFunctionPackage &p)) { EST_FeatureFunctionPackage *package = new EST_FeatureFunctionPackage(name, 20); EST_FeatureFunctionContext::global->add_package(package); (*init_fn)(*package); } /* EST_Item_featfuncs may be used in EST_Vals */ /* EST_Item_featfuncs aren't a class so we can't use the standard */ /* registration procedure and have to explicitly write it */ val_type val_type_featfunc = "featfunc"; const EST_Item_featfunc featfunc(const EST_Val &v) { if (v.type() == val_type_featfunc) return (const EST_Item_featfunc)v.internal_ptr(); else EST_error("val not of type val_type_featfunc"); return NULL; } void val_delete_featfunc(void *v) { /* Function pointers can't be freed */ (void)v; } void val_copy_featfunc(void *v1,void *v2) { v1 = v2; } EST_Val est_val(const EST_Item_featfunc f) { return EST_Val(val_type_featfunc,(void *)f,val_delete_featfunc); } #if 0 /* An example only */ EST_Val start_time(EST_Item *s) { EST_Relation *r = s->relation(); if (s == 0) return 0.0; else if ((r == 0) || (r->f("timing-style") != "segment")) return s->f("start"); else { // Its to be derived. EST_String asrel = r->f("start-from"); EST_Item *fl = s->first_leaf(); if ((asrel == "0") || (asrel == s->relation_name())) { if (prev(s)) return prev(fl)->f("end"); else return 0.0; } else return start_time(fl->as_relation(asrel)); } } #endif speech_tools/ling_class/apml.cc0000644000076400007640000002647210156047160015252 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 2002 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Rob Clark (robert@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Code to read APML format XML as utterances. */ /* */ /*************************************************************************/ #include #include #include "EST_THash.h" #include "EST_error.h" #include "apml.h" #include "rxp/XML_Parser.h" static EST_Regex simpleIDRegex(".*#id(w\\([0-9]+\\))"); static EST_Regex rangeIDRegex(".*#id(w\\([0-9]+\\)).*id(w\\([0-9]+\\))"); static EST_Regex RXpunc("[\\.,\\?\\!\"]+"); class Parse_State { public: int depth; int maxid; EST_Utterance *utt; EST_Relation *tokens; EST_Relation *perf; EST_Relation *com; EST_Relation *semstruct; EST_Relation *emphasis; EST_Relation *boundary; EST_Relation *pause; EST_Item *parent; EST_Item *pending; EST_Item *last_token; }; class Apml_Parser_Class : public XML_Parser_Class { protected: virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); }; static void print_attributes(XML_Attribute_List &attributes) { XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) printf(" %s='%s'", (const char *)them->k, (const char *)them->v); } EST_read_status apml_read(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id) { (void)max_id; (void)print_attributes; // just to shut -Wall up. Apml_Parser_Class pclass; Parse_State state; u.clear(); state.utt=&u; XML_Parser *parser = pclass.make_parser(file, name, &state); parser->track_context(TRUE); CATCH_ERRORS() return read_format_error; parser->go(); END_CATCH_ERRORS(); return read_ok; } /** Now we define the callbacks. */ void Apml_Parser_Class::document_open(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; state->maxid=0; state->depth=1; state->parent=NULL; state->pending=NULL; state->last_token=NULL; // create relations: state->perf = state->utt->create_relation("Perfomative"); state->com = state->utt->create_relation("Communicative"); state->tokens = state->utt->create_relation("Token"); state->semstruct = state->utt->create_relation("SemStructure"); state->emphasis = state->utt->create_relation("Emphasis"); state->boundary = state->utt->create_relation("Boundary"); state->pause = state->utt->create_relation("Pause"); } void Apml_Parser_Class::document_close(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; } void Apml_Parser_Class::element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; //cout << " In element_open: " << name << "\n"; if (strcmp(name, "turnallocation")==0) { // currently ignore return; } if (strcmp(name, "apml")==0) return; // ignore state->depth++; if( strcmp(name, "performative")==0 || strcmp(name, "rheme")==0 || strcmp(name, "theme")==0 || strcmp(name, "emphasis")==0 || strcmp(name, "boundary")==0 || strcmp(name, "pause")==0) { // create new item content EST_Item_Content *cont = new EST_Item_Content(); cont->set_name(name); XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) { EST_String k = them->k; EST_String v = them->v; cont->f.set(k,v); } EST_Item *item; if( strcmp(name, "emphasis")==0 ) { item = state->emphasis->append(); state->pending = item; } else if(strcmp(name, "boundary")==0 ) { item = state->boundary->append(); if(state->last_token) item->append_daughter(state->last_token); } else if(strcmp(name, "pause")==0 ) { item = state->pause->append(); if(state->last_token) item->append_daughter(state->last_token); } else { if (state->parent == NULL) item = state->semstruct->append(); else item = state->parent->append_daughter(); state->parent=item; } item->set_contents(cont); } else EST_warning("APML Parser: unknown element %s", name); } void Apml_Parser_Class::element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; element_open(c, p, data, name, attributes); element_close(c, p, data, name); } void Apml_Parser_Class::element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) { (void)c; (void)p; (void)name; Parse_State *state = (Parse_State *)data; if ( strcmp(name, "emphasis")==0 || strcmp(name, "boundary")==0 || strcmp(name, "pause")==0 ) { state->depth--; state->pending=NULL; } if (strcmp(name, "performative")==0 || strcmp(name, "theme")==0 || strcmp(name, "rheme")==0) { state->depth--; state->pending = NULL; state->parent=state->parent->up(); } } void Apml_Parser_Class::pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; Parse_State *state = (Parse_State *)data; EST_String strings[255]; split(chars,strings,255,RXwhite); // for(int cc=0 ; cc < 20 ; ++cc) // cout << cc << ": \"" << strings[cc] << "\" (" << strings[cc].length() << ")\n"; int s=0; while( s < 1 || strings[s].length() > 0 ) { if(strings[s].length() > 0 ) { // Just Punctuation if(strings[s].matches(RXpunc)) { state->last_token->set("punc",strings[s]); } // Text and possibly punc else { EST_Item_Content *cont = new EST_Item_Content(); EST_Item *item; if (state->parent == NULL) item = state->semstruct->append(); else item = state->parent->append_daughter(); item->set_contents(cont); // strip pre-punc here. int i = strings[s].index(RXpunc); EST_String ps = strings[s].at(RXpunc); EST_String intermediate; if( ps.length() > 0 && i == 0) { cout << "Got pre punc: " << ps << endl; intermediate = strings[s].after(RXpunc); // cont->set_name(strings[s].before(RXpunc)); item->set("prepunctuation",ps); } else { intermediate = strings[s]; item->set("prepunctuation",""); } // now strip punc ps = intermediate.at(RXpunc); if( ps.length() > 0 ) { cout << "Got punc: " << ps << endl; cont->set_name(intermediate.before(RXpunc)); item->set("punc",ps); } else { cont->set_name(intermediate); item->set("punc",""); } state->tokens->append(item); state->last_token = item; if(state->pending) { state->pending->append_daughter(item); } // if (state->parent != NULL && p.context(0) == "w") // state->parent->set(EST_String("token"), chars); //cout << " got token: " << item->name() << "\n"; } } ++s; } } void Apml_Parser_Class::cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; (void)data; (void)chars; // Parse_State *state = (Parse_State *)data; // printf("APML XML Parser [cdata[%s]] %d\n", chars, state->depth); } void Apml_Parser_Class::processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("APML XML Parser [proc[%s]] %d\n", instruction, state->depth); } void Apml_Parser_Class::error(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; // Parse_State *state = (Parse_State *)data; EST_error("APML Parser %s", get_error(p)); est_error_throw(); } speech_tools/ling_class/solexml.cc0000644000076400007640000002512111465017155015777 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Code to reas SOLE format XML as utterances. */ /* */ /*************************************************************************/ #include #include #include "EST_THash.h" #include "EST_error.h" #include "solexml.h" #include "rxp/XML_Parser.h" static EST_Regex simpleIDRegex(".*#id(w\\([0-9]+\\))"); static EST_Regex rangeIDRegex(".*#id(w\\([0-9]+\\)).*id(w\\([0-9]+\\))"); class Parse_State { public: int depth; EST_String relName; EST_Utterance *utt; EST_Relation *rel; EST_Item *parent; EST_Item *current; EST_THash contents; Parse_State() : contents(100) {} }; class Sole_Parser_Class : public XML_Parser_Class { protected: virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); }; static void print_attributes(XML_Attribute_List &attributes) { XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) printf(" %s='%s'", (const char *)them->k, (const char *)them->v); } EST_read_status solexml_read(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id) { (void)max_id; (void)print_attributes; // just to shut -Wall up. Sole_Parser_Class pclass; Parse_State state; u.clear(); state.utt=&u; XML_Parser *parser = pclass.make_parser(file, name, &state); parser->track_context(TRUE); CATCH_ERRORS() return read_format_error; parser->go(); END_CATCH_ERRORS(); return read_ok; } static void ensure_relation(Parse_State *state) { if (state->rel==NULL) { state->rel = state->utt->create_relation(state->relName); } } static EST_Item_Content *get_contents(Parse_State *state, EST_String id) { EST_Item_Content *c = state->contents.val(id); if (c==NULL) { c = new EST_Item_Content(); state->contents.add_item(id, c); } return c; } static void extract_ids(XML_Attribute_List &attributes, EST_TList &ids) { EST_String val; static int count; if (attributes.present("id")) { val = attributes.val("id"); ids.append(val); } else if (attributes.present("href")) { val = attributes.val("href"); int starts[EST_Regex_max_subexpressions]; int ends[EST_Regex_max_subexpressions]; if (val.matches(simpleIDRegex, 0, starts, ends)) { EST_String n = val.at(starts[1], ends[1]-starts[1]); ids.append("w" + n); } else if (val.matches(rangeIDRegex, 0, starts, ends)) { int n1 = atoi(val.at(starts[1], ends[1]-starts[1])); int n2 = atoi(val.at(starts[2], ends[2]-starts[2])); for(int i=n1; i<=n2; i++) { char buf[100]; sprintf(buf, "w%d", i); ids.append(buf); } } else EST_warning("element with bad ID or HREF '%s'", (const char *)val); } else { char buf[100]; sprintf(buf, "n%d", ++count); ids.append(buf); return; } } /** Now we define the callbacks. */ void Sole_Parser_Class::document_open(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; state->depth=1; state->rel=NULL; state->parent=NULL; state->current=NULL; } void Sole_Parser_Class::document_close(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; } void Sole_Parser_Class::element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; state->depth++; if (strcmp(name, "solexml")==0) { state->relName=attributes.val("relation"); printf("start solexml relation=%s\n", (const char *)state->relName); return; } else if (strcmp(name, "text-elem")==0) { // ignore these return; } ensure_relation(state); if (strcmp(name, "anaphora-elem")==0 || strcmp(name, "wordlist")==0 || strcmp(name, "w")==0) { EST_TList ids; extract_ids(attributes, ids); EST_Litem *idp = ids.head(); bool first=TRUE; for(; idp!= NULL; idp = idp->next()) { EST_String id = ids(idp); if (id==EST_String::Empty) XML_Parser_Class::error(c, p, data, EST_String("Element With No Id")); if (first) first=FALSE; else { state->current = state->parent; state->parent=state->parent->up(); } EST_Item_Content *cont = get_contents(state, id); cont->set_name(id); XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) { EST_String k = them->k; EST_String v = them->v; cont->f.set(k,v); } EST_Item *item; if (state->current == NULL) if (state->parent == NULL) item = state->rel->append(); else item = state->parent->insert_below(); else item = state->current->insert_after(); item->set_contents(cont); state->current=NULL; state->parent=item; } } else EST_warning("SOLE XML Parser: unknown element %s", name); } void Sole_Parser_Class::element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; if (strcmp(name, "language")==0) { state->utt->f.set("language", attributes.val("name")); return; } element_open(c, p, data, name, attributes); element_close(c, p, data, name); } void Sole_Parser_Class::element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) { (void)c; (void)p; (void)name; Parse_State *state = (Parse_State *)data; if (strcmp(name, "anaphora-elem")==0 || strcmp(name, "wordlist")==0 || strcmp(name, "w")==0) { state->depth--; state->current = state->parent; state->parent=state->parent->up();; } } void Sole_Parser_Class::pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; Parse_State *state = (Parse_State *)data; if (state->parent != NULL && p.context(0) == "w") state->parent->set(EST_String("word"), chars); // printf("SOLE XML Parser [pcdata[%s]] %d\n", chars, state->depth); } void Sole_Parser_Class::cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; (void)data; (void)chars; // Parse_State *state = (Parse_State *)data; // printf("SOLE XML Parser [cdata[%s]] %d\n", chars, state->depth); } void Sole_Parser_Class::processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("SOLE XML Parser [proc[%s]] %d\n", instruction, state->depth); } void Sole_Parser_Class::error(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)data; // Parse_State *state = (Parse_State *)data; EST_error("SOLE XML Parser %s", get_error(p)); est_error_throw(); } speech_tools/ling_class/EST_FeatureFunctionPackage.cc0000644000076400007640000001156410045431120021373 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Represents a set of feature functions. */ /* */ /*************************************************************************/ #include "ling_class/EST_Item.h" #include "ling_class/EST_FeatureFunctionPackage.h" static EST_Val Dummy_Func(EST_Item *) { return EST_Val(); } static struct EST_FeatureFunctionPackage::Entry Dummy_Entry = { Dummy_Func }; template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_FeatureFunctionPackage::Entry EST_THash::Dummy_Value = Dummy_Entry; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash_T(EST_FeatureFunctionPackage::Entry, EST_FeatureFunctionPackage_Entry) #endif int operator == (const EST_FeatureFunctionPackage::Entry &e1, const EST_FeatureFunctionPackage::Entry &e2) { return e1.func == e2.func; } ostream &operator << (ostream &s, EST_FeatureFunctionPackage::Entry &e) { (void)e; return s << "<>"; } EST_FeatureFunctionPackage::EST_FeatureFunctionPackage(const EST_String name, int n) : p_name(name), p_entries(n) { #ifdef EST_DEBUGGING cerr << "initialise functionon package " << p_name << "\n"; #endif } EST_FeatureFunctionPackage::EST_FeatureFunctionPackage(const char *name, int n) : p_name(name), p_entries(n) { } void EST_FeatureFunctionPackage::register_func(const EST_String &name, const EST_Item_featfunc func) { #ifdef EST_DEBUGGING cerr << "register " << p_name << "::" << name << "\n"; #endif if (p_entries.present(name)) EST_warning("Feature function %s::%s redefined", (const char *)p_name, (const char *)name); Entry e; e.func=func; p_entries.add_item(name, e); } const EST_FeatureFunctionPackage::Entry &EST_FeatureFunctionPackage::lookup(const EST_String &name, int &found) const { found=0; return p_entries.val(name, found); } const EST_String EST_FeatureFunctionPackage::lookup(const EST_Item_featfunc func, int &found) const { EST_TStringHash::Entries p; for(p.begin(p_entries); p; ++p) if (p->v.func == func) { found=1; return p->k; } found=0; return ""; } speech_tools/ling_class/EST_FeatureFunctionContext.cc0000644000076400007640000001565610045516127021505 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* A complete lookup table for feature functions. */ /* */ /*************************************************************************/ #include "ling_class/EST_Item.h" #include "ling_class/EST_FeatureFunctionPackage.h" #include "EST_FeatureFunctionContext.h" #include "ling_class_init.h" void EST_FeatureFunctionContext::class_init(void) { ling_class_init::use(); global = new EST_FeatureFunctionContext(); } EST_FeatureFunctionContext *EST_FeatureFunctionContext::global; const EST_String EST_FeatureFunctionContext::separator = "+"; EST_FeatureFunctionContext::EST_FeatureFunctionContext(void) : cache(100) { } EST_FeatureFunctionContext::~EST_FeatureFunctionContext(void) { EST_TList::RwEntries p; for(p.begin(packages); p; ++p) { // Only the global list owns it's packages. if (this == global) delete *p; *p = NULL; } } EST_FeatureFunctionPackage *EST_FeatureFunctionContext::get_package(const EST_String name) const { EST_TList::Entries p; for(p.begin(packages); p; ++p) { EST_FeatureFunctionPackage *package = *p; if (package->name() == name) return package; } return NULL; } EST_String EST_FeatureFunctionContext::get_featfunc_name(const EST_Item_featfunc func, int &found) const { EST_TList::Entries p; found=0; for(p.begin(packages); p; ++p) { EST_FeatureFunctionPackage *package = *p; EST_String name = package->lookup(func, found); if (found) { return EST_String::cat(package->name(), separator, name); } } found=0; return ""; } void EST_FeatureFunctionContext::clear_cache(void) { cache.clear(); } void EST_FeatureFunctionContext::add_package(const EST_String name) { if (this == global) EST_error("Attempt to add package '%s' to global list", (const char *)name ); EST_FeatureFunctionPackage *package = global->get_package(name); if (package == NULL) EST_error("package '%s' not loaded", (const char *)name ); packages.prepend(package); clear_cache(); } void EST_FeatureFunctionContext::add_package(EST_FeatureFunctionPackage *package) { packages.prepend(package); clear_cache(); } bool EST_FeatureFunctionContext::package_included(const EST_String name) const { return get_package(name) != NULL; } const EST_Item_featfunc EST_FeatureFunctionContext::get_featfunc(const EST_String name, int must) { int pos, len; if (cache.present(name)) return cache.val(name); if ((pos= name.search(separator, len, 0))>=0) { const EST_Item_featfunc func2 = get_featfunc(name.before(pos,separator.length()), name.after(pos,separator.length()), must); if (func2 != NULL) cache.add_item(name, func2); return func2; } // No package name so look up directly. EST_TList::Entries p; for(p.begin(packages); p; ++p) { EST_FeatureFunctionPackage *package = *p; int found; const EST_FeatureFunctionPackage::Entry &ent = package->lookup(name, found); if (found) { cache.add_item(name, ent.func); return ent.func; } } if (must) EST_error("No feature function '%s'", (const char *)name); return NULL; } const EST_Item_featfunc EST_FeatureFunctionContext::get_featfunc(const EST_String pname, const EST_String name, int must) { EST_FeatureFunctionPackage *package = get_package(pname); int found; const EST_FeatureFunctionPackage::Entry &ent = package->lookup(name, found); if (found) return ent.func; if (must) EST_error("No feature function '%s'", (const char *)name); return NULL; } static EST_Val Dummy_Func(EST_Item *) { return EST_Val(); } template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_Item_featfunc EST_THash::Dummy_Value = Dummy_Func; Declare_TList_T(EST_FeatureFunctionPackage *, EST_FeatureFunctionPackageP) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(EST_Item_featfunc) #include "../base_class/EST_TList.cc" Instantiate_TList_T(EST_FeatureFunctionPackage *, EST_FeatureFunctionPackageP) #endif speech_tools/ling_class/EST_UtteranceFile.h0000644000076400007640000001040707611253404017421 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_UTTERANCEFILE_H__ #define __EST_UTTERANCEFILE_H__ #include "EST_TNamedEnum.h" #include "ling_class/EST_Utterance.h" #include "EST_string_aux.h" #include "EST_FileType.h" #include "EST_Token.h" /** Table of different file formats for loading an saving utterances. * * @author Richard Caley * @version $Id: EST_UtteranceFile.h,v 1.3 2003/01/15 11:13:50 robert Exp $ */ typedef enum EST_UtteranceFileType{ uff_none, uff_est, uff_est_ascii=uff_est, uff_xlabel, uff_genxml, uff_apml, } EST_UtteranceFileType; class EST_UtteranceFile { public: // We have to use #defines for what should be done with just // typedefs because Sun CC thinks you shouldn't be allowed to // declare a member function via a typedef. #define LoadUtterance_TokenStreamArgs EST_TokenStream &ts, \ EST_Utterance &u, \ int &max_id #define SaveUtterance_TokenStreamArgs ostream &outf,const \ EST_Utterance &utt typedef EST_read_status Load_TokenStream(LoadUtterance_TokenStreamArgs); typedef EST_write_status Save_TokenStream(SaveUtterance_TokenStreamArgs); typedef struct Info { bool recognise; Load_TokenStream *load; Save_TokenStream *save; const char *description; } Info; static EST_write_status save_est_ascii(SaveUtterance_TokenStreamArgs); static EST_read_status load_est_ascii(LoadUtterance_TokenStreamArgs); static EST_write_status save_xlabel(SaveUtterance_TokenStreamArgs); static EST_read_status load_xlabel(LoadUtterance_TokenStreamArgs); static EST_write_status save_genxml(SaveUtterance_TokenStreamArgs); static EST_read_status load_genxml(LoadUtterance_TokenStreamArgs); static EST_read_status load_apml(LoadUtterance_TokenStreamArgs); static EST_TNamedEnumI map; static EST_String options_supported(void); static EST_String options_short(void); }; #endif speech_tools/ling_class/genxml.h0000644000076400007640000000627607262616577015477 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name genxml.h * * Privare header interfacing gen file format. * * @author Richard Caley * @version $Id: genxml.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ #ifndef __GENXML_H__ #define __GENXML_H__ #include #include "ling_class/EST_Utterance.h" #include "rxp/XML_Parser.h" #include "EST_types.h" class EST_GenXML { public: static EST_read_status read_xml(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id); static void register_id(const EST_String pattern, const EST_String result); static void registered_ids(EST_StrList &list); static InputSource try_and_open(Entity ent); private: static XML_Parser_Class *pclass; protected: static void class_init(void); friend class ling_class_init; }; #endif //@} speech_tools/ling_class/apml.h0000644000076400007640000000534007611241156015106 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name apml.h * * Privare header interfacing apml file format. * * * Rob Clark July 2002 */ //@{ #ifndef __APML_H__ #define __APML_H__ #include #include "ling_class/EST_Utterance.h" EST_read_status apml_read(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id); #endif // __APML_H__ //@} speech_tools/ling_class/solexml.h0000644000076400007640000000547007262616577015663 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name solexml.h * * Privare header interfacing sole file format. * * @author Richard Caley * @version $Id: solexml.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ #ifndef __SOLEXML_H__ #define __SOLEXML_H__ #include #include "ling_class/EST_Utterance.h" EST_read_status solexml_read(FILE *file, const EST_String &name, EST_Utterance &u, int &max_id); #endif //@} speech_tools/ling_class/relation_io.h0000644000076400007640000000727507262616577016511 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor (updated by awb) */ /* Date : February 1999 */ /*-----------------------------------------------------------------------*/ /* Relation i/o labels etc */ /* */ /*=======================================================================*/ #ifndef __RELATION_IO_H__ #define __RELATION_IO_H__ #include "EST_String.h" #include "EST_Token.h" #include "EST_rw_status.h" #include "ling_class/EST_Relation.h" EST_read_status load_esps_label(EST_TokenStream &ts,EST_Relation &rel); EST_read_status load_ogi_label(EST_TokenStream &ts, EST_Relation &s); EST_read_status load_words_label(EST_TokenStream &ts, EST_Relation &s); EST_read_status load_sample_label(EST_TokenStream &ts, EST_Relation &s, int sample=0); EST_write_status save_esps_label(const EST_String &filename, const EST_Relation &s, bool evaluate_ff); EST_write_status save_htk_label(const EST_String &filename, const EST_Relation &a); EST_write_status save_esps_label(ostream *outf, const EST_Relation &s, bool evaluate_ff); EST_write_status save_htk_label(ostream *outf, const EST_Relation &a); #endif /* __RELATION_IO.H__ */ speech_tools/ling_class/ling_class_init.h0000644000076400007640000000567207262616577017345 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /**@name ling_class_init.h * * Include this to force ling_class initialisation. * * @author Richard Caley * @version $Id: ling_class_init.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ //@{ #ifndef __LING_CLASS_INIT_H__ #define __LING_CLASS_INIT_H__ /* This is a trivial class. It's only purpose is to * have it's default creator called once. That * creator initialises the ling class code. */ class ling_class_init { public: static void use(void); protected: static ling_class_init init; ling_class_init(void); }; #endif //@} speech_tools/ling_class/EST_FeatureFunctionContext.h0000644000076400007640000001011710045556421021333 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_FEATUREFUNCTIONCONTEXT_H__ #define __EST_FEATUREFUNCTIONCONTEXT_H__ /** A feature function context is the interface through which feature * functions are looked up. It is basically a list of feature function * packages. * * @author Richard Caley * @version $Id: EST_FeatureFunctionContext.h,v 1.3 2004/05/04 00:00:17 awb Exp $ */ #include "ling_class/EST_FeatureFunctionPackage.h" class ling_class_init; class EST_FeatureFunctionContext { private: EST_TList packages; EST_TStringHash cache; protected: static EST_FeatureFunctionContext *global; void add_package(EST_FeatureFunctionPackage *package); EST_FeatureFunctionPackage *get_package(const EST_String name) const; EST_String get_featfunc_name(const EST_Item_featfunc func, int &found) const; public: static const EST_String separator; EST_FeatureFunctionContext(void); ~EST_FeatureFunctionContext(void); void clear_cache(void); void add_package(const EST_String name); bool package_included(const EST_String name) const; const EST_Item_featfunc get_featfunc(const EST_String name, int must=0); const EST_Item_featfunc get_featfunc(const EST_String package, const EST_String name, int must=0); protected: static void class_init(void); friend class ling_class_init; friend void EST_register_feature_function_package(const char *name, void (*init_fn)(EST_FeatureFunctionPackage &p)); friend void register_featfunc(const EST_String &name, const EST_Item_featfunc func); friend const EST_Item_featfunc get_featfunc(const EST_String &name,int must); friend EST_String get_featname(const EST_Item_featfunc func); }; #endif speech_tools/ling_class/Makefile0000644000076400007640000000733710005503436015445 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Linguistic Class Makefile ## ##=======================================================================## TOP=.. DIRNAME=ling_class LOCAL_DEFAULT_LIBRARY = estbase H = EST_UtteranceFile.h genxml.h apml.h solexml.h relation_io.h ling_class_init.h \ EST_FeatureFunctionContext.h TSRCS = ling_t.cc EST_Utterance.cc \ item_feats.cc apml.cc solexml.cc EST_FeatureFunctionPackage.cc \ EST_FeatureFunctionContext.cc LOCAL_TSRCS = EST_UtteranceFile.cc genxml.cc EST_utterance_aux.cc ling_class_init.cc CPPSRCS = EST_Item.cc EST_Item_Content.cc item_aux.cc \ EST_relation_aux.cc EST_relation_track.cc \ relation_io.cc EST_relation_compare.cc \ standard_feature_functions.cc EST_Relation_mls.cc \ EST_item_aux.cc EST_item_content_aux.cc EST_Relation.cc \ $(LOCAL_TSRCS) $(TSRCS) SRCS = $(CPPSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) $(H) Makefile VC_LOCAL_DEFINES = /DESTLIBDIRC=$(EST_HOME)/lib /DINCLUDE_XML_FORMATS=1 ALL = .buildlib include $(TOP)/config/common_make_rules ifdef INCLUDE_RXP UTTERANCEFILEDEFS += -DINCLUDE_XML_FORMATS endif ling_class_init.o EST_utterance_aux.o EST_UtteranceFile.o: %.o : %.cc $(strip $(CXX_COMMAND_TEMPLATES) $(UTTERANCEFILEDEFS) $< ) genxml.o: genxml.cc $(strip $(CXX_COMMAND_TEMPLATES) -DESTLIBDIRC='$(EST_HOME)/lib' $< ) speech_tools/speech_class/EST_Wave.cc0000644000076400007640000003561110155343272016251 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* EST_Wave Class source file */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_cutils.h" #include "EST_Wave.h" #include "EST_wave_utils.h" #include "EST_wave_aux.h" #include "EST_TNamedEnum.h" #include "EST_WaveFile.h" #include "EST_Track.h" #include "waveP.h" const EST_String DEF_FILE_TYPE = "riff"; const EST_String DEF_SAMPLE_TYPE = "short"; const int EST_Wave::default_sample_rate=16000; EST_Wave::EST_Wave() { default_vals(); } EST_Wave::EST_Wave(const EST_Wave &w) { default_vals(); copy(w); } EST_Wave::EST_Wave(int n, int c, int sr) { default_vals(n,c); set_sample_rate(sr); } EST_Wave::EST_Wave(int samps, int chans, short *memory, int offset, int sample_rate, int free_when_destroyed) { default_vals(); p_values.set_memory(memory, offset, samps, chans, free_when_destroyed); set_sample_rate(sample_rate); } void EST_Wave::default_vals(int n, int c) { // real defaults p_values.resize(n,c); p_sample_rate = default_sample_rate; init_features(); } void EST_Wave::free_wave() { if (!p_values.p_sub_matrix) p_values.resize(0,0); clear_features(); } EST_Wave::~EST_Wave() { free_wave(); } void EST_Wave::copy_setup(const EST_Wave &w) { p_sample_rate = w.p_sample_rate; copy_features(w); } void EST_Wave::copy_data(const EST_Wave &w) { p_values.copy(w.p_values); } void EST_Wave::copy(const EST_Wave &w) { copy_setup(w); copy_data(w); } short &EST_Wave::a(int i, int channel) { if (i<0 || i>= num_samples()) { cerr << "Attempt to access sample " << i << " of a " << num_samples() << " sample wave.\n"; if (num_samples()>0) return *(p_values.error_return); } if (channel<0 || channel>= num_channels()) { cerr << "Attempt to access channel " << channel << " of a " << num_channels() << " channel wave.\n"; if (num_samples()>0) return *(p_values.error_return); } return p_values.a_no_check(i,channel); } short EST_Wave::a(int i, int channel) const { return ((EST_Wave *)this)->a(i,channel); } short &EST_Wave::a_safe(int i, int channel) { static short out_of_bound_value = 0; if ((i < 0) || (i >= num_samples())) { // need to give them something but they might have changed it // so reinitialise it to 0 first out_of_bound_value = 0; return out_of_bound_value; } else return a_no_check(i,channel); } void EST_Wave::fill(short v, int channel) { if (channel == EST_ALL) { if (v == 0) // this is *much* more efficient and common memset(values().memory(),0,num_samples()*num_channels()*2); else p_values.fill(v); } else for (int i = 0; i < num_samples(); ++i) p_values.a_no_check(i,channel) = v; } EST_read_status EST_Wave::load(const EST_String filename, int offset, int length, int rate) { EST_read_status stat = read_error; EST_TokenStream ts; if ((ts.open(filename)) == -1) { cerr << "Wave load: can't open file \"" << filename << "\"" << endl; return stat; } stat = load(ts,offset,length,rate); ts.close(); return stat; } EST_read_status EST_Wave::load(EST_TokenStream &ts, int offset, int length, int rate) { EST_read_status stat = read_error; int pos = ts.tell(); for(int n=0; n< EST_WaveFile::map.n() ; n++) { EST_WaveFileType t = EST_WaveFile::map.token(n); if (t == wff_none) continue; EST_WaveFile::Info *info = &(EST_WaveFile::map.info(t)); if (! info->recognise) continue; EST_WaveFile::Load_TokenStream * l_fun =info->load; if (l_fun == NULL) continue; ts.seek(pos); stat = (*l_fun)(ts, *this, rate, st_short, EST_NATIVE_BO, 1, offset, length); if (stat == read_ok) { set_file_type(EST_WaveFile::map.value(t)); break; } else if (stat == read_error) break; } return stat; } EST_read_status EST_Wave::load(const EST_String filename, const EST_String type, int offset, int length, int rate) { EST_read_status stat = read_error; EST_TokenStream ts; if (filename == "-") ts.open(stdin,FALSE); else if ((ts.open(filename)) == -1) { cerr << "Wave load: can't open file \"" << filename << "\"" << endl; return stat; } stat = load(ts,type,offset,length,rate); ts.close(); return stat; } EST_read_status EST_Wave::load(EST_TokenStream &ts, const EST_String type, int offset, int length, int rate) { EST_WaveFileType t = EST_WaveFile::map.token(type); if (t == wff_none) { cerr << "Unknown Wave file type " << type << endl; return read_error; } EST_WaveFile::Load_TokenStream * l_fun = EST_WaveFile::map.info(t).load; if (l_fun == NULL) { cerr << "Can't load waves to files type " << type << endl; return read_error; } set_file_type(EST_WaveFile::map.value(t)); return (*l_fun)(ts, *this, rate, st_short, EST_NATIVE_BO, 1, offset, length); } EST_read_status EST_Wave::load_file(const EST_String filename, const EST_String type, int sample_rate, const EST_String stype, int bov, int nc, int offset, int length) { EST_read_status stat = read_error; EST_TokenStream ts; if (filename == "-") ts.open(stdin,FALSE); else if ((ts.open(filename)) == -1) { cerr << "Wave load: can't open file \"" << filename << "\"" << endl; return stat; } stat = load_file(ts,type,sample_rate,stype,bov,nc,offset,length); ts.close(); return stat; } EST_read_status EST_Wave::load_file(EST_TokenStream &ts, const EST_String type, int sample_rate, const EST_String stype, int bov, int nc, int offset, int length) { EST_WaveFileType t = EST_WaveFile::map.token(type); EST_sample_type_t values_type = EST_sample_type_map.token(stype); if (t == wff_none) { cerr << "Unknown Wave file type " << type << endl; return read_error; } EST_WaveFile::Load_TokenStream * l_fun = EST_WaveFile::map.info(t).load; if (l_fun == NULL) { cerr << "Can't load waves to files type " << type << endl; return read_error; } return (*l_fun)(ts, *this, sample_rate, values_type, bov, nc, offset, length); } void EST_Wave::sub_wave(EST_Wave &sw, int offset, int num, int start_c, int nchan) { if (num == EST_ALL) num = num_samples()-offset; if (nchan == EST_ALL) nchan = num_channels()-start_c; p_values.sub_matrix(sw.p_values, offset, num, start_c, nchan); sw.set_sample_rate(sample_rate()); } EST_write_status EST_Wave::save(const EST_String filename, const EST_String type) { FILE *fp; if (filename == "-") fp = stdout; else if ((fp = fopen(filename,"wb")) == NULL) { cerr << "Wave save: can't open output file \"" << filename << "\"" << endl; return write_fail; } EST_write_status r = save(fp,type); if (fp != stdout) fclose(fp); return r; } EST_write_status EST_Wave::save(FILE *fp, const EST_String type) { EST_String save_type = (type == "") ? DEF_FILE_TYPE : type; EST_WaveFileType t = EST_WaveFile::map.token(save_type); if (t == wff_none) { cerr << "Wave: unknown filetype in saving " << save_type << endl; return write_fail; } EST_WaveFile::Save_TokenStream * s_fun = EST_WaveFile::map.info(t).save; if (s_fun == NULL) { cerr << "Can't save waves to files type " << save_type << endl; return write_fail; } return (*s_fun)(fp, *this, st_short, EST_NATIVE_BO); } EST_write_status EST_Wave::save_file(const EST_String filename, EST_String ftype, EST_String stype, int obo) { FILE *fp; if (filename == "-") fp = stdout; else if ((fp = fopen(filename,"wb")) == NULL) { cerr << "Wave save: can't open output file \"" << filename << "\"" << endl; return write_fail; } EST_write_status r = save_file(fp,ftype,stype,obo); if (fp != stdout) fclose(fp); return r; } EST_write_status EST_Wave::save_file(FILE *fp, EST_String ftype, EST_String stype, int obo) { EST_WaveFileType t = EST_WaveFile::map.token(ftype); EST_sample_type_t sample_type = EST_sample_type_map.token(stype); if (t == wff_none) { cerr << "Unknown Wave file type " << ftype << endl; return write_fail; } EST_WaveFile::Save_TokenStream * s_fun = EST_WaveFile::map.info(t).save; if (s_fun == NULL) { cerr << "Can't save waves to files type " << ftype << endl; return write_fail; } return (*s_fun)(fp, *this, sample_type, obo); } void EST_Wave::resample(int new_freq) { // Resample wave to new sample rate if (new_freq != p_sample_rate) { if (p_values.rateconv(p_sample_rate, new_freq) != 0) cerr << "rateconv: failed to convert from " << p_sample_rate << " to " << new_freq << "\n"; else set_sample_rate(new_freq); } } void EST_Wave::rescale(float gain, int normalize) { int ns; float factor = gain; if (normalize) { int max = 0; for (int i = 0; i < num_samples(); ++i) for (int j = 0; j < num_channels(); ++j) if (abs(a_no_check(i,j)) > max) max = abs(a_no_check(i,j)); if (fabs(max/32766.0-gain) < 0.001) return; /* already normalized */ else factor *= 32766.0/(float)max; } for (int i = 0; i < num_samples(); ++i) for (int j = 0; j < num_channels(); ++j) { ns = (int)(((float)a_no_check(i,j) * factor) + 0.5); if (ns < -32766) a_no_check(i,j)= -32766; else if (ns > 32766) a_no_check(i,j)= 32766; else a_no_check(i,j)= ns; } } void EST_Wave::rescale( const EST_Track &fc ) { int ns, start_sample, end_sample; float target1, target2, increment, factor; int fc_length = fc.length(); int _num_channels = num_channels(); cerr << ((int)(fc.t(fc_length-1) * p_sample_rate)) << endl; if( ((int)(fc.t(fc_length-1) * p_sample_rate)) > num_samples() ) EST_error( "Factor contour track exceeds waveform length (%d samples)", (fc.t(fc_length-1) * p_sample_rate) - num_samples() ); start_sample = static_cast( fc.t( 0 )*p_sample_rate ); target1 = fc.a(0,0); // could use separate channels for each waveform channel for ( int k = 1; k( fc.t( k )*p_sample_rate ); target2 = fc.a(k); increment = (target2-target1)/(end_sample-start_sample+1); factor = target1; for( int i=start_sample; i 32766) a_no_check(i,j)= 32766; else a_no_check(i,j)= ns; } start_sample = end_sample; target1 = target2; } } EST_Wave &EST_Wave::operator =(const EST_Wave &w) { copy(w); return *this; } EST_Wave &EST_Wave::operator +=(const EST_Wave &w) { EST_Wave w2; const EST_Wave *toadd = &w; if (w.num_channels() != num_channels()) { cerr << "Cannot concatenate waveforms with differing numbers of channels\n"; return *this; } if (p_sample_rate != w.sample_rate()) { w2 = w; w2.resample(p_sample_rate); toadd= &w2; } p_values.add_rows(toadd->p_values); return *this; } // add wave p_values to existing wave in parallel to create multi-channel wave. EST_Wave &EST_Wave::operator |=(const EST_Wave &wi) { int i, k; EST_Wave w = wi; // to allow resampling of const w.resample(p_sample_rate); // far too difficult otherwise int o_channels = num_channels(); int r_channels = num_channels()+w.num_channels(); int r_samples = Gof(num_samples(), w.num_samples()); resize(r_samples, r_channels); for (k = 0; k < w.num_channels(); ++k) for (i=0; i < w.num_samples(); i++) a(i,k+o_channels) += w.a(i, k); return *this; } ostream& operator << (ostream& p_values, const EST_Wave &sig) { for (int i = 0; i < sig.num_samples(); ++i) p_values << sig(i) << "\n"; return p_values; } int operator != (EST_Wave a, EST_Wave b) { (void)a; (void)b; return 1; } int operator == (EST_Wave a, EST_Wave b) { (void)a; (void)b; return 0; } speech_tools/speech_class/EST_track_aux.cc0000644000076400007640000007124011465017156017332 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : August 1995 */ /*-----------------------------------------------------------------------*/ /* EST_Track Auxiliary routines */ /* */ /*=======================================================================*/ #include #include #include "EST_cutils.h" #include "EST_simplestats.h" #include "EST_sort.h" #include "EST_Track.h" #include "EST_TrackFile.h" #include "EST_Option.h" #include "EST_track_aux.h" #include "EST_error.h" static inline int irint(float f) { return (int)(f+0.5); } static inline int irint(double f) { return (int)(f+0.5); } static inline int ifloor(float f) { return (int)(f); } float correlation(EST_Track &a, EST_Track &b, int cha, int chb); /* Allow EST_Track to be used in an EST_Val */ VAL_REGISTER_CLASS(track,EST_Track) static int sorttest(const void *a, const void *b) { // for use with qsort C library function. float *c = (float *)a; float *d = (float *)b; float res = (*c - *d); if (res == 0.0) return 0; return (res < 0.0) ? -1 : 1; } void track_smooth(EST_Track &c, float x, EST_String stype) { if (stype == "median") time_med_smooth(c, x); else time_mean_smooth(c, x); } void time_med_smooth(EST_Track &c, float x) { if (!c.equal_space()) { cerr << "Error: Time smoothing can only operate on fixed contours\n"; return; } // want to check for divide by zero if (c.shift() == 0.0) { cerr << "Error in smoothing: time spacing problem\n"; return; } int n = (int)(x / c.shift()); for (int i = 0; i < c.num_channels(); ++i) simple_med_smooth(c, n, i); } void time_mean_smooth(EST_Track &c, float x) { int j; EST_Track t; int n = (int)(x / c.shift()); for (j = 0; j < c.num_channels(); ++j) simple_mean_smooth(c, n, j); } void simple_med_smooth(EST_Track &c, int n, int channel) {// simple median smoother of order n // windows longer than twice the track length cause problems // here is one solution if(n > c.num_frames()) n=c.num_frames(); // and tiny windows don't work either // can't do median of 2 of fewer points if(n < 3) return; int i, j, h, k; float *a = new float[c.num_frames()]; float *m = new float[n]; h = n/2; // sort start using < n order smoothing for (i = 0; i < h; ++i) { k = (i * 2) + 1; for (j = 0; j < k; ++j) m[j] = c.a(j, channel); qsort(m, k, sizeof(float), sorttest); a[i] = m[i]; } // sort main section using n order smoothing for (i = h; i < c.num_frames() - h; ++i) { for (j = 0; j < n; ++j) m[j] = c.a(i - h + j, channel); qsort(m, n, sizeof(float), sorttest); a[i] = m[h]; } // sort end section using < n order smoothing for (; i < c.num_frames(); ++i) { k = ((c.num_frames() - i)* 2) -1; for (j = 0; j < k; ++j) m[j] = c.a(i - (k/2) + j, channel); qsort(m, k, sizeof(float), sorttest); a[i] = m[k/2]; } for (i = 0; i < c.num_frames(); ++i) c.a(i,channel) = a[i]; delete [] a; delete [] m; } void simple_mean_smooth(EST_Track &c, int n, int channel) { // simple mean smoother of order n int i, j, h, k=1; float *a = new float[c.num_frames()]; float sum; h = n/2; for (i = 0; i < h; ++i) { k = (i * 2) + 1; sum = 0.0; for (j = 0; j < k; ++j) sum += c.a(j, channel); a[i] = sum /(float) k; } k= h*2 + 1; for (i = h; i < c.num_frames() - h; ++i) { sum = 0.0; for (j = 0; j < k; ++j) sum += c.a(i - h + j, channel); a[i] = sum /(float) k; } for (; i < c.num_frames(); ++i) { k = ((c.num_frames() - i)* 2) -1; sum = 0.0; for (j = 0; j < k; ++j) sum += c.a(i - (k/2) + j, channel); a[i] = sum /(float) k; } for (i = 0; i < c.num_frames(); ++i) c.a(i,channel) = a[i]; delete [] a; } void absolute(EST_Track &tr) { int i, j; for (i = 0; i < tr.num_frames(); ++i) for (j = 0; j < tr.num_channels(); ++j) tr.a(i, j) = fabs(tr.a(i, j)); } void normalise(EST_Track &tr) { EST_FVector mean, sd; meansd(tr, mean, sd); normalise(tr, mean, sd, -1.0, 1.0); } /* Normalise a list of tracks */ void normalise(EST_TrackList &trlist, EST_FVector &mean, EST_FVector &sd, float upper, float lower) { for (EST_Litem *p = trlist.head(); p; p = p->next()) normalise(trlist(p), mean, sd, upper, lower); } /* Normalise by subtracting the mean and dividing by TWICE the standard deviation. */ void normalise(EST_Track &tr, EST_FVector &mean, EST_FVector &sd, float upper, float lower) { for (int i = 0; i < tr.num_channels(); ++i) normalise(tr, mean(i), sd(i), i, upper, lower); } void normalise(EST_Track &tr, float mean, float sd, int channel, float upper, float lower) { // This scales the data so that 2 standard deviations worth of values // lie between upper and lower. int i; // cout << "upper = " << upper << " lower " << lower << endl; for (i = 0; i < tr.num_frames(); ++i) if (!tr.track_break(i)) tr.a(i, channel) = ((((tr.a(i, channel) - mean) / (4 *sd)) + 0.5) * (upper -lower)) + lower; } EST_Track differentiate(EST_Track &c, float samp_int) { // Differentiate track. SEE ALSO delta(EST_Track, int) which does // this in a more sophisticated way!!! EST_Track diff; int i, j; float dist; if (samp_int != 0.0) c.sample(samp_int); diff.copy_setup(c); diff.resize(c.num_frames() - 1, c.num_channels()); for (i = 0; i < diff.num_frames(); ++i) { dist = c.t(i + 1) - c.t(i); for (j = 0; j < diff.num_channels(); ++j) diff.a(i, j) = (c.track_break(i) || c.track_break(i + 1)) ? 0.0 : (c.a(i + 1) - c.a(i)) / dist; diff.t(i) = c.t(i) + (dist / 2.0); } return diff; } EST_Track difference(EST_Track &a, EST_Track &b) { int i, j; int size = Lof(a.num_frames(), b.num_frames()); EST_Track diff = a; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Track with " << b.num_channels() << " channel EST_Track\n"; return diff; } for (i = 0; i < size; ++i) for (j = 0; j < a.num_channels(); ++j) diff.a(i, j) = a.a(i, j) - b.a(i, j); return diff; } EST_Track difference(EST_Track &a, EST_Track &b, int channel_a, int channel_b) { int i; int size = Lof(a.num_frames(), b.num_frames()); EST_Track diff = a; for (i = 0; i < size; ++i) diff.a(i, channel_a) = a.a(i, channel_a) - b.a(i, channel_b); return diff; } EST_Track difference(EST_Track &a, EST_Track &b, EST_String fname) { int ch_a, ch_b; EST_Track cor; if (!a.has_channel(fname)) { cerr << "Error: Couldn't find field named " << fname << " in first Track\n"; return cor; } if (!b.has_channel(fname)) { cerr << "Error: Couldn't find field named " << fname << " in second Track\n"; return cor; } ch_a = a.channel_position(fname); ch_b = b.channel_position(fname); return difference(a, b, ch_a, ch_b); } float mean( const EST_Track &tr, int channel ) { if ( channel<0 || channel >= tr.num_channels() ) EST_error( "Tried to access channel %d of %d channel track", channel, tr.num_channels() ); float mean=0.0; int i, n; int tr_num_frames = tr.num_frames(); for( i=0, n=0; i1 ){ // use n, not tr_num_frames because of breaks var /= (float) (n-1); sd = sqrt(var); } else sd = 0.0; } /** Calculate the root mean square error between the same channel in two tracks @see abs_error, rms_error */ float rms_error(EST_Track &a, EST_Track &b, int channel) { int i; int size = Lof(a.num_frames(), b.num_frames()); float sum = 0; for (i = 0; i < size; ++i) if (a.val(i) && b.val(i)) sum += pow((a.a(i, channel) - b.a(i, channel)), float(2.0)); sum = sqrt(sum / size); return sum; } float abs_error(EST_Track &a, EST_Track &b, int channel) { int i; int size = Lof(a.num_frames(), b.num_frames()); float sum = 0; for (i = 0; i < size; ++i) { // cout << i << " " << a.a(i, channel) << " " << b.a(i, channel) << endl; if (a.val(i) && b.val(i)) sum += fabs(a.a(i, channel) - b.a(i, channel)); } return sum / size; } float correlation(EST_Track &a, EST_Track &b, int channela, int channelb) { int i; int size = Lof(a.num_frames(), b.num_frames()); float predict,real; EST_SuffStats x,y,xx,yy,xy,se,e; float cor,error; for (i = 0; i < size; ++i) if (a.val(i) && b.val(i)) { // cout << a.t(i) << " " << a.a(i, channela) << " " << b.a(i, channelb) << endl; predict = b.a(i, channelb); real = a.a(i, channela); x += predict; y += real; error = predict-real; se += error*error; e += fabs(error); xx += predict*predict; yy += real*real; xy += predict*real; } cor = (xy.mean() - (x.mean()*y.mean()))/ (sqrt(xx.mean()-(x.mean()*x.mean())) * sqrt(yy.mean()-(y.mean()*y.mean()))); // cout << xy.mean() << " " << x.mean() << " " << y.mean() << " " // << xx.mean() << " " << yy.mean() << endl; cout << "RMSE " << sqrt(se.mean()) << " Correlation is " << cor << " Mean (abs) Error " << e.mean() << " (" << e.stddev() << ")" << endl; return cor; } void meansd(EST_Track &a, EST_FVector &m, EST_FVector &sd) { int i; m.resize(a.num_channels()); sd.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) meansd(a, m[i], sd[i], i); } void meansd(EST_TrackList &tl, float &mean, float &sd, int channel) { EST_Litem *p; float var=0.0; int i, n; n = 0; mean = 0.0; for (p = tl.head(); p; p = p->next()) for (i = 0; i < tl(p).num_frames(); ++i) { if (!tl(p).track_break(i)) { mean += tl(p).a(i, channel); ++n; } } mean /= n; for (p = tl.head(); p; p = p->next()) for (i = 0; i < tl(p).num_frames(); ++i) if (!tl(p).track_break(i)) var += pow(tl(p).a(i, channel) - mean, float(2.0)); var /= n; sd = sqrt(var); } void meansd(EST_TrackList &tl, EST_FVector &m, EST_FVector &sd) { int i; m.resize(tl.first().num_channels()); sd.resize(tl.first().num_channels()); for (i = 0; i < tl.first().num_channels(); ++i) meansd(tl, m[i], sd[i], i); } EST_FVector rms_error(EST_Track &a, EST_Track &b) { int i; EST_FVector e; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Track with " << b.num_channels() << " channel EST_Track\n"; return e; } e.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) e[i] = rms_error(a, b, i); return e; } EST_FVector abs_error(EST_Track &a, EST_Track &b) { int i; EST_FVector e; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Track with " << b.num_channels() << " channel EST_Track\n"; return e; } e.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) e[i] = abs_error(a, b, i); return e; } EST_FVector correlation(EST_Track &a, EST_Track &b) { int i; EST_FVector cor; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Track with " << b.num_channels() << " channel EST_Track\n"; return cor; } cor.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) cor[i] = correlation(a, b, i, i); return cor; } EST_FVector correlation(EST_Track &a, EST_Track &b, EST_String fname) { int ch_a, ch_b; EST_FVector cor; if (!a.has_channel(fname)) { cerr << "Error: Couldn't find field named " << fname << " in first Track\n"; return cor; } if (!b.has_channel(fname)) { cerr << "Error: Couldn't find field named " << fname << " in second Track\n"; return cor; } ch_a = a.channel_position(fname); ch_b = b.channel_position(fname); cor.resize(1); cor[0] = correlation(a, b, ch_a, ch_b); return cor; } EST_Track error(EST_Track &ref, EST_Track &test, int relax) { int i, j, k, l; EST_Track diff; diff = ref; float t; // relaxation allows an error to be ignored near boundaries. The // degree of relation specifies how many frames can be ignored. float *r = new float[relax*3]; for (l = 0; l < ref.num_channels(); ++l) for (i = 0; i < ref.num_frames(); ++i) { t = 0; for (k = 0, j = Gof((i - relax), 0); j < i + relax + 1; ++j, ++k) { if (ref.a(i, l) > 0.5) r[k] = ((j < test.num_frames()) && (test.a(j, l)> 0.6)) ?1 : 0.5; else r[k] = ((j < test.num_frames()) && (test.a(j, l)< 0.4)) ? -1 : -0.5; // fix for relaxation t = r[k]; } // cout << "ref: " << ref.a(i, l) << " test:" << test.a(i, l) << " error:" << t << endl; diff.a(i, l) = t; } delete [] r; return diff; } void align_to_track(EST_Track &tr, float &start, float &end) { int is, ie; // cout << " in " << start << " " << end << "\n"; is = tr.index(start); ie = tr.index(end); // cout << " indexes " << is << " " << ie << "\n"; start = tr.t(is); end = tr.t(ie); // cout << " out " << start << " " << end << "\n"; } void align_to_track(EST_Track &tr, int &start, int &end, int sample_rate) { float start_t = start/(float)sample_rate; float end_t = end/(float)sample_rate; // cout << "align " << start_t << " " << end_t << " " << sample_rate << "\n"; align_to_track(tr, start_t, end_t); // cout << " gives " << start_t << " " << end_t << "\n"; start = (int)(start_t*sample_rate + 0.5); end = (int)( end_t*sample_rate + 0.5); } void move_to_frame_ends(EST_Track &tr, int &start, int &end, int sample_rate, float offset) { float start_t = start/(float)sample_rate; float end_t = end/(float)sample_rate; // cout << "move " << start_t << " " << end_t << " " << sample_rate << "\n"; int is = tr.index(start_t-offset); int ie = tr.index(end_t-offset); int start_s, start_c, start_e; int end_s, end_c, end_e=0; if (tr.has_channel(channel_length)) { get_frame(tr, sample_rate, is, start_s, start_c, start_e); get_frame(tr, sample_rate, ie, end_s, end_c, end_e); } else { start_s = (int)(tr.t(is) * sample_rate); end_s = (int)(tr.t(ie) * sample_rate); } start = start_s + (int)(offset*sample_rate + 0.5); end = end_e + (int)(offset*sample_rate + 0.5); } int nearest_boundary(EST_Track &tr, float time, int sample_rate, float offset) { time -= offset; float distance = 10000; for (int i = 0; i < tr.num_frames(); ++i) { float start, center, end; get_frame(tr, sample_rate, i, start, center, end); // printf("nb %f: %d distance %f start %f\n", time, i, distance, start); if (fabs(start-time) > distance) return i-1; distance = fabs(start-time); } return tr.num_frames(); } void move_start(EST_Track &tr, float shift) { for(int i=0; i 0 ?ie - is : 0; ret.resize(new_num_frames, orig.num_channels()); for (i = 0; i < new_num_frames; ++i) { for (j = 0; j < orig.num_channels(); ++j) ret.a(i, j) = orig.a(i + is, j); ret.t(i) = orig.t(i + is); if (orig.track_break(i + is)) ret.set_break(i); else ret.set_value(i); } } int get_order(const EST_Track &t, EST_CoefficientType type, int d) { int order; EST_ChannelType start_c = (EST_ChannelType)EST_CoefChannelId(type, d, 0); EST_ChannelType end_c = (EST_ChannelType)EST_CoefChannelId(type, d, 1); if (t.has_channel(start_c)) if (t.has_channel(end_c)) order = t.channel_position(end_c) - t.channel_position(start_c); else order = t.num_channels()-t.channel_position(start_c)-1; else order=0; return order; } int get_order(const EST_Track &tr) { int order=0; EST_CoefficientType t; for(t=cot_first; t 0) return order; cout << "No coefficients in track\n"; return 0; } int sum_lengths(const EST_Track &t, int sample_rate, int start_frame, int end_frame) { (void)sample_rate; int l=0; if (end_frame < 0) end_frame = t.num_frames(); if (t.has_channel(channel_length)) for(int i=start_frame; i &pos) { pos.ensure(t.num_frames()); if (!t.has_channel(channel_length)) { cout << "no length channel\n"; return; } for(int i=0; inext(), ++i) { k = ch_list(p); if (k >= orig.num_channels()) EST_error("Tried to extract channel number %d from track with " "only %d channels\n", k, orig.num_channels()); for (j = 0; j < orig.num_frames(); ++j) nt.a(j, i) = orig.a(j, k); nt.set_channel_name(orig.channel_name(k), i); } for (j = 0; j < orig.num_frames(); ++j) nt.t(j) = orig.t(j); } void ParallelTracks(EST_Track &a, EST_TrackList &list,const EST_String &style) { // Make multi channel track out of list of tracks. There are two // "styles". "0" means take the size of the first track in the list, // "1" means take the size of the longest as the number of frames in // the created track. EST_Litem *p, *longest; int num_channels, num_frames; int i, j, k, n; for (num_channels=0,p=list.head(); p; p=p->next()) num_channels += list(p).num_channels(); if (style == "first") { num_frames = list.first().num_frames(); longest = list.head(); } else { if (style != "longest") cerr << "EST_Track: unknown combine style \"" << style << "\" assuming longest" << endl; for (num_frames = 0, longest = p = list.head(); p; p = p->next()) if (num_frames < list(p).num_frames()) { num_frames = list(p).num_frames(); longest = p; } } a.resize(num_frames, num_channels); a.fill(0.0); for (k = 0, p = list.head(); p; p = p->next()) { n = Lof(num_frames, list(p).num_frames()); for (j = 0; j < list(p).num_channels(); ++j, ++k) { for (i = 0; i < n; ++i) a(i, k) = list(p).a(i, j); a.set_channel_name(list(p).channel_name(j), k); } } // fill time with times from longest file. for (i = 0; i < list(longest).num_frames(); ++i) a.t(i) = list(longest).t(i); } void channel_to_time(EST_Track &tr, int channel, float scale) { for(int i=0; i < tr.num_frames(); i++) { tr.t(i) = tr.a(i,channel) * scale; } tr.set_equal_space(FALSE); } void channel_to_time(EST_Track &tr, EST_ChannelType c, float scale) { int channel = NO_SUCH_CHANNEL; if (tr.map() != 0 && (channel = (tr.map()->get(c)) != NO_SUCH_CHANNEL)) { channel_to_time(tr, channel, scale); return; } else { cerr << "no channel '" << EST_default_channel_names.name(c) << "' = " << (int)c << "\n"; abort(); } } void channel_to_time(EST_Track &tr, const EST_String c_name, float scale) { for (int c=0; cget(c)) != NO_SUCH_CHANNEL) { channel_to_time_lengths(tr, channel, scale); return; } else { cerr << "no channel '" << EST_default_channel_names.name(c) << "' = " << (int)c << "\n"; abort(); } } void channel_to_time_lengths(EST_Track &tr, const EST_String c_name, float scale) { for (int c=0; c Extract track starting at this time, \n" " specified in seconds\n\n" "-end Extract track ending at this time, \n" " specified in seconds\n\n" "-from Extract track starting at this frame position\n\n" "-to Extract track ending at this frame position\n\n"; } EST_String options_track_input(void) { // The standard waveform input options return EST_String("")+ "-itype Input file type (optional). If no type is\n" " specified type is automatically derived from\n" " file's header. Supported types\n" " are: "+options_track_filetypes()+"\n\n" // remove ??? "-ctype Contour type: F0, track\n\n" "-s Frame spacing of input in seconds, for unheadered input file\n\n" "-startt Time of first frame, for formats which don't provide this\n\n" "-c Select a subset of channels (starts from 0). \n" " Tracks can have multiple channels. This option \n" " specifies a list of numbers, refering to the channel \n" " numbers which are to be used for for processing. \n\n"+ options_subtrack(); } EST_String options_track_output(void) { // The standard track output options return EST_String("")+ "-otype {ascii}\n"+ " Output file type, if unspecified ascii is\n"+ " assumed, types are: "+options_track_filetypes()+", label\n\n"+ "-S Frame spacing of output in seconds. If this is \n" " different from the internal spacing, the contour is \n" " resampled at this spacing \n\n" "-o Output filename, defaults to stdout\n\n"; } void track_info(EST_Track &t) { cout << t.name() << endl; cout << "Number of frames: " << t.num_frames() << endl; cout << "Number of channels: " << t.num_channels() << endl; cout << "File type: " << EST_TrackFile::map.name(t.file_type()) << endl; if (t.equal_space()) cout << "Frame shift: " << t.shift() << endl; else cout << "Frame shift: varied" << endl; for (int i = 0; i < t.num_channels(); ++i) cout << "Channel: " << i << ": " << t.channel_name(i) << endl; } EST_String options_track_filetypes(void) { // Returns list of currently support track filetypes // Should be extracted from the list in EST_Track return EST_TrackFile::options_short(); } EST_String options_track_filetypes_long(void) { // Returns list of currently support track filetypes // Should be extracted from the list in EST_Track return EST_TrackFile::options_supported(); } speech_tools/speech_class/EST_wave_temp.cc0000644000076400007640000001773610127000720017331 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue May 27 1997 */ /************************************************************************/ /************************************************************************/ /* */ /* temporary place fro some new functions. */ /* */ /************************************************************************/ #include #include #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_simplestats.h" #include "EST_cutils.h" EST_Wave difference(EST_Wave &a, EST_Wave &b) { int i, j; int size = Lof(a.num_samples(), b.num_samples()); EST_Wave diff = a; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Wave with " << b.num_channels() << " channel EST_Wave\n"; return diff; } for (i = 0; i < size; ++i) for (j = 0; j < a.num_channels(); ++j) diff.a(i, j) = a.a(i, j) - b.a(i, j); return diff; } void meansd(EST_Wave &tr, float &mean, float &sd, int channel) { float var=0.0; int i, n; for (n = 0, i = 0, mean = 0.0; i < tr.num_samples(); ++i) { mean += tr.a(i, channel); ++n; } mean /= n; for (i = 0, mean = 0.0; i < tr.num_samples(); ++i) var += pow(tr.a(i, channel) - mean, float(2.0)); var /= n; sd = sqrt(var); } float rms_error(EST_Wave &a, EST_Wave &b, int channel) { int i; int size = Lof(a.num_samples(), b.num_samples()); float sum = 0; for (i = 0; i < size; ++i) sum += pow(float(a.a(i, channel) - b.a(i, channel)), float(2.0)); sum = sqrt(sum / size); return sum; } float abs_error(EST_Wave &a, EST_Wave &b, int channel) { int i; int size = Lof(a.num_samples(), b.num_samples()); float sum = 0; for (i = 0; i < size; ++i) { // cout << i << " " << a.a(i, channel) << " " << b.a(i, channel) << endl; sum += fabs(float(a.a(i, channel) - b.a(i, channel))); } return sum / size; } float correlation(EST_Wave &a, EST_Wave &b, int channel) { int i; int size = Lof(a.num_samples(), b.num_samples()); float predict,real; EST_SuffStats x,y,xx,yy,xy,se,e; float cor,error; for (i = 0; i < size; ++i) { // cout << a.a(i, channel) << " " << b.a(i, channel) << endl; predict = b.a(i, channel); real = a.a(i, channel); x += predict; y += real; error = predict-real; se += error*error; e += fabs(error); xx += predict*predict; yy += real*real; xy += predict*real; } cor = (xy.mean() - (x.mean()*y.mean()))/ (sqrt(xx.mean()-(x.mean()*x.mean())) * sqrt(yy.mean()-(y.mean()*y.mean()))); // cout << xy.mean() << " " << x.mean() << " " << y.mean() << " " << xx.mean() << " " << yy.mean() << endl; // cout << "RMSE " << sqrt(se.mean()) << " Correlation is " << cor << " Mean (abs) Error " << e.mean() << " (" << e.stddev() << ")" << endl; return cor; } void absolute(EST_Wave &wave) { int i, j; for (i = 0; i < wave.num_samples(); ++i) for (j = 0; j < wave.num_channels(); ++j) wave.a(i, j) = abs(wave.a(i, j)); } EST_FVector rms_error(EST_Wave &a, EST_Wave &b) { int i; EST_FVector e; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Wave with " << b.num_channels() << " channel EST_Wave\n"; return e; } e.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) e[i] = rms_error(a, b, i); return e; } EST_FVector abs_error(EST_Wave &a, EST_Wave &b) { int i; EST_FVector e; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Wave with " << b.num_channels() << " channel EST_Wave\n"; return e; } e.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) e[i] = abs_error(a, b, i); return e; } EST_FVector correlation(EST_Wave &a, EST_Wave &b) { int i; EST_FVector cor; // ERROR REORG - this needs to return a proper error if (a.num_channels() != b.num_channels()) { cerr << "Error: Can't compare " << a.num_channels() << " channel EST_Wave with " << b.num_channels() << " channel EST_Wave\n"; return cor; } cor.resize(a.num_channels()); for (i = 0; i < a.num_channels(); ++i) cor[i] = correlation(a, b, i); return cor; } EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax) { int i, j, k, l; EST_Wave diff; diff = ref; int t; // relaxation allows an error to be ignored near boundaries. The // degree of relation specifies how many samples can be ignored. int *r = new int[relax*3]; for (l = 0; l < ref.num_channels(); ++l) for (i = 0; i < ref.num_samples(); ++i) { t = 0; for (k = 0, j = Gof((i - relax), 0); j < i + relax + 1; ++j, ++k) { if (ref.a(i, l) > 0.5) r[k] = ((j < test.num_samples()) && (test.a(j, l)> 0.6)) ?1 : 0; else r[k] = ((j < test.num_samples()) && (test.a(j, l)< 0.4)) ?1 : 0; t |= r[k]; } diff.a(i, l) = t; } delete [] r; return diff; } speech_tools/speech_class/EST_wave_cuts.cc0000644000076400007640000001407311465017156017352 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* EST_Wave class methods for cutting, and extracting */ /* */ /*=======================================================================*/ #include #include "EST_unix.h" #include #include "EST_cutils.h" #include "EST_string_aux.h" #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_Track.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_item_aux.h" static int wave_subwave(EST_Wave &subsig,EST_Wave &sig, float offset, float length); int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab, const EST_String &ext) { wl.clear(); EST_Wave a; EST_Item *k; EST_String filename; float start = 0,end; for (k = keylab.head(); k; k = k->next()) { a.clear(); end = k->F("end",0); if (end < start) continue; wave_subwave(a, sig, start, end-start); filename = (EST_String)k->f("file"); a.set_name(filename + ext); wl.append(a); start = end; } return 0; } int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab, const EST_String &file) { EST_Wave a; EST_Item *k; EST_String key_file_name; float start=0, end; for (k = keylab.head(); k; k = k->next()) { end = k->F("end",0); key_file_name = (EST_String)k->f("file"); if (key_file_name == file) { wave_subwave(part, sig, start, end-start); return 0; } start = end; } cerr << "Couldn't locate file fragment " << file << " in keylab file\n"; return -1; } static int wave_subwave(EST_Wave &subsig,EST_Wave &sig, float offset, float length) { return wave_subwave(subsig, sig, (int)(offset *(float)sig.sample_rate()), (int)(length *(float)sig.sample_rate())); } int wave_subwave(EST_Wave &subsig,EST_Wave &sig,int offset,int length) { // take out a subpart of sig and put it in subsig int ns; if (length == -1) ns = sig.num_samples() - offset; else ns = length; if ((offset+ns) > sig.num_samples()) { cerr << "Subset past end of signal\n"; return -1; } EST_Wave subwave; sig.sub_wave(subwave, offset, ns, 0, EST_ALL); subsig.copy(subwave); return 0; } int track_divide(EST_TList &mtfr, EST_Track &fv, EST_Relation &key) { EST_Track a; EST_Item *k, t; float kstart, length; int i, j, l, n; mtfr.clear(); if ((key.tail())->F("end") < (fv.t(fv.num_frames() - 1))) { cerr << "Key file must extend beyond end of EST_Track\n"; cerr << "key end: " << key.tail()->F("end") << " EST_Track end: " << fv.t(fv.num_frames() - 1) << endl; return -1; } k = key.head(); a.set_name(k->name()); kstart = 0.0; length = end(*k) - kstart; n = (int)(length / (float) fv.shift()) + 2; a.resize(n, fv.num_channels()); for (i = 0, l = 0; i < fv.num_frames(); ++i, ++l) { for (j = 0; j < fv.num_channels(); ++j) a(l, j) = fv(i, j); if (fv.t(i) > k->F("end")) { a.set_num_frames(l + 1); mtfr.append(a); kstart = k->F("end"); k = k->next(); a.set_name(k->name()); length = k->F("end") - kstart; n = (int)(length / (float) fv.shift()) + 2; // cout << "n frames: " << n << endl; a.resize(n, fv.num_channels()); a.fill_time(fv.shift()); // for (j = 0; j < fv.order(); ++j) // a(0, j) = fv(i, j); l = -1; } } a.set_num_frames(l); mtfr.append(a); return 0; } speech_tools/speech_class/ssff.cc0000644000076400007640000002234310127000720015556 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1999 */ /*-----------------------------------------------------------------------*/ /* Version of code for reading and writing MacQuarie's SSFF format as */ /* used in emulabel */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_unix.h" #include "EST_types.h" #include "EST_Track.h" #include "EST_track_aux.h" #include "EST_TrackMap.h" #include "EST_cutils.h" #include "EST_Token.h" #include "EST_TList.h" #include "EST_string_aux.h" #include "EST_walloc.h" #include "EST_TrackFile.h" #include "EST_FileType.h" EST_read_status EST_TrackFile::load_ssff(const EST_String filename, EST_Track &tr, float ishift, float startt) { EST_TokenStream ts; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } tr.set_name(filename); return load_ssff_ts(ts, tr, ishift, startt); } EST_read_status EST_TrackFile::load_ssff_ts(EST_TokenStream &ts, EST_Track &tr, float ishift, float startt) { (void)ishift; (void)startt; int num_frames, num_channels; int swap = FALSE; int i,j,pos,end; float Start_Time, Record_Freq; EST_Features channels; EST_String c, name, type, size, cname; FILE *fp; double dbuff[2]; short sbuff[2]; num_frames = num_channels = 0; Start_Time = Record_Freq = 0; if (ts.get() != "SSFF") return wrong_format; if ((ts.get() != "--") || (ts.get() != "(c)") || (ts.get() != "SHLRC")) { cerr << "ssff load track \"" << ts.filename() << "\": bad header" << endl; return misc_read_error; } while (ts.peek() != "-----------------") { c = (EST_String)ts.get(); if (c == "Comment") ts.get_upto_eoln(); else if (c == "Start_Time") { Start_Time = atof(ts.get().string()); tr.f_set("Start_Time",Start_Time); } else if (c == "Record_Freq") { Record_Freq = atof(ts.get().string()); tr.f_set("Record_Freq",Record_Freq); } else if (c == "Machine") { if (ts.get() == "SPARC") { if (EST_NATIVE_BO != bo_big) swap = TRUE; } else if (EST_NATIVE_BO == bo_big) swap = TRUE; } else if (c == "Column") { name = (EST_String)ts.get(); type = (EST_String)ts.get(); size = (EST_String)ts.get(); cname = EST_String("Channel_")+itoString(num_channels); channels.set(cname+".name",name); channels.set(cname+".type",type); channels.set(cname+".size",atoi(size)); num_channels++; } else if ((c == "window_type") || (c == "window_duration") || (c == "lpc_order") || (c == "lpc_type") || (c == "end_time") || (c == "preemphasis") || (c == "frame_duration")) { type = (EST_String)ts.get(); if (type == "SHORT") tr.f_set(c,atoi(ts.get().string())); else if (type == "DOUBLE") tr.f_set(c,(float)atof(ts.get().string())); else tr.f_set(c,ts.get().string()); } else if (ts.eof()) { cerr << "ssff load track \"" << ts.filename() << "\": bad header unexpected eof" << endl; return misc_read_error; } else { cerr << "ssff load track \"" << ts.filename() << "\": unknown header value \"" << c << "\"" << endl; } } ts.get(); // skip over end of header line // There's no num_records field in the header so have to use file's // length to calculate it fp = ts.filedescriptor(); pos = ftell(fp); fseek(fp,0,SEEK_END); end = ftell(fp); fseek(fp,pos,SEEK_SET); num_frames = (end - pos)/(num_channels*sizeof(double)); // Finished reading header tr.resize(num_frames,num_channels); tr.fill_time(1.0/Record_Freq); tr.set_equal_space(true); for (i=0; ik == "Start_Time") || (p->k == "Record_Freq")) continue; else fprintf(fp, "%s DOUBLE %s\n", (const char *)p->k, (const char *) p->v.String()); } fprintf(fp,"-----------------\n"); for (i=0; i< tr.num_frames(); i++) { double prob_voice; double dd; for (j=0; j< tr.num_channels(); j++) { dd = tr(i,j); fwrite(&dd,sizeof(double),1,fp); } if (need_prob_voice) { if (tr(i,0) == 0) prob_voice = 0; else prob_voice = 1; fwrite(&prob_voice,sizeof(double),1,fp); } } return write_ok; } speech_tools/speech_class/esps_io.cc0000644000076400007640000002546310127000720016264 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan W Black */ /* Date : June 1994 (June 1996) */ /*-----------------------------------------------------------------------*/ /* Access ESPS headered files */ /* This offers a licence free interface to reading and writing ESPS */ /* headered files. although not complete it works for most major ESPS */ /* files include signals, lpc and F0 files */ /* */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include "EST_cutils.h" #include "EST_wave_utils.h" #include "esps_utils.h" /* The following are attempts to read and write ESPS header files without */ /* Using the Entropic libraries. These routines do not read all ESPS */ /* headers but are adequate for all of the uses we wish (and those you */ /* wish too probably) */ enum EST_write_status put_esps(const char *filename,const char *style, float *t, float *a, int *v, float fsize, float rate, int num_points) { (void)t; esps_hdr hdr; esps_rec rec; FILE *fd; int i; if ((fd=fopen(filename,"wb")) == NULL) { fprintf(stderr,"ESPS file: cannot open file \"%s\" for writing\n", filename); return misc_write_error; } hdr = make_esps_hdr(); if (streq(style,"F0")) { add_field(hdr,"F0",ESPS_DOUBLE,1); add_field(hdr,"prob_voice",ESPS_DOUBLE,1); add_field(hdr,"rms",ESPS_DOUBLE,1); add_field(hdr,"ac_peak",ESPS_DOUBLE,1); add_field(hdr,"k1",ESPS_DOUBLE,1); add_fea_d(hdr,"record_freq",0,(double)rate); add_fea_d(hdr,"frame_duration",0,(double)fsize); add_fea_d(hdr,"start_time",0,(double)0); add_fea_special(hdr,ESPS_FEA_COMMAND, "EDST F0 written as ESPS FEA_SD.\n"); write_esps_hdr(hdr,fd); rec = new_esps_rec(hdr); for (i = 0; i < num_points; i++) { set_field_d(rec,0,0,a[i]); set_field_d(rec,1,0,(float)v[i]); set_field_d(rec,2,0,0.5); set_field_d(rec,3,0,0.5); set_field_d(rec,4,0,0.5); write_esps_rec(rec,hdr,fd); } delete_esps_rec(rec); } else { add_field(hdr,"Track",ESPS_DOUBLE,1); add_fea_d(hdr,"window_duration",0,(double)0.049); add_fea_d(hdr,"frame_duration",0,(double)fsize); add_fea_d(hdr,"record_freq",0,(double)rate); add_fea_d(hdr,"start_time",0,(double)0); add_fea_special(hdr,ESPS_FEA_COMMAND, "EDST Track written as ESPS FEA_SD.\n"); write_esps_hdr(hdr,fd); rec = new_esps_rec(hdr); for (i = 0; i < num_points; i++) { set_field_d(rec,0,0,a[i]); write_esps_rec(rec,hdr,fd); } delete_esps_rec(rec); } delete_esps_hdr(hdr); fclose(fd); return write_ok; } enum EST_write_status put_track_esps(const char *filename, char **f_names, float **a, float fsize, float rate, int order, int num_points, short fixed) { esps_hdr hdr; esps_rec rec; FILE *fd; int i, j; hdr = make_esps_hdr(); if ((fd = fopen(filename, "wb")) == NULL) { fprintf(stderr,"ESPS file: cannot open file \"%s\" for writing\n", filename); return misc_write_error; } for (i = 0; i < order; ++i) add_field(hdr,f_names[i],ESPS_DOUBLE,1); if (!streq(f_names[0],"F0")) { add_fea_s(hdr,"lpccep_order",0,(short)order); add_fea_i(hdr,"step",0,(int)fsize); add_fea_d(hdr,"window_duration",0,(double)0.049); add_fea_i(hdr,"start",0,(int)1); add_fea_f(hdr,"warping_param",0,(float)0.0); add_fea_s(hdr,"window_type",0,(short)2); } add_fea_d(hdr,"record_freq",0,(double)rate); add_fea_d(hdr,"frame_duration",0,(double)fsize); add_fea_d(hdr,"start_time",0,(double)0.0); if (!fixed) add_fea_s(hdr,"est_variable_frame", 0, (short)1); write_esps_hdr(hdr,fd); rec = new_esps_rec(hdr); for (i = 0; i < num_points; ++i) { for (j = 0; j < order; ++j) set_field_d(rec, j, 0,(double)a[i][j]); write_esps_rec(rec,hdr,fd); } delete_esps_hdr(hdr); fclose(fd); return write_ok; } enum EST_read_status get_esps(const char *filename, char *style, float **t, float **a, int **v, float *fsize, int *num_points) { (void)t; FILE *fd; enum EST_read_status rv; int ff0, fprob_voice, i; esps_hdr hdr; float *ta; double d; int *tv; esps_rec rec; if ((fd = fopen(filename, "rb")) == NULL) { fprintf(stderr, "Can't open esps file %s for reading\n", filename); return misc_read_error; } if ((rv=read_esps_hdr(&hdr,fd)) != format_ok) { fclose(fd); return rv; } ta = walloc(float,hdr->num_records); tv = walloc(int,hdr->num_records); /* Find field number of FO and prob_voice */ for (ff0=fprob_voice=-1,i=0; i < hdr->num_fields; i++) if (streq("F0",hdr->field_name[i])) ff0=i; else if (streq("prob_voice",hdr->field_name[i])) fprob_voice = i; rec = new_esps_rec(hdr); for (i=0; i < hdr->num_records; i++) { if (read_esps_rec(rec,hdr,fd) == EOF) { fprintf(stderr,"ESPS file: unexpected end of file when reading record %d\n", i); delete_esps_rec(rec); delete_esps_hdr(hdr); fclose(fd); return misc_read_error; } if (ff0 == -1) /* F0 field isn't explicitly labelled */ { /* so take first field */ switch(rec->field[0]->type) { case ESPS_DOUBLE: ta[i] = get_field_d(rec,0,0); break; case ESPS_FLOAT: ta[i] = get_field_f(rec,0,0); break; default: fprintf(stderr,"ESPS file: doesn't seem to be F0 file\n"); delete_esps_rec(rec); delete_esps_hdr(hdr); fclose(fd); return misc_read_error; } } else /* use named field -- assume its a double */ ta[i] = get_field_d(rec,ff0,0); if (fprob_voice == -1) tv[i] = 1; /* no prob_voice field in this */ else tv[i] = ((get_field_d(rec,fprob_voice,0) < 0.5) ? 0 : 1); } *num_points = hdr->num_records; *a = ta; *v = tv; if (fea_value_d("record_freq",0,hdr,&d) != 0) *fsize = 0; else *fsize = 1.0/d; if (ff0 != -1) strcpy(style, "F0"); else strcpy(style, "track"); delete_esps_rec(rec); delete_esps_hdr(hdr); fclose(fd); return format_ok; } enum EST_read_status get_track_esps(const char *filename, char ***fields, float ***a, float *fsize, int *num_points, int *num_fields, short *fixed) { esps_hdr hdr; esps_rec rec; FILE *fd; int i, j, order, num_recs; enum EST_read_status rv; double d; char **tf; float **ta; if ((fd = fopen(filename, "rb")) == NULL) return misc_read_error; if ((rv=read_esps_hdr(&hdr,fd)) != format_ok) { fclose(fd); return rv; } num_recs = hdr->num_records; order = hdr->num_fields; ta = walloc(float *,num_recs); tf = walloc(char *,order); for (j = 0; j < num_recs; ++j) ta[j] = walloc(float,order); /* Read data values */ rec = new_esps_rec(hdr); { short v; *fixed = fea_value_s("est_variable_frame", 0, hdr, &v) != 0; } for (j = 0; j < hdr->num_records; j++) { if (read_esps_rec(rec,hdr,fd) == EOF) { fprintf(stderr,"ESPS file: unexpected end of file when reading record %d\n", j); delete_esps_rec(rec); delete_esps_hdr(hdr); } for (i = 0; i < order; ++i) switch (rec->field[i]->type) { case ESPS_DOUBLE: ta[j][i]=get_field_d(rec,i,0); break; case ESPS_FLOAT: ta[j][i]=get_field_f(rec,i,0); break; case ESPS_INT: ta[j][i]=(float)get_field_i(rec,i,0); break; case ESPS_SHORT: ta[j][i]=(float)get_field_s(rec,i,0); break; case ESPS_CHAR: ta[j][i]=(float)get_field_c(rec,i,0); break; case ESPS_CODED: ta[j][i]=(float)get_field_s(rec,i,0); break; default: fprintf(stderr,"ESPS file: unsupported type in record %d\n", rec->field[i]->type); delete_esps_rec(rec); delete_esps_hdr(hdr); fclose(fd); return misc_read_error; } } num_recs = j; /* just a safe guard */ /* read field names */ for (j = 0; j < order; ++j) tf[j] = wstrdup(hdr->field_name[j]); /* copy local variables into argument list */ *fields = tf; *num_points = num_recs; *num_fields = order; *a = ta; if (fea_value_d("record_freq",0,hdr,&d) != 0) *fsize = 0; else *fsize = 1.0/d; delete_esps_rec(rec); delete_esps_hdr(hdr); fclose(fd); return format_ok; } speech_tools/speech_class/esps_utils.cc0000644000076400007640000010346010127000720017007 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black (and Paul Taylor) */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* These routines form a basis for reading and writing Entropic's ESPS */ /* headered files. The reason we wrote them was to avoid including */ /* Entropic's own (large and cumbersome) code into all our programs. */ /* No Entropic proprietary code is included in this code which means */ /* you do not needs an Entropic licence to use it. */ /* */ /* However this should not be seen as anti-Entropic in anyway it is for */ /* our and your convenience. We would like to specifically thank */ /* Rodney Johnson of Entropic for giving us help and confirming to us */ /* the header format is in fact more complex than one can imagine, */ /* mostly for very bad reasons, (backward compatibility cripples all */ /* software in the long run). Hence this code is almost definitely */ /* incomplete and is not guaranteed to read or create all ESPS files */ /* properly but it is adequate for many tasks. */ /* */ /* Also thanks go to Peter Kabal from McGill University whose AF code */ /* showed me this might be worth attempting, his code gave me something */ /* to look at to start with. */ /* */ /* I should add, this wasn't easy to write, though I'm much better at */ /* octal and hex dumps now. */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include #include "EST_wave_utils.h" #include "esps_utils.h" /* First you must realise there is in fact a number of very similar but */ /* subtly different header formats that appear on ESPS files. */ /* ESPS_FEA and ESPS_SD (others for filters, spectrograms, etc) */ /* The basic format is */ /* preamble */ /* fixed header */ /* variable header */ /* field descriptions (type and dimensions) */ /* field names */ /* header FEAs (maybe with values) */ /* old and foreign headers (mostly ignored here) */ /* data records themselves */ /* esps_fea contain a name and possibly a value. They appear in the */ /* variable part of the header */ esps_fea new_esps_fea() { esps_fea r = walloc(struct ESPS_FEA_struct,1); r->type = 0; r->clength = 0; r->name = NULL; r->dtype = 0; r->count = 0; r->v.ival = NULL; return r; } void delete_esps_fea(esps_fea r) { esps_fea t,u; for (t=r; t != NULL; t=u) { if (t->clength != 0) wfree(t->name); if (t->count != 0) /* this wont work if fields in v aren't aligned */ wfree(t->v.ival); u = t->next; wfree(t); } } void print_esps_fea(esps_fea r) { /* Print out the information in the FEA record */ int i; fprintf(stdout,"type: %d\n",r->type); fprintf(stdout,"name: %s\n",r->name); fprintf(stdout,"size: %d\n",r->count); fprintf(stdout,"dtype: %d\n",r->dtype); for (i=0; icount; i++) switch (r->dtype) { case ESPS_DOUBLE: fprintf(stdout," %d: %g\n",i,r->v.dval[i]); break; case ESPS_FLOAT: fprintf(stdout," %d: %f\n",i,r->v.fval[i]); break; case ESPS_INT: fprintf(stdout," %d: %d\n",i,r->v.ival[i]); break; case ESPS_SHORT: fprintf(stdout," %d: %d\n",i,r->v.sval[i]); break; case ESPS_CHAR: fprintf(stdout," %d: %d\n",i,r->v.cval[i]); break; default: fprintf(stdout," %d: unknown\n",i); } } void add_field(esps_hdr hdr, const char *name, int type, int dimension) { /* Add a new field to the record */ char **names = hdr->field_name; short *types = hdr->field_type; int *dims = hdr->field_dimension; int i; hdr->field_name = walloc(char *,hdr->num_fields+1); hdr->field_type = walloc(short,hdr->num_fields+1); hdr->field_dimension = walloc(int,hdr->num_fields+1); for (i=0; i < hdr->num_fields; i++) { hdr->field_name[i] = names[i]; hdr->field_type[i] = types[i]; hdr->field_dimension[i] = dims[i]; } wfree(names); wfree(types); wfree(dims); hdr->field_name[hdr->num_fields] = wstrdup(name); hdr->field_type[hdr->num_fields] = type; hdr->field_dimension[hdr->num_fields] = dimension; hdr->num_fields++; return; } void add_fea_d(esps_hdr hdr,const char *name, int pos, double d) { /* Add a double FEA field to the header */ esps_fea t = new_esps_fea(); int i; t->type = 13; /* must be lucky for some !! */ t->clength = strlen(name); t->name = wstrdup(name); if (t->count < pos+1) { double *dval = t->v.dval; t->v.dval = walloc(double,pos+1); for (i=0; icount; i++) t->v.dval[i] = dval[i]; for (; i < pos+1; i++) t->v.dval[i] = 0.0; wfree(dval); t->count = pos+1; } t->dtype = ESPS_DOUBLE; t->v.dval[pos] = d; t->next = hdr->fea; hdr->fea = t; return; } void add_fea_f(esps_hdr hdr,const char *name, int pos, float d) { /* Add a float FEA field to the header */ esps_fea t = new_esps_fea(); int i; t->type = 13; t->clength = strlen(name); t->name = wstrdup(name); if (t->count < pos+1) { float *fval = t->v.fval; t->v.fval = walloc(float,pos+1); for (i=0; icount; i++) t->v.fval[i] = fval[i]; for (; i < pos+1; i++) t->v.fval[i] = 0.0; wfree(fval); t->count = pos+1; } t->dtype = ESPS_FLOAT; t->v.fval[pos] = d; t->next = hdr->fea; hdr->fea = t; return; } void add_fea_i(esps_hdr hdr,const char *name, int pos, int d) { /* Add an int FEA field to the header */ esps_fea t = new_esps_fea(); int i; t->type = 13; t->clength = strlen(name); t->name = wstrdup(name); if (t->count < pos+1) { int *ival = t->v.ival; t->v.ival = walloc(int,pos+1); for (i=0; icount; i++) t->v.ival[i] = ival[i]; for (; i < pos+1; i++) t->v.ival[i] = 0; wfree(ival); t->count = pos+1; } t->dtype = ESPS_INT; t->v.ival[pos] = d; t->next = hdr->fea; hdr->fea = t; return; } void add_fea_s(esps_hdr hdr,const char *name, int pos, short d) { /* Add a short FEA field to the header */ esps_fea t = new_esps_fea(); int i; t->type = 13; t->clength = strlen(name); t->name = wstrdup(name); if (t->count < pos+1) { short *sval = t->v.sval; t->v.sval = walloc(short,pos+1); for (i=0; icount; i++) t->v.sval[i] = sval[i]; for (; i < pos+1; i++) t->v.sval[i] = (short)0; wfree(sval); t->count = pos+1; } t->dtype = ESPS_SHORT; t->v.sval[pos] = d; t->next = hdr->fea; hdr->fea = t; return; } void add_fea_c(esps_hdr hdr,const char *name, int pos, char d) { /* Add a char FEA field to the header */ esps_fea t = new_esps_fea(); int i; t->type = 13; t->clength = strlen(name); t->name = wstrdup(name); if (t->count < pos+1) { char *cval = t->v.cval; t->v.cval = walloc(char,pos+1); for (i=0; icount; i++) t->v.cval[i] = cval[i]; for (; i < pos+1; i++) t->v.cval[i] = (char)0; wfree(cval); t->count = pos+1; } t->dtype = ESPS_CHAR; t->v.cval[pos] = d; t->next = hdr->fea; hdr->fea = t; return; } void add_fea_special(esps_hdr hdr,int type,const char *name) { /* Add a special FEA field to the header */ esps_fea t = new_esps_fea(); t->type = type; t->clength = strlen(name); t->name = wstrdup(name); t->count = 0; t->next = hdr->fea; hdr->fea = t; return; } int fea_value_d(const char *name,int pos,esps_hdr hdr, double *d) { /* Get value of double FEA */ esps_fea t; for (t=hdr->fea; t != NULL; t=t->next) if (streq(name,t->name)) { if (t->dtype != ESPS_DOUBLE) { fprintf(stderr,"ESPS hdr: access non-double field \"%s\" as double\n", name); return -1; } *d = t->v.dval[pos]; return 0; } return -1; /* failed to find it */ } int fea_value_f(const char *name,int pos,esps_hdr hdr, float *d) { /* Get value of float FEA */ esps_fea t; for (t=hdr->fea; t != NULL; t=t->next) if (streq(name,t->name)) { if (t->dtype != ESPS_FLOAT) { fprintf(stderr,"ESPS hdr: access non-float field \"%s\" as float\n", name); return -1; } *d = t->v.fval[pos]; return 0; } return -1; /* failed to find it */ } int fea_value_s(const char *name,int pos,esps_hdr hdr, short *d) { /* Get value of short FEA */ esps_fea t; for (t=hdr->fea; t != NULL; t=t->next) if (streq(name,t->name)) { if (t->dtype != ESPS_SHORT) { fprintf(stderr,"ESPS hdr: access non-short field \"%s\" as short\n", name); return -1; } *d = t->v.sval[pos]; return 0; } return -1; /* failed to find it */ } int fea_value_i(const char *name,int pos,esps_hdr hdr, int *d) { /* Get value of int FEA */ esps_fea t; for (t=hdr->fea; t != NULL; t=t->next) if (streq(name,t->name)) { if (t->dtype != ESPS_INT) { fprintf(stderr,"ESPS hdr: access non-int field \"%s\" as int\n", name); return -1; } *d = t->v.ival[pos]; return 0; } return -1; /* failed to find it */ } int fea_value_c(const char *name,int pos,esps_hdr hdr, char *d) { /* Get value of int FEA */ esps_fea t; for (t=hdr->fea; t != NULL; t=t->next) if (streq(name,t->name)) { if (t->dtype != ESPS_CHAR) { fprintf(stderr,"ESPS hdr: access non-char field \"%s\" as char\n", name); return -1; } *d = t->v.cval[pos]; return 0; } return -1; /* failed to find it */ } static int esps_alloc_fea(esps_fea r) { switch (r->dtype) { case 0: /* nothing */ break; case ESPS_DOUBLE: r->v.dval = walloc(double,r->count); break; case ESPS_FLOAT: r->v.fval = walloc(float,r->count); break; case ESPS_INT: r->v.ival = walloc(int,r->count); break; case ESPS_SHORT: r->v.sval = walloc(short,r->count); break; case ESPS_CHAR: r->v.cval = walloc(char,r->count); break; default: fprintf(stderr,"ESPS file: unsupported FEA dtype\n"); return -1; } return 0; } void write_esps_fea(FILE *fd, esps_fea t,esps_hdr hdr) { /* write out this fea */ (void)hdr; short clength; char *nspace; int i; fwrite(&t->type,2,1,fd); clength = (strlen(t->name)+3)/4; fwrite(&clength,2,1,fd); nspace = walloc(char, clength*4); memset(nspace,0,clength*4); memmove(nspace,t->name,strlen(t->name)); fwrite(nspace,1,clength*4,fd); wfree(nspace); if ((t->type == 11) || (t->type == 1) || (t->type == 15)) return; fwrite(&t->count,4,1,fd); fwrite(&t->dtype,2,1,fd); for (i=0; icount; i++) { switch(t->dtype) { case ESPS_DOUBLE: fwrite(&t->v.dval[i],8,1,fd); break; case ESPS_FLOAT: fwrite(&t->v.fval[i],4,1,fd); break; case ESPS_INT: fwrite(&t->v.ival[i],4,1,fd); break; case ESPS_SHORT: fwrite(&t->v.sval[i],2,1,fd); break; case ESPS_CHAR: fwrite(&t->v.cval[i],1,1,fd); break; default: fprintf(stderr,"ESPS write_hdr: unsupported FEA dtype %d\n", t->dtype); } } return; } int write_esps_rec(esps_rec r, esps_hdr h, FILE *fd) { /* will have to worry about swap someday */ (void)h; int i; for (i=0; i < r->num_fields; i++) { switch(r->field[i]->type) { case ESPS_DOUBLE: fwrite(r->field[i]->v.dval,8,r->field[i]->dimension,fd); break; case ESPS_FLOAT: fwrite(r->field[i]->v.fval,4,r->field[i]->dimension,fd); break; case ESPS_INT: fwrite(r->field[i]->v.ival,4,r->field[i]->dimension,fd); break; case ESPS_SHORT: fwrite(r->field[i]->v.sval,2,r->field[i]->dimension,fd); break; case ESPS_CHAR: fwrite(r->field[i]->v.cval,1,r->field[i]->dimension,fd); break; case ESPS_CODED: fwrite(r->field[i]->v.sval,2,r->field[i]->dimension,fd); break; default: fprintf(stderr,"ESPS file: unsupported field type %d\n", r->field[i]->type); } } return 0; } esps_fea read_esps_fea(FILE *fd, esps_hdr hdr) { /* read next FEA record at point */ esps_fea r = new_esps_fea(); short sdata; int i; int idata; float fdata; double ddata; char cdata; fread(&sdata,2,1,fd); if (hdr->swapped) sdata = SWAPSHORT(sdata); r->type = sdata; if (r->type == 0) /* a field name */ { /* next short is the size in bytes */ fread(&sdata,2,1,fd); if (hdr->swapped) sdata = SWAPSHORT(sdata); r->clength = sdata; } else if ((r->type == 13) || /* a feature and value */ (r->type == 11) || /* a single string (comment ?) */ (r->type == 1) || /* a filename */ (r->type == 4) || /* a filename */ (r->type == 15)) /* directory name */ { fread(&sdata,2,1,fd); if (hdr->swapped) sdata = SWAPSHORT(sdata); r->clength = sdata * 4; } else { fprintf(stderr,"ESPS: fea record unknown type\n"); wfree(r); return NULL; } r->name = walloc(char,r->clength+1); fread(r->name,1,r->clength,fd); r->name[r->clength] = '\0'; if ((r->type == 11) || /* a single string */ (r->type == 1) || /* a filename */ (r->type == 15)) /* directory name */ return r; fread(&idata,4,1,fd); if (hdr->swapped) idata = SWAPINT(idata); r->count = idata; fread(&sdata,2,1,fd); if (hdr->swapped) sdata = SWAPSHORT(sdata); r->dtype = sdata; if (esps_alloc_fea(r) == -1) return NULL; for (i=0; icount; i++) { switch (r->dtype) { case ESPS_DOUBLE: fread(&ddata,8,1,fd); if (hdr->swapped) swapdouble(&ddata); r->v.dval[i] = ddata; break; case ESPS_FLOAT: fread(&fdata,4,1,fd); if (hdr->swapped) swapfloat(&fdata); r->v.fval[i] = fdata; break; case ESPS_INT: fread(&idata,4,1,fd); if (hdr->swapped) idata = SWAPINT(idata); r->v.ival[i] = idata; break; case ESPS_SHORT: fread(&sdata,2,1,fd); if (hdr->swapped) sdata = SWAPSHORT(sdata); r->v.sval[i] = sdata; break; case ESPS_CHAR: fread(&cdata,1,1,fd); r->v.cval[i] = cdata; break; default: fprintf(stderr,"ESPS read_hdr: unsupported FEA dtype %d\n",r->dtype); wfree(r); return NULL; } } return r; } static char *esps_get_field_name(FILE *fd, esps_hdr hdr, int expect_source) { /* read the next field name */ short size=0; /* bet its really a short */ char *name; if (fread(&size,2,1,fd) != 1) { fputs("error reading field name size\n", stderr); return wstrdup("ERROR"); } if (hdr->swapped) size = SWAPSHORT(size); name = walloc(char,size+1); if (fread(name,1,size,fd) != (unsigned)size) { fputs("error reading field name\n", stderr); strncpy(name, "ERROR", size); } name[size] = '\0'; if (hdr->file_type == ESPS_SD || expect_source) fseek(fd,6,SEEK_CUR); /* skip some zeroes */ else fseek(fd,2,SEEK_CUR); if (expect_source) { fread(&size,2,1,fd); if (hdr->swapped) size = SWAPSHORT(size); fseek(fd,size,SEEK_CUR); } return name; } static void esps_put_field_name(char *name,FILE *fd, esps_hdr hdr) { /* write the next field name */ short size = strlen(name); short shortdata; shortdata = 0; fwrite(&shortdata,2,1,fd); fwrite(&size,2,1,fd); fwrite(name,1,size,fd); if (hdr->file_type == ESPS_SD) { shortdata = 0; fwrite(&shortdata,2,1,fd); fwrite(&shortdata,2,1,fd); fwrite(&shortdata,2,1,fd); } return; } esps_hdr new_esps_hdr(void) { esps_hdr h = walloc(struct ESPS_HDR_struct,1); h->file_type = ESPS_FEA; h->swapped = FALSE; h->num_records = 0; h->num_fields = 0; h->field_name = NULL; h->field_type = NULL; h->field_dimension = NULL; h->fea = NULL; return h; } void delete_esps_hdr(esps_hdr h) { int i; if (h != NULL) { if (h->field_name != NULL) { for (i=0; i < h->num_fields; i++) wfree(h->field_name[i]); wfree(h->field_name); } delete_esps_fea(h->fea); } } esps_rec new_esps_rec(esps_hdr hdr) { /* New esps record */ esps_rec r = walloc(struct ESPS_REC_struct,1); int i,size; r->field = walloc(esps_field,hdr->num_fields); for (size=0,i=0; i < hdr->num_fields; i++) { r->field[i]=walloc(struct ESPS_FIELD_struct,1); r->field[i]->type = hdr->field_type[i]; r->field[i]->dimension = hdr->field_dimension[i]; switch(r->field[i]->type) { case ESPS_DOUBLE: r->field[i]->v.dval = walloc(double,r->field[i]->dimension); size += 8; break; case ESPS_FLOAT: r->field[i]->v.fval = walloc(float,r->field[i]->dimension); size += 4; break; case ESPS_INT: r->field[i]->v.ival = walloc(int,r->field[i]->dimension); size += 4; break; case ESPS_SHORT: r->field[i]->v.sval = walloc(short,r->field[i]->dimension); size += 2; break; case ESPS_CHAR: r->field[i]->v.cval = walloc(char,r->field[i]->dimension); size += 1; break; case ESPS_CODED: r->field[i]->v.sval = walloc(short,r->field[i]->dimension); size += 2; break; default: fprintf(stderr,"ESPS file: unsupported field type %d\n", r->field[i]->type); } } r->num_fields = hdr->num_fields; r->size = size; return r; } void delete_esps_rec(esps_rec r) { int i; for (i=0; inum_fields; i++) { wfree(r->field[i]->v.ival); wfree(r->field[i]); } wfree(r->field); return; } int read_esps_rec(esps_rec r, esps_hdr hdr, FILE *fd) { /* read the next record at point */ int i,j; double doubledata; float floatdata; int intdata; short shortdata; for (i=0; i< r->num_fields; i++) { switch (r->field[i]->type) { case ESPS_DOUBLE: for(j=0; j < r->field[i]->dimension; j++) { if (fread(&doubledata,8,1,fd) == 0) return EOF; if (hdr->swapped) swapdouble(&doubledata); r->field[i]->v.dval[j] = doubledata; } break; case ESPS_FLOAT: for(j=0; j < r->field[i]->dimension; j++) { if (fread(&floatdata,4,1,fd) == 0) return EOF; if (hdr->swapped) swapfloat(&floatdata); r->field[i]->v.fval[j] = floatdata; } break; case ESPS_INT: for(j=0; j < r->field[i]->dimension; j++) { if (fread(&intdata,4,1,fd) == 0) return EOF; if (hdr->swapped) intdata = SWAPINT(intdata); r->field[i]->v.ival[j] = intdata; } break; case ESPS_SHORT: for(j=0; j < r->field[i]->dimension; j++) { if (fread(&shortdata,2,1,fd) == 0) return EOF; if (hdr->swapped) shortdata = SWAPSHORT(shortdata); r->field[i]->v.sval[j] = shortdata; } break; case ESPS_CHAR: if (fread(r->field[i]->v.cval,1,r->field[i]->dimension,fd) != (unsigned)r->field[i]->dimension) return EOF; break; case ESPS_CODED: for(j=0; j < r->field[i]->dimension; j++) { if (fread(&shortdata,2,1,fd) == 0) return EOF; if (hdr->swapped) shortdata = SWAPSHORT(shortdata); r->field[i]->v.sval[j] = shortdata; } break; default: fprintf(stderr,"ESPS file: unsupported field type %d\n", r->field[i]->type); return EOF; } } return 0; } double get_field_d(esps_rec r, int field, int pos) { return r->field[field]->v.dval[pos]; } float get_field_f(esps_rec r, int field, int pos) { return r->field[field]->v.fval[pos]; } int get_field_i(esps_rec r, int field, int pos) { return r->field[field]->v.ival[pos]; } short get_field_s(esps_rec r, int field, int pos) { return r->field[field]->v.sval[pos]; } char get_field_c(esps_rec r, int field, int pos) { return r->field[field]->v.cval[pos]; } void set_field_d(esps_rec r, int field, int pos, double d) { r->field[field]->v.dval[pos] = d; } void set_field_f(esps_rec r, int field, int pos, float d) { r->field[field]->v.fval[pos] = d; } void set_field_i(esps_rec r, int field, int pos, int d) { r->field[field]->v.ival[pos] = d; } void set_field_s(esps_rec r, int field, int pos, short d) { r->field[field]->v.sval[pos] = d; } void set_field_c(esps_rec r, int field, int pos, char d) { r->field[field]->v.cval[pos] = d; } int esps_record_size(esps_hdr hdr) { /* works out the number of bytes in a record */ esps_rec r = new_esps_rec(hdr); int size = r->size; delete_esps_rec(r); return size; } static int esps_num_of_type(int type,esps_hdr hdr) { /* counts up the number of occurrences of fields of type in a record */ int i; int sum; for (sum=i=0; i < hdr->num_fields; i++) if (hdr->field_type[i] == type) sum++; return sum; } esps_hdr make_esps_sd_hdr(void) { /* returns a basic header for an ESPS_SD file */ esps_hdr hdr = new_esps_hdr(); hdr->file_type = ESPS_SD; return hdr; } esps_hdr make_esps_hdr(void) { /* returns a basic header for an ESPS_SD file */ esps_hdr hdr = new_esps_hdr(); hdr->file_type = ESPS_FEA; return hdr; } enum EST_read_status read_esps_hdr(esps_hdr *uhdr,FILE *fd) { /* reads an ESPS header from fd at point (should be position 0) */ /* leaves point at start of data (immediately after header) */ struct ESPS_PREAMBLE preamble; struct ESPS_FIXED_HDR fhdr; esps_hdr hdr; int end,pos,intdata,i; short shortdata; double sd_sample_rate; int typematch; int swap; short name_flag; fread(&preamble,sizeof(preamble),1,fd); if (preamble.check == ESPS_MAGIC) swap = FALSE; else if (preamble.check == SWAPINT(ESPS_MAGIC)) swap = TRUE; else return wrong_format; hdr = new_esps_hdr(); hdr->swapped = swap; fread(&fhdr,sizeof(fhdr),1,fd); if (hdr->swapped) { preamble.data_offset = SWAPINT(preamble.data_offset); preamble.record_size = SWAPINT(preamble.record_size); fhdr.num_samples = SWAPINT(fhdr.num_samples); fhdr.num_doubles = SWAPINT(fhdr.num_doubles); fhdr.num_floats = SWAPINT(fhdr.num_floats); fhdr.num_ints = SWAPINT(fhdr.num_ints); fhdr.num_shorts = SWAPINT(fhdr.num_shorts); fhdr.num_chars = SWAPINT(fhdr.num_chars); fhdr.fea_type = SWAPSHORT(fhdr.fea_type); fhdr.num_fields = SWAPSHORT(fhdr.num_fields); } pos = ftell(fd); if (fhdr.num_samples == 0) /* has to be derived from the file size */ { pos = ftell(fd); fseek(fd,0,SEEK_END); end = ftell(fd); fseek(fd,pos,SEEK_SET); fhdr.num_samples = (end - preamble.data_offset)/preamble.record_size; } hdr->num_records = fhdr.num_samples; hdr->num_fields = fhdr.num_fields; hdr->hdr_size = preamble.data_offset; if (fhdr.thirteen == 9) { /* esps identifies such files are as Sample Data Files */ hdr->file_type = ESPS_SD; /* fake the rest to make it appear like other SD files */ hdr->num_fields = 1; hdr->field_dimension = walloc(int,hdr->num_fields); hdr->field_dimension[0] = 1; hdr->field_type = walloc(short,hdr->num_fields); hdr->field_type[0] = ESPS_SHORT; hdr->field_name = walloc(char *,1); hdr->field_name[0] = wstrdup("samples"); fseek(fd,hdr->hdr_size,SEEK_SET); /* In this cases its just in the header as a float */ sd_sample_rate = *((float *)&fhdr.fil4[0]); add_fea_d(hdr,"record_freq",0,(double)sd_sample_rate); *uhdr = hdr; return format_ok; } else if ((fhdr.fea_type == 8) && (hdr->num_fields == 1) && ((fhdr.num_shorts*2) == preamble.record_size)) hdr->file_type = ESPS_SD; /* this is a heuristic */ else hdr->file_type = ESPS_FEA; /* Now we have the field descriptions */ /* 0000 0001 dimensions */ hdr->field_dimension = walloc(int,hdr->num_fields); for (i=0; inum_fields; i++) { fread(&intdata,4,1,fd); /* dimensions */ if (hdr->swapped) intdata = SWAPINT(intdata); hdr->field_dimension[i] = intdata; } /* 0 -> num_fields-1 -- probably ordering information */ fseek(fd,hdr->num_fields*4,SEEK_CUR); /* ordering info */ fseek(fd,hdr->num_fields*2,SEEK_CUR); /* zeros */ hdr->field_type = walloc(short,hdr->num_fields); for (i=0; inum_fields; i++) { fread(&shortdata,2,1,fd); /* field types */ if (hdr->swapped) shortdata = SWAPSHORT(shortdata); hdr->field_type[i] = shortdata; } typematch = TRUE; fread(&intdata,4,1,fd); /* number of doubles */ if (hdr->swapped) intdata = SWAPINT(intdata); if (fhdr.num_doubles != intdata) typematch = FALSE; fread(&intdata,4,1,fd); /* number of floats */ if (hdr->swapped) intdata = SWAPINT(intdata); if (fhdr.num_floats != intdata) typematch = FALSE; fread(&intdata,4,1,fd); /* number of ints */ if (hdr->swapped) intdata = SWAPINT(intdata); if (fhdr.num_ints != intdata) typematch = FALSE; fread(&intdata,4,1,fd); /* number of shorts */ if (hdr->swapped) intdata = SWAPINT(intdata); if (fhdr.num_shorts != intdata) typematch = FALSE; fread(&intdata,4,1,fd); /* number of chars */ if (hdr->swapped) intdata = SWAPINT(intdata); if (fhdr.num_chars != intdata) typematch = FALSE; if ((hdr->file_type != ESPS_SD) && (typematch == FALSE)) { fprintf(stderr,"ESPS hdr: got lost in the header (record description)\n"); delete_esps_hdr(hdr); return misc_read_error; } /* other types ... */ fseek(fd,9*2,SEEK_CUR); /* other types */ fseek(fd,hdr->num_fields*2,SEEK_CUR); /* zeros */ /* Now we can read the field names */ hdr->field_name = walloc(char *,hdr->num_fields); fread(&name_flag, 2, 1, fd); if (hdr->swapped) name_flag = SWAPSHORT(name_flag); for (i=0; i < hdr->num_fields; i++) hdr->field_name[i] = esps_get_field_name(fd,hdr,name_flag); /* field names */ if (hdr->file_type == ESPS_SD) { /* Only one field 'samples' */ if (!streq(hdr->field_name[0],"samples")) { fprintf(stderr,"ESPS hdr: guessed wrong about FEA_SD file (no 'samples' field)\n"); delete_esps_hdr(hdr); return misc_read_error; } } /* Now fea, feature and value -- but how many are there ? */ while (ftell(fd) < preamble.data_offset-4) { esps_fea r = read_esps_fea(fd,hdr); /* feas */ if (r == NULL) break; /* print_esps_fea(r); */ r->next = hdr->fea; hdr->fea = r; if (r->type == 1) break; /* I think this (filename) is last FEA */ } /* There's other gunk after this but I think I've done enough */ /* The rest seems to be mostly previous headers */ fseek(fd,hdr->hdr_size,SEEK_SET); /* skip the rest of the header */ *uhdr = hdr; return format_ok; } enum EST_write_status write_esps_hdr(esps_hdr hdr,FILE *fd) { /* well here's the scary part, try to write a valid file hdr to */ /* the file */ struct ESPS_PREAMBLE preamble; struct ESPS_FIXED_HDR fhdr; time_t tx = time(0); esps_fea t; int i,intdata; short shortdata; memset(&preamble,0,sizeof(preamble)); memset(&fhdr,0,sizeof(fhdr)); /* I can't really make the machine code work properly, so I'll */ /* just fix it for the two major byte orders to Sun and Suni386 */ if (EST_NATIVE_BO == bo_big) preamble.machine_code = 4; /* a sun */ else preamble.machine_code = 6; /* a suni386 */ preamble.check_code = 3000; /* ? */ preamble.data_offset = 0; /* will come back and fix this later */ preamble.record_size = esps_record_size(hdr); preamble.check = ESPS_MAGIC; preamble.edr = 0; preamble.fil1 = 0; preamble.foreign_hd = 0; /* docs say it should be -1, but its always 0 */ fhdr.thirteen = 13; /* must be for luck */ fhdr.sdr_size = 0; fhdr.magic = ESPS_MAGIC; strncpy(fhdr.date,ctime(&tx),26); sprintf(fhdr.version,"1.91"); /* that's what all the others have */ sprintf(fhdr.prog,"EDST"); sprintf(fhdr.vers,"0.1"); strncpy(fhdr.progcompdate,ctime(&tx),26); fhdr.num_samples = hdr->num_records; fhdr.filler = 0; /* in each record */ fhdr.num_doubles = esps_num_of_type(ESPS_DOUBLE,hdr); fhdr.num_floats = esps_num_of_type(ESPS_FLOAT,hdr); fhdr.num_ints = esps_num_of_type(ESPS_INT,hdr); fhdr.num_shorts = esps_num_of_type(ESPS_SHORT,hdr); fhdr.num_chars = esps_num_of_type(ESPS_CHAR,hdr); fhdr.fsize = 40; fhdr.hsize = 0; /* given value below on second shot */ if (hdr->file_type == ESPS_SD) fhdr.fea_type = 8; else fhdr.fea_type = 0; fhdr.num_fields = hdr->num_fields; fwrite(&preamble,sizeof(preamble),1,fd); fwrite(&fhdr,sizeof(fhdr),1,fd); /* The following cover dimensions, type and ordering info */ for (i=0; i < hdr->num_fields; i++) { /* Dimensions (i.e. number of channels) */ intdata = 1; fwrite(&intdata,4,1,fd); /* dimensions */ } for (i=0; i < hdr->num_fields; i++) /* ordering info (?) */ fwrite(&i,4,1,fd); if (hdr->file_type == ESPS_SD) /* zeros hmm should be zeroes only */ shortdata = 1; /* is FEA case, 1 in ESPS_SD case */ else /* fixed 24/7/98 */ shortdata = 0; for (i=0; i < hdr->num_fields; i++) fwrite(&shortdata,2,1,fd); for (i=0; i < hdr->num_fields; i++) { shortdata = hdr->field_type[0]; /* field types */ fwrite(&shortdata,2,1,fd); } intdata = fhdr.num_doubles; /* number of doubles */ fwrite(&intdata,4,1,fd); intdata = fhdr.num_floats; /* number of floats */ fwrite(&intdata,4,1,fd); intdata = fhdr.num_ints; /* number of ints */ fwrite(&intdata,4,1,fd); intdata = fhdr.num_shorts; /* number of shorts */ fwrite(&intdata,4,1,fd); intdata = fhdr.num_chars; /* number of chars */ fwrite(&intdata,4,1,fd); shortdata = 0; for (i=0; i < 9; i++) fwrite(&shortdata,2,1,fd); /* other types */ for (i=0; i < hdr->num_fields; i++) fwrite(&shortdata,2,1,fd); /* zeros */ /* Now dump the filednames */ for (i=0; i < hdr->num_fields; i++) esps_put_field_name(hdr->field_name[i],fd,hdr); /* field names */ if (hdr->file_type != ESPS_SD) fwrite(&shortdata,2,1,fd); /* another 0 */ /* Now the feas */ for (t=hdr->fea; t != NULL; t=t->next) write_esps_fea(fd,t,hdr); /* feas */ /* now have to go back and fix the header size */ intdata = 0; fwrite(&intdata,4,1,fd); preamble.data_offset = ftell(fd); fhdr.hsize = (preamble.data_offset-249)/2; if (fseek(fd,0,SEEK_SET) == -1) { fprintf(stderr,"esps write header: can't fseek to start of file\n"); return misc_write_error; } fwrite(&preamble,sizeof(preamble),1,fd); fwrite(&fhdr,sizeof(fhdr),1,fd); fseek(fd,preamble.data_offset,SEEK_SET); return write_ok; } speech_tools/speech_class/EST_wave_io.cc0000644000076400007640000013212611260664620017000 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black and Paul Taylor */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* File I/O functions specific to various file formats */ /* */ /* Note that internally data will always be shorts and */ /* native byte order, conversions to/from other byte formats */ /* or encodings happend at read/write time */ /* */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include "EST_wave_aux.h" #include "EST_wave_utils.h" #include "EST_strcasecmp.h" #include "waveP.h" #include "EST_FileType.h" static int def_load_sample_rate = 16000; /*************************************************************************/ /* */ /* Functions specific for each file format */ /* */ /*************************************************************************/ /*=======================================================================*/ /* Sphere Nist files */ /*=======================================================================*/ static const char *NIST_SIG = "NIST_1A\n 1024\n"; static const char *NIST_END_SIG = "end_head\n"; #define NIST_HDR_SIZE 1024 int nist_get_param_int(const char *hdr, const char *field, int def_val) { const char *p; int val; if (((p=strstr(hdr,field)) != NULL) && (strncmp(" -i ",p+strlen(field),4) == 0)) { sscanf(p+strlen(field)+4,"%d",&val); return val; } else return def_val; } char *nist_get_param_str(const char *hdr, const char *field, const char *def_val) { const char *p; char *val; int size; if (((p=strstr(hdr,field)) != NULL) && (strncmp(" -s",p+strlen(field),3) == 0)) { sscanf(p+strlen(field)+3,"%d",&size); val = walloc(char,size+1); /* Hmm don't know how long the %d is so do it again */ sscanf(p+strlen(field)+3,"%d %s",&size,val); return val; } else return wstrdup(def_val); } const char *sample_type_to_nist(enum EST_sample_type_t sample_type) { const char *c; switch (sample_type) { case st_unknown: c = ""; break; case st_schar: c = "PCM-1"; break; case st_mulaw: c = "ULAW"; break; case st_short: c = "pcm"; break; case st_int: c = "PCM-4"; break; case st_float: c = "REAL"; break; case st_double: c = "REAL"; break; default: fprintf(stderr,"Unknown sample type for nist"); c = ""; } return c; } enum EST_sample_type_t nist_to_sample_type(char *type) { if ((streq(type,"pcm")) || (streq(type,"PCM")) || (streq(type,"pcm-2"))) return st_short; if (strcmp(type,"pcm,embedded-shorten-v1.1") == 0) return st_shorten; else if ((EST_strcasecmp(type,"ULAW",NULL) == 0) || (EST_strcasecmp(type,"U-LAW",NULL) == 0) || (EST_strcasecmp(type,"mu-law",NULL) == 0) || (EST_strcasecmp(type,"mulaw",NULL) == 0)) return st_mulaw; else if (strcmp(type,"alaw") == 0) return st_alaw; else if (strcmp(type,"PCM-1") == 0) return st_schar; else if (strcmp(type,"PCM-4") == 0) return st_int; else if (strcmp(type,"REAL") == 0) return st_float; else { fprintf(stderr,"NIST: unknown sample type: %s\n",type); return st_unknown; } } enum EST_read_status load_wave_nist(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo , int offset, int length) { char header[NIST_HDR_SIZE]; int samps,sample_width,data_length,actual_bo; unsigned char *file_data; enum EST_sample_type_t actual_sample_type; char *byte_order, *sample_coding; int n; int current_pos; current_pos = ts.tell(); if (ts.fread(header,NIST_HDR_SIZE,1) != 1) return wrong_format; if (strncmp(header,NIST_SIG,sizeof(NIST_SIG)) != 0) return wrong_format; samps = nist_get_param_int(header,"sample_count",-1); *num_channels = nist_get_param_int(header,"channel_count",1); sample_width = nist_get_param_int(header,"sample_n_bytes",2); *sample_rate = nist_get_param_int(header,"sample_rate",def_load_sample_rate); byte_order = nist_get_param_str(header,"sample_byte_format", (EST_BIG_ENDIAN ? "10" : "01")); sample_coding = nist_get_param_str(header,"sample_coding","pcm"); if (streq(byte_order,"mu-law")) { byte_order = wstrdup((EST_BIG_ENDIAN ? "10" : "01")); sample_coding = wstrdup("ULAW"); } /* code for reading in Tony Robinson's shorten files. This is a temporary fix which calls the unshorten program on the speech file and reads in the answer by calling this function. It would be nice to have a simple library routine which did the unshortening. */ if (streq(sample_coding,"pcm,embedded-shorten-v1.1")) { char *tmpfile, *cmdstr; enum EST_read_status rval; tmpfile = cmake_tmp_filename(); cmdstr = walloc(char,strlen(tmpfile)+200); sprintf(cmdstr,"cstrshorten %s %s", (const char*)ts.filename(),tmpfile); printf("Command: %s\n", cmdstr); system(cmdstr); EST_TokenStream tt; tt.open(tmpfile); rval = load_wave_nist(tt, data, num_samples, num_channels, word_size, sample_rate, sample_type, bo, offset, length); unlink(tmpfile); wfree(tmpfile); wfree(cmdstr); tt.close(); return rval; } if (length == 0) data_length = (samps - offset)*(*num_channels); else data_length = length*(*num_channels); file_data = walloc(unsigned char,sample_width * data_length); ts.seek(current_pos+NIST_HDR_SIZE+(sample_width*offset*(*num_channels))); n = ts.fread(file_data,sample_width,data_length); if ((n < 1) && (n != data_length)) { wfree(file_data); wfree(sample_coding); wfree(byte_order); return misc_read_error; } else if ((n < data_length) && (data_length/(*num_channels) == n)) { fprintf(stderr,"WAVE read: nist header is (probably) non-standard\n"); fprintf(stderr,"WAVE read: assuming different num_channel interpretation\n"); data_length = n; /* wrongly headered file */ } else if (n < data_length) { fprintf(stderr,"WAVE read: short file %s\n", (const char *)ts.filename()); fprintf(stderr,"WAVE read: at %d got %d instead of %d samples\n", offset,n,data_length); data_length = n; } actual_sample_type = nist_to_sample_type(sample_coding); actual_bo = ((strcmp(byte_order,"10") == 0) ? bo_big : bo_little); *data = convert_raw_data(file_data,data_length, actual_sample_type,actual_bo); *num_samples = data_length/ (*num_channels); *sample_type = st_short; *bo = EST_NATIVE_BO; *word_size = 2; wfree(sample_coding); wfree(byte_order); return format_ok; } enum EST_write_status save_wave_nist(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { char h[1024], p[1024]; const char *t; memset(h,0,1024); strcat(h, NIST_SIG); sprintf(p, "channel_count -i %d\n", num_channels); strcat(h, p); sprintf(p, "sample_count -i %d\n", num_samples); strcat(h, p); sprintf(p, "sample_rate -i %d\n", sample_rate); strcat(h, p); t = sample_type_to_nist(sample_type); if (t) { sprintf(p, "sample_coding -s%d %s\n", (signed)strlen(t), t); strcat(h, p); sprintf(p, "sample_n_bytes -i %d\n", get_word_size(sample_type)); strcat(h, p); } if (get_word_size(sample_type) > 1) { sprintf(p, "sample_byte_format -s%d %s\n", 2, ((bo == bo_big) ? "10" : "01")); strcat(h, p); } strcat(h, NIST_END_SIG); /*makes it nice to read */ strcat(h, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); if (fwrite(&h, 1024, 1, fp) != 1) return misc_write_error; return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,bo); } /*=======================================================================*/ /* EST's own format */ /*=======================================================================*/ enum EST_read_status load_wave_est(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length) { int data_length, actual_bo; short *file_data; EST_String byte_order; int n; EST_EstFileType t; EST_Option hinfo; bool ascii; EST_read_status r; EST_sample_type_t actual_sample_type; offset = 0; if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_wave) return misc_read_error; *num_samples = hinfo.ival("NumSamples"); *num_channels = hinfo.ival("NumChannels"); *sample_rate = hinfo.ival("SampleRate"); byte_order = hinfo.val("ByteOrder"); if (length == 0) data_length = (*num_samples)*(*num_channels); else data_length = length*(*num_channels); file_data = walloc(short, data_length); n = ts.fread(file_data, sizeof(short), data_length); if ((n != data_length) && (n < 1)) { cerr << "EST wave load: " << ts.pos_description() << endl; cerr << "failed to read file\n"; wfree(file_data); return misc_read_error; } else if (n != data_length) { cerr << "Wrong number of samples/channels in EST wave file\n"; cerr << ts.pos_description() << " "; cerr << "expected " << data_length << " got " << n << endl; data_length = n; } actual_bo = (byte_order == "10") ? bo_big : bo_little; if (hinfo.present("SampleType")) actual_sample_type = str_to_sample_type(hinfo.val("SampleType")); else actual_sample_type = st_short; // some older files don't have this *data = convert_raw_data((unsigned char *)file_data, data_length, actual_sample_type, actual_bo); // because internally data is always shorts *sample_type = st_short; *bo = EST_NATIVE_BO; *word_size = 2; return format_ok; } enum EST_write_status save_wave_est(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { fprintf(fp, "EST_File wave\n"); fprintf(fp, "DataType binary\n"); fprintf(fp, "SampleRate %d\n", sample_rate); fprintf(fp, "NumSamples %d\n", num_samples); fprintf(fp, "NumChannels %d\n", num_channels); fprintf(fp, "SampleType %s\n", sample_type_to_str(sample_type)); if (get_word_size(sample_type) > 1) fprintf(fp, "ByteOrder %s\n", ((bo == bo_big) ? "10" : "01")); fprintf(fp, "EST_Header_End\n"); return save_raw_data(fp, data, offset, num_samples, num_channels, sample_type, bo); } /*=======================================================================*/ /* Microsoft RIFF (.wav) audio files */ /* */ /* The information on this format was gained by reading a document */ /* found on the net called "Multimedia Programming Interface and */ /* Data Specification v1.0" and by looking at Rick Richardson, */ /* Lance Norskog And Sundry Contributors code in SOX. All this code */ /* is rewritten from scratch though, but I couldn't do it without */ /* other's explanations. I would have used the SOX code directly but */ /* was not really in the right form so starting again was easier */ /*=======================================================================*/ #define WAVE_FORMAT_PCM 0x0001 #define WAVE_FORMAT_ADPCM 0x0002 #define WAVE_FORMAT_ALAW 0x0006 #define WAVE_FORMAT_MULAW 0x0007 enum EST_read_status load_wave_riff(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo , int offset, int length) { char info[4]; int samps,sample_width,data_length; short shortdata; int dsize,intdata; unsigned char *file_data; enum EST_sample_type_t actual_sample_type; if (ts.fread(info,sizeof(char),4) != 4) return wrong_format; /* its almost definitely an error */ if (strncmp(info,"RIFF",4) != 0) return wrong_format; /* We've got a riff file */ ts.fread(&dsize,4,1); /* .wav files are always little endian */ if (EST_BIG_ENDIAN) dsize = SWAPINT(dsize); if ((ts.fread(info,sizeof(char),4) != 4) || (strncmp(info,"WAVE",4) != 0)) { fprintf(stderr, "RIFF file is not of type WAVE\n"); return misc_read_error; /* not a wave file */ } if ((ts.fread(info,sizeof(char),4) != 4) || (strncmp(info,"fmt ",4) != 0)) return misc_read_error; /* something else wrong */ ts.fread(&dsize,4,1); if (EST_BIG_ENDIAN) dsize = SWAPINT(dsize); ts.fread(&shortdata,2,1); if (EST_BIG_ENDIAN) shortdata = SWAPSHORT(shortdata); switch (shortdata) { /* This is a non-proprietary format */ case WAVE_FORMAT_PCM: actual_sample_type = st_short; break; /* The follow are registered proprietary WAVE formats (?) */ case WAVE_FORMAT_MULAW: actual_sample_type = st_mulaw; break; case WAVE_FORMAT_ADPCM: fprintf(stderr, "RIFF file: unsupported proprietary sample format ADPCM\n"); actual_sample_type = st_short; break; /* actual_sample_type = st_adpcm; break; */ /* yes but which adpcm ! */ case WAVE_FORMAT_ALAW: default: fprintf(stderr, "RIFF file: unknown sample format\n"); actual_sample_type = st_short; /* return misc_read_error; */ } ts.fread(&shortdata,2,1); if (EST_BIG_ENDIAN) shortdata = SWAPSHORT(shortdata); *num_channels = shortdata; ts.fread(sample_rate,4,1); if (EST_BIG_ENDIAN) *sample_rate = SWAPINT(*sample_rate); ts.fread(&intdata,4,1); /* average bytes per second -- ignored */ if (EST_BIG_ENDIAN) intdata = SWAPINT(intdata); ts.fread(&shortdata,2,1); /* block align ? */ if (EST_BIG_ENDIAN) shortdata = SWAPSHORT(shortdata); ts.fread(&shortdata,2,1); if (EST_BIG_ENDIAN) shortdata = SWAPSHORT(shortdata); sample_width = (shortdata+7)/8; if ((sample_width == 1) && (actual_sample_type == st_short)) actual_sample_type = st_uchar; /* oops I meant 8 bit */ ts.seek((dsize-16)+ts.tell()); /* skip rest of header */ while (1) { if (ts.fread(info,sizeof(char),4) != 4) { fprintf(stderr,"RIFF file truncated\n"); return misc_read_error; /* something else wrong */ } if (strncmp(info,"data",4) == 0) { ts.fread(&samps,4,1); if (EST_BIG_ENDIAN) samps = SWAPINT(samps); samps /= (sample_width*(*num_channels)); break; } else if (strncmp(info,"fact",4) == 0) { /* some other type of chunk -- skip it */ ts.fread(&samps,4,1); if (EST_BIG_ENDIAN) samps = SWAPINT(samps); ts.seek(samps+ts.tell()); /* skip rest of header */ /* Hope this is the right amount */ } else { // fprintf(stderr,"Ignoring unsupported chunk type \"%c%c%c%c\" in RIFF file\n", // info[0],info[1],info[2],info[3]); //return misc_read_error; ts.fread(&dsize,4,1); if (EST_BIG_ENDIAN) dsize = SWAPINT(dsize); ts.seek(dsize+ts.tell()); /* skip this chunk */ } } if (length == 0) data_length = (samps - offset)*(*num_channels); else data_length = length*(*num_channels); file_data = walloc(unsigned char,sample_width * data_length); ts.seek((sample_width*offset*(*num_channels))+ts.tell()); if ((dsize=ts.fread(file_data,sample_width,data_length)) != data_length) { /* It seems so many WAV files have their datasize wrong I'll */ /* let it through -- I think SOX is a major culprit */ if (length == 0) /* the file did the identification */ fprintf(stderr,"Unexpected end of file but continuing (apparently missing %d samples)\n",data_length-dsize); else { fprintf(stderr,"Unexpected end of file: (missing %d samples)\n",data_length-dsize); wfree(file_data); return misc_read_error; } } *data = convert_raw_data(file_data,dsize, actual_sample_type, bo_little); *num_samples = dsize / (*num_channels); *sample_type = st_short; *bo = EST_NATIVE_BO; *word_size = 2; return format_ok; } enum EST_write_status save_wave_riff(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)bo; const char *info; int data_size, data_int; short data_short; if (sample_type == st_schar) { EST_warning("RIFF format: Signed 8-bit not allowed by this file format"); sample_type=st_uchar; } info = "RIFF"; fwrite(info,4,1,fp); data_size = num_channels*num_samples*get_word_size(sample_type)+ 8+16+12; /* WAV files are always LITTLE_ENDIAN (i.e. intel x86 format) */ if (EST_BIG_ENDIAN) data_size = SWAPINT(data_size); fwrite(&data_size,1,4,fp); /* total number of bytes in file */ info = "WAVE"; fwrite(info,4,1,fp); info = "fmt "; fwrite(info,4,1,fp); data_size = 16; if (EST_BIG_ENDIAN) data_size = SWAPINT(data_size); fwrite(&data_size,1,4,fp); /* size of header */ switch (sample_type) { case st_short: data_short = WAVE_FORMAT_PCM; break; case st_uchar: data_short = WAVE_FORMAT_PCM; break; case st_mulaw: data_short = WAVE_FORMAT_MULAW; break; case st_alaw: data_short = WAVE_FORMAT_ALAW; break; case st_adpcm: data_short = WAVE_FORMAT_ADPCM; break; default: fprintf(stderr,"RIFF format: unsupported data format %d\n", sample_type); return misc_write_error; } if (EST_BIG_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); /* sample type */ data_short = num_channels; if (EST_BIG_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); /* number of channels */ data_int = sample_rate; if (EST_BIG_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); /* sample rate */ data_int = sample_rate * num_channels * get_word_size(sample_type); if (EST_BIG_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); /* Average bytes per second */ data_short = num_channels * get_word_size(sample_type); if (EST_BIG_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); /* block align */ data_short = get_word_size(sample_type) * 8; if (EST_BIG_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); /* bits per sample */ info = "data"; fwrite(info,4,1,fp); data_size = num_channels*num_samples*get_word_size(sample_type); if (EST_BIG_ENDIAN) data_size = SWAPINT(data_size); fwrite(&data_size,1,4,fp); /* total number of bytes in data */ return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,bo_little); } /*=======================================================================*/ /* Amiga/Apple AIFF waveform format */ /* This was constructed using info in AudioIFF1.3.hqx found on the web */ /* and also I did look at SOX's aiff.c written by Guido van Rossum */ /* and Sundry Contributors. */ /*=======================================================================*/ struct AIFFchunk { char id[4]; int size; }; struct AIFFssnd { /* Sound Data Chunk */ int offset; int blocksize; }; enum EST_read_status load_wave_aiff(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo , int offset, int length) { char info[4]; struct AIFFchunk chunk; short comm_channels; int comm_samples; short comm_bits; unsigned char ieee_ext_sample_rate[10]; struct AIFFssnd ssndchunk; enum EST_sample_type_t actual_sample_type; int dsize,data_length,n; unsigned char *file_data; if (ts.fread(info,sizeof(char),4) != 4) return wrong_format; /* but its almost definitely an error */ if (strncmp(info,"FORM",4) != 0) return wrong_format; /* We've got an aiff file, I hope */ ts.fread(&dsize,4,1); if (EST_LITTLE_ENDIAN) /* file is in different byte order */ dsize = SWAPINT(dsize); if ((ts.fread(info,sizeof(char),4) != 4) || (strncmp(info,"AIFF",4) != 0)) { fprintf(stderr, "AIFF file does not have AIFF chunk\n"); return misc_read_error; } for ( ; ts.fread(&chunk,1,sizeof(chunk)) == sizeof(chunk) ; ) { /* for each chunk in the file */ if (EST_LITTLE_ENDIAN) /* file is in different byte order */ chunk.size = SWAPINT(chunk.size); if (strncmp(chunk.id,"COMM",4) == 0) { if (chunk.size != 18) { fprintf(stderr,"AIFF chunk: bad size\n"); return misc_read_error; } ts.fread(&comm_channels,1,sizeof(short)); ts.fread(&comm_samples,1,sizeof(int)); ts.fread(&comm_bits,1,sizeof(short)); if (ts.fread(ieee_ext_sample_rate,1,10) != 10) { fprintf(stderr,"AIFF chunk: eof within COMM chunk\n"); return misc_read_error; } if (EST_LITTLE_ENDIAN) { comm_channels = SWAPSHORT(comm_channels); comm_samples = SWAPINT(comm_samples); comm_bits = SWAPSHORT(comm_bits); } *sample_rate = (int)ConvertFromIeeeExtended(ieee_ext_sample_rate); } else if (strncmp(chunk.id,"SSND",4) == 0) { if (ts.fread(&ssndchunk,1,sizeof(ssndchunk)) != sizeof(ssndchunk)) { fprintf(stderr,"AIFF chunk: eof within SSND chunk\n"); return misc_read_error; } if (EST_LITTLE_ENDIAN) { ssndchunk.offset = SWAPINT(ssndchunk.offset); ssndchunk.blocksize = SWAPINT(ssndchunk.blocksize); } *num_channels = comm_channels; switch (comm_bits) { case 8: actual_sample_type = st_uchar; break; case 16: actual_sample_type = st_short; break; default: fprintf(stderr,"AIFF: unsupported sample width %d bits\n", comm_bits); return misc_read_error; } ts.seek(ssndchunk.offset+(comm_channels*offset)+ts.tell()); if (length == 0) data_length = (comm_samples-offset)*comm_channels; else data_length = length*comm_channels; file_data = walloc(unsigned char, data_length*comm_channels* get_word_size(actual_sample_type)); if ((n=ts.fread(file_data,get_word_size(actual_sample_type), data_length)) != data_length) { fprintf(stderr,"AIFF read: short file %s\n", (const char *)ts.filename()); fprintf(stderr,"AIFF read: at %d got %d instead of %d samples\n", offset,n,data_length); data_length = n; } *data = convert_raw_data(file_data,data_length, actual_sample_type,bo_big); *num_samples = data_length/comm_channels; *sample_type = st_short; *word_size = 2; *bo = EST_NATIVE_BO; break; /* only care about the first SSND chunk */ } else { /* skip bytes in chunk */ ts.seek(ts.tell()+chunk.size); } } return format_ok; } enum EST_write_status save_wave_aiff(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)bo; const char *info; int data_size, data_int; unsigned char ieee_ext_buf[10]; short data_short; info = "FORM"; fwrite(info,1,4,fp); /* This number seems to be derived different for each example */ data_size = 54+(num_samples*num_channels*get_word_size(sample_type)); if (EST_LITTLE_ENDIAN) data_size = SWAPINT(data_size); fwrite(&data_size,1,4,fp); info = "AIFF"; fwrite(info,1,4,fp); info = "COMM"; fwrite(info,1,4,fp); data_int = 18; if (EST_LITTLE_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); data_short = num_channels; if (EST_LITTLE_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); data_int = num_samples; if (EST_LITTLE_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); data_short = 8*get_word_size(sample_type); if (EST_LITTLE_ENDIAN) data_short = SWAPSHORT(data_short); fwrite(&data_short,1,2,fp); ConvertToIeeeExtended((double)sample_rate,ieee_ext_buf); fwrite(ieee_ext_buf,1,10,fp); info = "SSND"; fwrite(info,1,4,fp); data_int = 8 + (num_samples*num_channels*get_word_size(sample_type)); if (EST_LITTLE_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); data_int = 0; if (EST_LITTLE_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); /* offset */ if (EST_LITTLE_ENDIAN) data_int = SWAPINT(data_int); fwrite(&data_int,1,4,fp); /* blocksize */ if ((sample_type == st_short) || (sample_type == st_uchar)) return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,bo_big); else { fprintf(stderr,"AIFF: requested data type not uchar or short\n"); return misc_write_error; } } /*=======================================================================*/ /* ulaw EST_filetype are just raw data with 8K ulaw contents */ /*=======================================================================*/ enum EST_read_status load_wave_ulaw(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length) { unsigned char *ulaw; int data_length,samps; ts.seek_end(); samps = ts.tell(); if (length == 0) data_length = samps - offset; else data_length = length; ulaw = walloc(unsigned char, data_length); ts.seek(offset); if (ts.fread(ulaw,1,data_length) != data_length) { wfree(ulaw); return misc_read_error; } *data = walloc(short,data_length); ulaw_to_short(ulaw,*data,data_length); wfree(ulaw); *num_samples = data_length; *sample_rate = 8000; *num_channels = 1; *sample_type = st_short; *word_size = 2; *bo = EST_NATIVE_BO; return format_ok; } enum EST_write_status save_wave_ulaw(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)sample_rate; (void)sample_type; return save_wave_raw(fp,data,offset,num_samples,num_channels, 8000,st_mulaw,bo); } /*=======================================================================*/ /* Sun and Next snd files */ /*=======================================================================*/ typedef struct { unsigned int magic; /* magic number */ unsigned int hdr_size; /* size of this header */ int data_size; /* length of data (optional) */ unsigned int encoding; /* data encoding format */ unsigned int sample_rate; /* samples per second */ unsigned int channels; /* number of interleaved channels */ } Sun_au_header; enum EST_read_status load_wave_snd(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate,enum EST_sample_type_t *sample_type, int *bo , int offset, int length) { /* Header structures */ Sun_au_header header; enum EST_sample_type_t encoding_type; int data_length, sample_width, bytes, samps, n; unsigned char *file_data; int current_pos; current_pos = ts.tell(); ts.fread(&header, sizeof(Sun_au_header), 1); /* test for magic number */ if ((EST_LITTLE_ENDIAN) && ((unsigned int)0x2e736e64 == SWAPINT(header.magic))) { /* wrong byte order, swap header */ header.hdr_size = SWAPINT(header.hdr_size); header.data_size = SWAPINT(header.data_size); header.encoding = SWAPINT(header.encoding); header.sample_rate = SWAPINT(header.sample_rate); header.channels = SWAPINT(header.channels); } else if ((unsigned int)0x2e736e64 != header.magic) return wrong_format; switch (header.encoding) { case 1: encoding_type = st_mulaw; break; case 2: encoding_type = st_uchar; break; case 3: encoding_type = st_short; break; default: fprintf(stderr, "Unsupported data type in SND header\n"); return misc_read_error; } *num_channels = header.channels; sample_width = get_word_size(encoding_type); *sample_rate = header.sample_rate; if ((header.data_size == 0) || (header.data_size == -1)) { ts.seek_end(); bytes = ts.tell() - header.hdr_size; } else bytes = header.data_size; samps = bytes/sample_width; if (length == 0) data_length = (samps - offset)*(*num_channels); else data_length = length *(*num_channels); file_data = walloc(unsigned char, sample_width * data_length); ts.seek(current_pos+header.hdr_size+(sample_width*offset*(*num_channels))); if ((n=ts.fread(file_data,sample_width,data_length)) != data_length) { fprintf(stderr,"WAVE read: short file %s\n", (const char *)ts.filename()); fprintf(stderr,"WAVE read: at %d got %d instead of %d samples\n", offset,n,data_length); data_length = n; } *data = convert_raw_data(file_data,data_length,encoding_type,bo_big); if (*data == NULL) return read_error; *num_samples = data_length/ (*num_channels); *sample_type = st_short; *bo = EST_NATIVE_BO; *word_size = 2; return read_ok; } enum EST_write_status save_wave_snd(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)bo; /* Header structures */ Sun_au_header header; /* Fill in header structure */ header.magic = (unsigned int)0x2e736e64; /* should be a macro surely */ header.hdr_size = sizeof(header); /* ! */ header.data_size = get_word_size(sample_type) * num_channels * num_samples; switch (sample_type) { case st_mulaw: header.encoding = 1; break; case st_uchar: header.encoding = 2; break; case st_short: header.encoding = 3; break; default: fprintf(stderr, "Unsupported sample type cannot be saved in SND format\n"); return misc_write_error; } /* check consistency */ header.sample_rate = sample_rate; header.channels = num_channels; if (EST_LITTLE_ENDIAN) { /* snd files all in big endian format */ header.magic = SWAPINT(header.magic); header.hdr_size = SWAPINT(header.hdr_size); header.data_size = SWAPINT(header.data_size); header.encoding = SWAPINT(header.encoding); header.sample_rate = SWAPINT(header.sample_rate); header.channels = SWAPINT(header.channels); } /* write header */ if (fwrite(&header, sizeof(header), 1, fp) != 1) return misc_write_error; /* snd files are always in BIG_ENDIAN (sun) byte order */ return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,bo_big); } /*=======================================================================*/ /* CSTR Audlab files (from the last century) */ /* They are always bigendian */ /*=======================================================================*/ struct s1 { char c[17]; float f1; float f2; }; struct s2 { float f1; float f2; float f3; char c1; char c2; int i1; int i2; }; struct audlabfh { struct s1 z; char file_type[8]; char c1[17]; char c2[17]; char c3[17]; int start; char data_type; char c5[64]; }; struct audlabsh { int channel_count; char serial; int sample_rate; char c1[20]; int i1; char c2; char c3[121]; char c4[121]; }; struct audlabsd { char descr[17]; int sample_count; int nbits; float f1; struct s2 z; }; enum EST_read_status load_wave_audlab(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length) { /* Header structures */ struct audlabfh fh; struct audlabsh sh; struct audlabsd sd; int data_length,sample_count; int hdr_length; int current_pos; /* Read header structures from char array */ current_pos = ts.tell(); ts.fread(&fh, sizeof(struct audlabfh), 1); if (strcmp(fh.file_type, "Sample") != 0) return wrong_format; ts.fread(&sh, sizeof(struct audlabsh), 1); ts.fread(&sd, sizeof(struct audlabsd), 1); hdr_length = sizeof(struct audlabfh) + sizeof(struct audlabsh) + sizeof(struct audlabsd); if (EST_BIG_ENDIAN) { *num_channels = sh.channel_count; *sample_rate = sh.sample_rate; sample_count = sd.sample_count; } else // audlab files are bigendian { *num_channels = SWAPINT(sh.channel_count); *sample_rate = SWAPINT(sh.sample_rate); sample_count = SWAPINT(sd.sample_count); } if (length == 0) data_length = (sample_count - offset) * (*num_channels); else data_length = length *(*num_channels); *data = walloc(short,sizeof(short) * data_length); ts.seek(current_pos+hdr_length+(sizeof(short)*offset*(*num_channels))); if ((int)ts.fread(*data, sizeof(short), data_length) != data_length) { wfree(*data); return misc_read_error; } if (EST_LITTLE_ENDIAN) swap_bytes_short(*data,data_length); *num_samples = data_length / (*num_channels); *sample_type = st_short; /* set internal type*/ *word_size = sizeof(short); *bo = EST_NATIVE_BO; return format_ok; } enum EST_write_status save_wave_audlab(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)bo; (void)sample_type; /* Header structures */ struct audlabfh fh; struct audlabsh sh; struct audlabsd sd; fh.start = sizeof (struct audlabfh) + sizeof (struct audlabsh) + sizeof (struct audlabsd); fh.data_type = 2; strcpy(fh.file_type, "Sample"); if (EST_LITTLE_ENDIAN) { // need to swap some of those numbers sh.channel_count = SWAPINT(num_channels); sh.serial = 1; sh.sample_rate = SWAPINT(sample_rate); sd.sample_count = SWAPINT(num_samples); sd.nbits = SWAPINT(16); } else { sh.channel_count = num_channels; sh.serial = 1; sh.sample_rate = sample_rate; sd.sample_count = num_samples; sd.nbits = 16; } sprintf(sd.descr, "Filter 1"); /* write headers */ fwrite (&fh, sizeof(fh), 1, fp); fwrite (&sh, sizeof(sh), 1, fp); fwrite (&sd, sizeof(sd), 1, fp); /* write data*/ return save_raw_data(fp,data,offset,num_samples,num_channels, st_short,bo_big); } /*=======================================================================*/ /* Entropic ESPS SD files: portable (non-proprietary) method */ /*=======================================================================*/ /* Deep thanks go to Peter Kabal from McGill University whose AF code */ /* showed me this was even possible. I looked at his code to find */ /* parts I couldn't work out myself. Also to Rodney Johnson of */ /* Entropic whose document "ESPS APPLICATION NOTE: Non-ESPS Programs */ /* and the ESPS File System" gave details of how to access ESPS files */ /* without using the ESPS library code. */ #include "esps_utils.h" enum EST_read_status load_wave_sd(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo , int offset, int length) { /* A license free version of an esps file reading program */ FILE *fd; esps_hdr hdr; int actual_bo, sample_width, data_length; enum EST_read_status rv; int dl; enum EST_sample_type_t actual_sample_type; double d; unsigned char *file_data; if ((fd = ts.filedescriptor()) == NULL) { fprintf(stderr, "Can't open esps file %s for reading\n", (const char *)ts.filename()); return misc_read_error; } if ((rv=read_esps_hdr(&hdr,fd)) != format_ok) return rv; if (hdr->file_type != ESPS_SD) { fprintf(stderr,"ESPS file: not an FEA_SD file\n"); delete_esps_hdr(hdr); return misc_read_error; } if (fea_value_d("record_freq",0,hdr,&d) != 0) { fprintf(stderr,"ESPS file: can't find sample_rate in header assuming 16000\n"); *sample_rate = 16000; } else *sample_rate = (int)d; actual_sample_type = st_short; /* you're not trying hard enough */ sample_width = get_word_size(actual_sample_type); *num_channels = hdr->field_dimension[0]; if (hdr->swapped) actual_bo = (EST_BIG_ENDIAN ? bo_little : bo_big); else actual_bo = (EST_BIG_ENDIAN ? bo_big : bo_little); if (length == 0) data_length = (hdr->num_records - offset)*(*num_channels); else data_length = length *(*num_channels); file_data = walloc(unsigned char, sample_width * data_length); fseek(fd,hdr->hdr_size+(sample_width*offset*(*num_channels)), SEEK_SET); if ((dl=fread(file_data,sample_width,data_length,fd)) != data_length) { fprintf(stderr,"WAVE read: esps short file %s\n", (const char *)ts.filename()); fprintf(stderr,"WAVE read: at %d got %d instead of %d samples\n", offset,dl,data_length); data_length = dl; } *data = convert_raw_data(file_data,data_length, actual_sample_type, actual_bo); *num_samples = data_length/ (*num_channels); *sample_type = st_short; *bo = EST_NATIVE_BO; *word_size = 2; delete_esps_hdr(hdr); return format_ok; } enum EST_write_status save_wave_sd(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)bo; esps_hdr hdr = make_esps_sd_hdr(); enum EST_write_status rv; short esps_type; hdr->num_records = num_samples; switch (sample_type) { case st_short: esps_type = ESPS_SHORT; break; case st_schar: esps_type = ESPS_CHAR; break; /* maybe should be BYTE */ case st_int: esps_type = ESPS_INT; break; case st_float: esps_type = ESPS_FLOAT; break; case st_double: esps_type = ESPS_DOUBLE; break; default: fprintf(stderr,"ESPS file: no support for sample_type %s\n", sample_type_to_str(sample_type)); return misc_write_error; } /* I believe all of the following are necessary and in this order */ add_field(hdr,"samples",esps_type,num_channels); add_fea_special(hdr,ESPS_FEA_DIRECTORY,"margo:/disk/disk10/home/awb/projects/speech_tools/main"); add_fea_special(hdr,ESPS_FEA_COMMAND, "EDST waveform written as ESPS FEA_SD.\n\ "); add_fea_d(hdr,"start_time",0,(double)0); add_fea_d(hdr,"record_freq",0,(double)sample_rate); add_fea_d(hdr,"max_value",0,(double)27355); if ((rv=write_esps_hdr(hdr,fp)) != write_ok) { delete_esps_hdr(hdr); return rv; } /* lets ignore desired bo and sample type for the time being */ delete_esps_hdr(hdr); return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,EST_NATIVE_BO); } /*=======================================================================*/ /* Raw data files -- unheadered */ /* THESE FUNCTIONS ARE DIFFERENT FROM THE REST */ /* These function have more parameters than the standard file i/o */ /* as information cannot be gleamed from the file */ /*=======================================================================*/ enum EST_read_status load_wave_raw(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length, int isample_rate, enum EST_sample_type_t isample_type, int ibo, int inc) { unsigned char *file_data; int data_length,samps,sample_width; int guess,i,samp; short *ndata; if (isample_type == st_ascii) { /* Guess the size */ if ((offset != 0) || (length != 0)) { fprintf(stderr,"Load ascii wave: doesn't support offets and lengths\n"); return misc_read_error; } ts.seek_end(); guess = (int)(1.2*ts.tell()/7)+10; /* rough guess of the num of samps */ ts.seek(0); *data = walloc(short, guess); i=0; while (!ts.eof()) { samp = atoi(ts.get().string()); if (i == guess) { ndata = walloc(short,(int)(guess*1.2)); memmove(ndata,*data,guess*sizeof(short)); wfree(*data); *data = ndata; guess = (int)(guess*1.2); } if (samp < -32768) { fprintf(stderr,"Load ascii wave: sample %d underflow clipping\n", i); (*data)[i] = -32768; } else if (samp > 32767) { fprintf(stderr,"Load ascii wave: sample %d overflow clipping\n", i); (*data)[i] = 32767; } else (*data)[i] = (short)samp; i++; } data_length = i; } else { ts.seek_end(); sample_width = get_word_size(isample_type); samps = ts.tell()/sample_width; if (length == 0) data_length = samps - offset; else data_length = length; file_data = walloc(unsigned char, data_length * sample_width *inc); ts.seek(offset*sample_width*inc); if ((int)ts.fread(file_data,sample_width,data_length) != data_length) return misc_read_error; *data = convert_raw_data(file_data,data_length,isample_type,ibo); } *num_samples = data_length/inc; *sample_rate = isample_rate; *num_channels = inc; *sample_type = st_short; *word_size = 2; *bo = EST_NATIVE_BO; return format_ok; } enum EST_write_status save_wave_raw(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) { (void)sample_rate; return save_raw_data(fp,data,offset,num_samples,num_channels, sample_type,bo); } /***********************************************************************/ /* */ /* end of file type specific functions */ /* */ /***********************************************************************/ speech_tools/speech_class/EST_wave_utils.cc0000644000076400007640000005427110273516553017541 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black and Paul Taylor */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* Various low-level waveform conversion routines and file format */ /* independent i/o functions */ /* */ /* Acknowledgements */ /* ulaw conversion code provided by */ /* Craig Reese: IDA/Supercomputing Research Center */ /* IEEE extended conversion */ /* Apple Computer, Inc. */ /* */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include #include "EST_wave_utils.h" #include "EST_wave_aux.h" #include "EST_error.h" static short st_ulaw_to_short(unsigned char ulawbyte); static unsigned char st_short_to_ulaw(short sample); /* * This table is * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. * take from speak_freely-7.2/gsm/src/toast_alaw.c */ static unsigned short a2s[] = { 5120,60160, 320,65200,20480,44032, 1280,64192, 2560,62848, 64,65456,10240,54784, 640,64864, 7168,58112, 448,65072,28672,35840, 1792,63680, 3584,61824, 192,65328,14336,50688, 896,64608, 4096,61184, 256,65264,16384,48128, 1024,64448, 2048,63360, 0,65520, 8192,56832, 512,64992, 6144,59136, 384,65136,24576,39936, 1536,63936, 3072,62336, 128,65392,12288,52736, 768,64736, 5632,59648, 352,65168,22528,41984, 1408,64064, 2816,62592, 96,65424,11264,53760, 704,64800, 7680,57600, 480,65040,30720,33792, 1920,63552, 3840,61568, 224,65296,15360,49664, 960,64544, 4608,60672, 288,65232,18432,46080, 1152,64320, 2304,63104, 32,65488, 9216,55808, 576,64928, 6656,58624, 416,65104,26624,37888, 1664,63808, 3328,62080, 160,65360,13312,51712, 832,64672, 5376,59904, 336,65184,21504,43008, 1344,64128, 2688,62720, 80,65440,10752,54272, 672,64832, 7424,57856, 464,65056,29696,34816, 1856,63616, 3712,61696, 208,65312,14848,50176, 928,64576, 4352,60928, 272,65248,17408,47104, 1088,64384, 2176,63232, 16,65504, 8704,56320, 544,64960, 6400,58880, 400,65120,25600,38912, 1600,63872, 3200,62208, 144,65376,12800,52224, 800,64704, 5888,59392, 368,65152,23552,40960, 1472,64000, 2944,62464, 112,65408,11776,53248, 736,64768, 7936,57344, 496,65024,31744,32768, 1984,63488, 3968,61440, 240,65280,15872,49152, 992,64512, 4864,60416, 304,65216,19456,45056, 1216,64256, 2432,62976, 48,65472, 9728,55296, 608,64896, 6912,58368, 432,65088,27648,36864, 1728,63744, 3456,61952, 176,65344,13824,51200, 864,64640 }; #define st_alaw_to_short(a) (a2s[(unsigned char)a]) void ulaw_to_short(const unsigned char *ulaw,short *data,int length) { /* Convert ulaw to shorts */ int i; for (i=0; i> 8) & 0x80; /* set aside the sign */ if ( sign != 0 ) sample = -sample; /* get magnitude */ if ( sample > CLIP ) sample = CLIP; /* clip the magnitude */ /* Convert from 16 bit linear to ulaw. */ sample = sample + BIAS; exponent = exp_lut[( sample >> 7 ) & 0xFF]; mantissa = ( sample >> ( exponent + 3 ) ) & 0x0F; ulawbyte = ~ ( sign | ( exponent << 4 ) | mantissa ); #ifdef ZEROTRAP if ( ulawbyte == 0 ) ulawbyte = 0x02; /* optional CCITT trap */ #endif return ulawbyte; } /* ** This routine converts from ulaw to 16 bit linear. ** ** Craig Reese: IDA/Supercomputing Research Center ** 29 September 1989 ** ** References: ** 1) CCITT Recommendation G.711 (very difficult to follow) ** 2) MIL-STD-188-113,"Interoperability and Performance Standards ** for Analog-to_Digital Conversion Techniques," ** 17 February 1987 ** ** Input: 8 bit ulaw sample ** Output: signed 16 bit linear sample */ static short st_ulaw_to_short( unsigned char ulawbyte ) { static int exp_lut[8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 }; int sign, exponent, mantissa; short sample; ulawbyte = ~ ulawbyte; sign = ( ulawbyte & 0x80 ); exponent = ( ulawbyte >> 4 ) & 0x07; mantissa = ulawbyte & 0x0F; sample = exp_lut[exponent] + ( mantissa << ( exponent + 3 ) ); if ( sign != 0 ) sample = -sample; return sample; } /* * C O N V E R T T O I E E E E X T E N D E D */ /* Copyright (C) 1988-1991 Apple Computer, Inc. * All rights reserved. * * Machine-independent I/O routines for IEEE floating-point numbers. * * NaN's and infinities are converted to HUGE_VAL or HUGE, which * happens to be infinity on IEEE machines. Unfortunately, it is * impossible to preserve NaN's in a machine-independent way. * Infinities are, however, preserved on IEEE machines. * * These routines have been tested on the following machines: * Apple Macintosh, MPW 3.1 C compiler * Apple Macintosh, THINK C compiler * Silicon Graphics IRIS, MIPS compiler * Cray X/MP and Y/MP * Digital Equipment VAX * * * Implemented by Malcolm Slaney and Ken Turkowski. * * Malcolm Slaney contributions during 1988-1990 include big- and little- * endian file I/O, conversion to and from Motorola's extended 80-bit * floating-point format, and conversions to and from IEEE single- * precision floating-point format. * * In 1991, Ken Turkowski implemented the conversions to and from * IEEE double-precision format, added more precision to the extended * conversions, and accommodated conversions involving +/- infinity, * NaN's, and denormalized numbers. */ #ifndef HUGE_VAL # define HUGE_VAL HUGE #endif /*HUGE_VAL*/ # define FloatToUnsigned(f) ((unsigned long)(((long)(f - 2147483648.0)) + 2147483647L) + 1) void ConvertToIeeeExtended(double num,unsigned char *bytes) { int sign; int expon; double fMant, fsMant; unsigned long hiMant, loMant; if (num < 0) { sign = 0x8000; num *= -1; } else { sign = 0; } if (num == 0) { expon = 0; hiMant = 0; loMant = 0; } else { fMant = frexp(num, &expon); if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */ expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */ } else { /* Finite */ expon += 16382; if (expon < 0) { /* denormalized */ fMant = ldexp(fMant, expon); expon = 0; } expon |= sign; fMant = ldexp(fMant, 32); fsMant = floor(fMant); hiMant = FloatToUnsigned(fsMant); fMant = ldexp(fMant - fsMant, 32); fsMant = floor(fMant); loMant = FloatToUnsigned(fsMant); } } bytes[0] = expon >> 8; bytes[1] = expon; bytes[2] = hiMant >> 24; bytes[3] = hiMant >> 16; bytes[4] = hiMant >> 8; bytes[5] = hiMant; bytes[6] = loMant >> 24; bytes[7] = loMant >> 16; bytes[8] = loMant >> 8; bytes[9] = loMant; } /* * C O N V E R T F R O M I E E E E X T E N D E D */ /* * Copyright (C) 1988-1991 Apple Computer, Inc. * All rights reserved. * * Machine-independent I/O routines for IEEE floating-point numbers. * * NaN's and infinities are converted to HUGE_VAL or HUGE, which * happens to be infinity on IEEE machines. Unfortunately, it is * impossible to preserve NaN's in a machine-independent way. * Infinities are, however, preserved on IEEE machines. * * These routines have been tested on the following machines: * Apple Macintosh, MPW 3.1 C compiler * Apple Macintosh, THINK C compiler * Silicon Graphics IRIS, MIPS compiler * Cray X/MP and Y/MP * Digital Equipment VAX * * * Implemented by Malcolm Slaney and Ken Turkowski. * * Malcolm Slaney contributions during 1988-1990 include big- and little- * endian file I/O, conversion to and from Motorola's extended 80-bit * floating-point format, and conversions to and from IEEE single- * precision floating-point format. * * In 1991, Ken Turkowski implemented the conversions to and from * IEEE double-precision format, added more precision to the extended * conversions, and accommodated conversions involving +/- infinity, * NaN's, and denormalized numbers. */ #ifndef HUGE_VAL # define HUGE_VAL HUGE #endif /*HUGE_VAL*/ # define UnsignedToFloat(u) (((double)((long)(u - 2147483647L - 1))) + 2147483648.0) /**************************************************************** * Extended precision IEEE floating-point conversion routine. ****************************************************************/ double ConvertFromIeeeExtended(unsigned char *bytes) { double f; int expon; unsigned long hiMant, loMant; expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF); hiMant = ((unsigned long)(bytes[2] & 0xFF) << 24) | ((unsigned long)(bytes[3] & 0xFF) << 16) | ((unsigned long)(bytes[4] & 0xFF) << 8) | ((unsigned long)(bytes[5] & 0xFF)); loMant = ((unsigned long)(bytes[6] & 0xFF) << 24) | ((unsigned long)(bytes[7] & 0xFF) << 16) | ((unsigned long)(bytes[8] & 0xFF) << 8) | ((unsigned long)(bytes[9] & 0xFF)); if (expon == 0 && hiMant == 0 && loMant == 0) { f = 0; } else { if (expon == 0x7FFF) { /* Infinity or NaN */ f = HUGE_VAL; } else { expon -= 16383; f = ldexp((double)(hiMant), expon-=31); f += ldexp((double)(loMant), expon-=32); } } if (bytes[0] & 0x80) return -f; else return f; } speech_tools/speech_class/EST_TrackMap.cc0000644000076400007640000002072407262605664017063 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri May 9 1997 */ /************************************************************************/ /* */ /* Track maps provide a mapping from symbolic track names to the */ /* actual position of the information within a track frame. */ /* */ /* Channel name maps map textual names for track channels to symbolic */ /* names, they are just a special case of named enums. */ /* */ /************************************************************************/ #include "EST_TrackMap.h" void EST_TrackMap::clear(void) { for(int i=0; iget(type); if (c != NO_SUCH_CHANNEL) c -= p_offset; } return c; } EST_ChannelType EST_TrackMap::channel_type(unsigned short channel) const { unsigned short i; for(i=0; ichannel_type(channel+p_offset); return channel_unknown; } short EST_TrackMap::last_channel(void) const { short last = -1; for(short i=0; i last) last = p_map[i]; return last; } static EST_TValuedEnumDefinition channel_name_tbl[] = { { channel_unknown, { "Unknown" }}, { channel_order, { "Order" }}, { channel_power, { "power", "Power", "raw_power"}}, { channel_power_d, { "power_d", "Power_d", "raw_power_d"}}, { channel_power_a, { "power_a", "Power_a", "raw_power_a"}}, { channel_energy, { "energy", "Energy"}}, { channel_energy_d, { "energy_d", "Energy_d"}}, { channel_energy_a, { "energy_a", "Energy_a"}}, { channel_peak, { "Peak", "ac_peak" }}, { channel_duration, { "Duration" }}, { channel_length, { "Length", "frame_len"}}, { channel_offset, { "Offset", "frame_offset"}}, { channel_f0, { "f0", "F0" }}, { channel_f0_d, { "f0_d", "F0_d" }}, { channel_f0_a, { "f0_a", "F0_a" }}, { channel_voiced, { "Voiced", "prob_voice"}}, { channel_frame, { "Frame"}}, { channel_time, { "Time"}}, { channel_lpc_0, { "lpc_0", "Lpc_0"}}, { channel_lpc_N, { "lpc_N", "Lpc_N"}}, { channel_lpc_d_0, { "lpc_d_0"}}, { channel_lpc_d_N, { "lpc_d_N"}}, { channel_lpc_a_0, { "lpc_a_0"}}, { channel_lpc_a_N, { "lpc_a_N"}}, { channel_cepstrum_0, { "cep_0"}}, { channel_cepstrum_N, { "cep_N"}}, { channel_cepstrum_d_0, { "cep_d_0"}}, { channel_cepstrum_d_N, { "cep_d_N"}}, { channel_cepstrum_a_0, { "cep_a_0"}}, { channel_cepstrum_a_N, { "cep_a_N"}}, { channel_melcepstrum_0, { "melcep_0"}}, { channel_melcepstrum_N, { "melcep_N"}}, { channel_melcepstrum_d_0, { "melcep_d_0"}}, { channel_melcepstrum_d_N, { "melcep_d_N"}}, { channel_melcepstrum_a_0, { "melcep_a_0"}}, { channel_melcepstrum_a_N, { "melcep_a_N"}}, { channel_lsf_0, { "lsf_0"}}, { channel_lsf_N, { "lsf_N"}}, { channel_lsf_d_0, { "lsf_d_0"}}, { channel_lsf_d_N, { "lsf_d_N"}}, { channel_lsf_a_0, { "lsf_a_0"}}, { channel_lsf_a_N, { "lsf_a_N"}}, { channel_fbank_0, { "fbank_0"}}, { channel_fbank_N, { "fbank_N"}}, { channel_fbank_d_0, { "fbank_d_0"}}, { channel_fbank_d_N, { "fbank_d_N"}}, { channel_fbank_a_0, { "fbank_a_0"}}, { channel_fbank_a_N, { "fbank_a_N"}}, { channel_filter_0, { "filter_0"}}, { channel_filter_N, { "filter_N"}}, { channel_filter_d_0, { "filter_d_0"}}, { channel_filter_d_N, { "filter_d_N"}}, { channel_filter_a_0, { "filter_a_0"}}, { channel_filter_a_N, { "filter_a_N"}}, { channel_reflection_0, { "reflection_0"}}, { channel_reflection_N, { "reflection_N"}}, { channel_reflection_d_0, { "reflection_d_0"}}, { channel_reflection_d_N, { "reflection_d_N"}}, { channel_reflection_a_0, { "reflection_a_0"}}, { channel_reflection_a_N, { "reflection_a_N"}}, { channel_unknown, { NULL }} }; EST_ChannelNameMap EST_default_channel_names(channel_name_tbl); static EST_TValuedEnumDefinition esps_channel_name_tbl[] = { { channel_unknown, { "Unknown" }}, { channel_order, { "Order" }}, { channel_power, { "raw_power", "rms" }}, { channel_peak, { "ac_peak" }}, { channel_duration, { "Duration" }}, { channel_length, { "frame_len"}}, { channel_f0, { "F0" }}, { channel_voiced, { "prob_voice"}}, { channel_lpc_0, { "lpc_0", "spec_param" }}, { channel_lpc_N, { "lpc_N"}}, // { channel_coef0, { "spec_param" }}, { channel_unknown, { NULL }} }; EST_ChannelNameMap esps_channel_names(esps_channel_name_tbl); #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" template class EST_TNamedEnum; template class EST_TNamedEnumI; template class EST_TValuedEnum; template class EST_TValuedEnumI; template class EST_THandle; #endif speech_tools/speech_class/EST_Track.cc0000644000076400007640000010672611465017156016425 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Paul Taylor */ /* Date : April 1994 */ /* ------------------------------------------------------------------- */ /* EST_Track Class source file */ /* */ /*************************************************************************/ #include #include #include #include "EST_unix.h" #include "EST_Track.h" #include "EST_string_aux.h" #include "EST_TrackFile.h" #include "EST_error.h" const int EST_Track::default_sample_rate=16000; // occasionally needed for xmg files const float EST_Track::default_frame_shift=0.005; // default frame spacing. const EST_String DEF_FILE_TYPE = "est"; EST_Track::EST_Track() { default_vals(); } EST_Track::EST_Track(const EST_Track &a) { default_vals(); copy(a); } EST_Track::EST_Track(int n_frames, int n_channels) { default_vals(); p_values.resize(n_frames, n_channels); p_times.resize(n_frames); p_is_val.resize(n_frames); p_channel_names.resize(n_channels); p_aux.resize(n_frames, 1); p_aux_names.resize(1); char d = 0; p_is_val.fill(d); } EST_Track::EST_Track(int n_frames, EST_TrackMap &map) { int n_channels = map.last_channel()+1; default_vals(); p_values.resize(n_frames, n_channels); p_times.resize(n_frames); p_is_val.resize(n_frames); p_channel_names.resize(n_channels); char d = 0; p_is_val.fill(d); assign_map(map); } EST_Track::~EST_Track(void) { // clear_features(); } void EST_Track::default_channel_names() { for (int i = 0; i < num_channels(); ++i) set_channel_name("track" + itoString(i), i); } void EST_Track::default_vals(void) { p_equal_space = FALSE; p_single_break = FALSE; p_values.resize(0, 0); p_times.resize(0); p_is_val.resize(0); p_aux.resize(0, 0); p_aux_names.resize(0); p_channel_names.resize(0); p_map = NULL; p_t_offset=0; init_features(); } void EST_Track::set_break(int i) // make location i hold a break { if (i >= num_frames()) cerr << "Requested setting of break value of the end of the array\n"; p_is_val[i] = 1; } void EST_Track::set_value(int i) // make location i hold a value { p_is_val[i] = 0; } const EST_String EST_Track::channel_name(int i, const EST_ChannelNameMap &map, int strings_override) const { (void)map; (void)strings_override; return p_channel_names(i); } /* OLD ENUM VERSION const EST_String EST_Track::channel_name(int i, const EST_ChannelNameMap &map, int strings_override) const { EST_ChannelType type = channel_unknown; if (strings_override && p_channel_names(i) != "") return p_channel_names(i); else if (p_map!=NULL && ((type = p_map->channel_type(i)) != channel_unknown)) { const char *name = map.name(type); if (!name) name = EST_default_channel_names.name(type); if (name != NULL) return EST_String(name); return "unnamed_channel" + itoString(type); } else if (!strings_override && p_channel_names(i) != "") return p_channel_names(i); else return "track" + itoString(i); } */ void EST_Track::set_channel_name(const EST_String &fn, int i) { p_channel_names[i] = fn; } void EST_Track::set_aux_channel_name(const EST_String &fn, int i) { p_aux_names[i] = fn; } ostream& operator << (ostream& s, const EST_Track &tr) { int i, j; for (i = 0; i < tr.num_frames(); ++i) { s << tr.t(i); for (j = 0; j < tr.num_channels(); ++j) s << "\t" << tr(i, j); for (j = 0; j < tr.num_aux_channels(); ++j) s << "\t" << tr.aux(i, j); s << "\t" << !tr.track_break(i) << endl; } return s; } void EST_Track::copy(const EST_Track& a) { copy_setup(a); p_values = a.p_values; p_times = a.p_times; p_is_val = a.p_is_val; p_t_offset = a.p_t_offset; p_aux = a.p_aux; p_aux_names = a.p_aux_names; } void EST_Track::copy_setup(const EST_Track& a) { p_equal_space = a.p_equal_space; p_single_break = a.p_single_break; p_channel_names = a.p_channel_names; p_map = a.p_map; copy_features(a); } void EST_Track::resize(int new_num_frames, int new_num_channels, bool set) { int old_num_frames = num_frames(); if (new_num_frames<0) new_num_frames = num_frames(); if (new_num_channels<0) new_num_channels = num_channels(); p_channel_names.resize(new_num_channels); // this ensures the new channels have a default name if (new_num_channels > num_channels()) for (int i = num_channels(); i < new_num_channels; ++i) set_channel_name("track_" + itoString(i), i); p_values.resize(new_num_frames, new_num_channels, set); p_times.resize(new_num_frames, set); p_is_val.resize(new_num_frames, set); p_aux.resize(new_num_frames, num_aux_channels(), set); // Its important that any new vals get set to 0 for (int i = old_num_frames; i < num_frames(); ++i) p_is_val.a_no_check(i) = 0; } static void map_to_channels(EST_StrList &channel_map, EST_StrList &channel_names) { EST_Litem *p; EST_String b, type, first, last; int n_f, n_l; for (p = channel_map.head(); p; p = p->next()) { b = channel_map(p); if (b.matches("$", 0)) { // do this backwards as types may have "_" in them b = b.after("$"); if (!b.contains("-")) { cerr<<"Ill formed coefficient range in map: " << b << "\n"; return; } type = b.before("-"); first = b.after("-"); if (!first.contains("+")) { cerr<<"Ill formed coefficient range in map: "<next(), ++i) set_channel_name(x(p), i); p_values.resize(new_num_frames, new_num_channels, set); p_times.resize(new_num_frames, set); p_is_val.resize(new_num_frames, set); // for (int i = 0; i < new_num_frames; ++i) // p_is_val.a_no_check(i) = 1; } void EST_Track::resize_aux(EST_StrList &new_aux_channels, bool set) { int i; EST_Litem *p; int new_num_channels; new_num_channels = new_aux_channels.length(); p_aux_names.resize(new_num_channels); // this ensures the new channels have a default name for (i = 0, p = new_aux_channels.head(); p ; p = p->next(), ++i) set_aux_channel_name(new_aux_channels(p), i); p_aux.resize(num_frames(), new_num_channels, set); } EST_Track& EST_Track::operator+=(const EST_Track &a) // add to existing track { int i, j, k; if (num_frames() == 0) // i.e. no existing EST_Track to add to { *this = a; return *this; } if (a.num_channels() != num_channels()) { cerr << "Error: Tried to add " << a.num_channels() << " channel EST_Track to "<resize(a.num_frames()+ this->num_frames(), this->num_channels()); for (i = 0, j = old_num; i < a.num_frames(); ++i, ++j) { for (k = 0; k < num_channels(); ++k) p_values.a_no_check(j, k) = a(i, k); p_times[j] = old_end + a.t(i); p_is_val[j] = a.p_is_val(i); } return *this; } EST_Track& EST_Track::operator|=(const EST_Track &a) { // add to existing track in parallel int i, j, k; if (num_channels() == 0) // i.e. no existing EST_Track to add to { *this = a; return *this; } if (a.num_frames() != num_frames()) { cerr << "Error: Tried to add " << a.num_frames() << " channel EST_Track to "<resize(a.num_frames(), this->num_channels() + a.num_channels()); for (i = 0, j = old_num; i < a.num_channels(); ++i, ++j) for (k = 0; k < num_frames(); ++k) p_values.a_no_check(k, j) = a(k, i); return *this; } EST_Track &EST_Track::operator=(const EST_Track& a) { copy(a); return *this; } int EST_Track::channel_position(const char *name, int offset) const { int c; for (c=0; caux(i,c); } #define EPSILON (0.0001) float &EST_Track::a(float t, int c, EST_InterpType interp) { static float ia = 0.0; if (interp == it_nearest) return p_values.a_no_check(index(t), c); else if (interp == it_linear) { int i = index_below(t); if (i < 0) return a(0,c); float n = a(i,c), n1 = a(i+1,c); float tn = p_times(i), tn1 = p_times(i+1); ia = n + (n1-n)*(t-tn)/(tn1-tn); return ia; } else if (interp == it_linear_nz) { int i = index_below(t); if (i < 0) return a(0,c); float n = a(i,c), n1 = a(i+1,c); if (fabs(n) < EPSILON || fabs(n1) < EPSILON) return p_values.a_no_check(index(t), c); float tn = p_times(i), tn1 = p_times(i+1); ia = n + (n1-n)*(t-tn)/(tn1-tn); return ia; } return ia; } int EST_Track::index(float x) const { if (equal_space()) { float s = shift(); int f = (int)( (x-t(0))/s+0.5 ); //don't assume track starts at t=0.0 if (f<0) f=0; else if (f>= num_frames()) f=num_frames()-1; return f; } else if (num_frames() > 1) //if single frame, return that index (0) { int bst, bmid, bend; bst = 1; bend = num_frames(); if (x < p_times.a_no_check(bst)) bmid=bst; if (x >= p_times.a_no_check(bend-1)) bmid=bend-1; else { while (1) { bmid = bst + (bend-bst)/2; if (bst == bmid) break; else if (x < p_times.a_no_check(bmid)) { if (x >= p_times.a_no_check(bmid-1)) break; bend = bmid; } else bst = bmid; } } if (fabs(x - p_times.a_no_check(bmid)) < fabs(x - p_times.a_no_check(bmid-1))) return bmid; else return bmid - 1; } return num_frames() -1; } int EST_Track::index_below(float x) const { if (equal_space()) { float s = shift(); int f = (int)(x/s); if (f<0) f=0; else if (f>= num_frames()) f=num_frames()-1; return f; } else { for (int i = 1; i < num_frames(); ++i) if (x <= p_times.a_no_check(i)) return i - 1; return num_frames()-1; } } int EST_Track::val(int i) const { return !p_is_val(i); } /* "p_equal_space" indicates whether the x-axis values are evenly spaced (FIXED) or spaced arbitrarily (VARI). "p_single_break" describes the break format. F0 contours are seldom continuous - often breaks occur due to unvoicing etc. These are a marked in the data arrays by break values, "i_break" for ints and "f_break" for floats. The "p_single_break" channel specifies whether a break is represented by a single break value, or as a break value for every frame. eg (SINGLE) 800 100 810 105 BREAK BREAK 850 130 860 135 or (MANY) 800 100 810 105 820 BREAK 830 BREAK 840 BREAK 850 130 860 135 In the MANY case, only the y value is specified as a break, in the SINGLE case the x value may or may not be specified as a break. For this reason, when checking for breaks, it is useful to only rely on the y value being set to the i_break value. Not that if the single_break is MANY and the equal_space is FIXED, you dont really need x-axis values. Different functions naturally work better on different representations and that is why all these different types are supported. A general function mod_cont() is supplied to change from one type to another. Not all conversions are currently supported however. */ float EST_Track::end() const { if (num_frames() == 0) return 0.0; else return (p_times(prev_non_break(num_frames()))); } float EST_Track::start() const { if (num_frames() == 0) return 0.0; else return (track_break(0) ? p_times(next_non_break(0)) : p_times(0)); } float EST_Track::shift() const { int j1 = 0; int j2 = 0; if (!p_equal_space) EST_error("Tried to take shift from non-fixed contour\n"); do { j1 = next_non_break(++j1); j2 = next_non_break(j1); // cout << "j1:" << j1 << " j2:" << j2 << endl; } while ((j2 != 0) && (j2 != (j1 +1))); if (j2 == 0) { if (num_frames() > 1) return p_times(1) - p_times(0); else EST_error("Couldn't determine shift size\n"); } return (p_times(j2) - p_times(j1)); } /* tries to find the next value that isnt a break. Dont really know what to do on a fail, so just return 0 */ int EST_Track::next_non_break(int j) const { int i = j; for (++i; i < num_frames(); ++i) { // cout << "i: " << i << " " << value[i] << endl; if (!track_break(i)) return i; } return 0; } /* give the current point, returns the previous non-break */ int EST_Track::prev_non_break(int j) const { int i = j; for (--i; i >= 0 ; --i) if (!track_break(i)) return i; return 0; } void EST_Track::change_type(float nshift, bool single_break) { if (nshift != 0.0) { if (!p_equal_space || nshift != shift()) sample(nshift); p_equal_space = TRUE; } if (single_break != p_single_break) { if (!p_single_break) pad_breaks(); else rm_excess_breaks(); } } void EST_Track::sample(float f_interval) { EST_FVector new_times; EST_FMatrix new_values; EST_CVector new_is_break; int i, j, n; n = (int) rint(((end())/ f_interval)); new_times.resize(n); new_values.resize(n, num_channels()); new_is_break.resize(n); // REORG - can this be replaced with fill_time()? for (i = 0; i < n; ++i) new_times[i] = (float) ((i + 1) * f_interval); for (i = 0; i < n; ++i) { new_is_break[i] = !interp_value(new_times(i), f_interval); for (j = 0; j < num_channels(); ++j) new_values(i, j) = !new_is_break(i) ? interp_amp(new_times(i), j, f_interval): 0.0; } p_times = new_times; p_values = new_values; p_is_val = new_is_break; p_single_break = FALSE; p_equal_space = TRUE; } float EST_Track::interp_amp(float x, int c, float fl) { int i; float x1, x2, y1, y2, m; for (i = 0; i < num_frames(); ++i) if ((p_times(i) + (fl / 2.0))> x) break; if (i == num_frames()) return p_values.a_no_check(i - 1,c); if (i == 0) return p_values.a_no_check(0, c); if (track_break(i) && track_break(i - 1)) return 0.0; if (track_break(i)) return p_values.a_no_check(i - 1, c); else if (track_break(i - 1)) return p_values.a_no_check(i, c); x1 = p_times(i - 1); y1 = p_values.a_no_check(i - 1, c); x2 = p_times(i); y2 = p_values.a_no_check(i, c); m = (y2 - y1) / (x2 -x1); return ((x - x1) * m) + y1; } int EST_Track::interp_value(float x, float fl) { int i; int p, n; float cf; if (p_equal_space) cf = shift(); else cf = estimate_shift(x); for (i = 0; i < num_frames(); ++i) if ((p_times(i) + (fl / 2.0))> x) break; // This was: // for (i = 0; i < num_frames(); ++i) // if (p_times[i] > x) // break; if (i == 0) // must be a break for the first value. (can't have i -1). return FALSE; if ((!track_break(i)) && (!track_break(i -1))) return TRUE; p = prev_non_break(i); n = next_non_break(i); if ((x < p_times(p) + (cf / 2.0)) || (x > p_times(n) - (cf / 2.0))) return TRUE; // rounding at edges return FALSE; } float EST_Track::estimate_shift(float x) { int i, j; for (j = 0; j < num_frames(); ++j) if (p_times(j) > x) break; for (i = j; i > 0; --i) if ((!track_break(i)) && (!track_break(i - 1))) return p_times(i) - p_times(i - 1); for (i = j; i < num_frames() - 1; ++i) if ((!track_break(i)) && (!track_break(i + 1))) return p_times(i + 1) - p_times(i); return 5.0; // default value } void EST_Track::fill_time( float t, int start ) { unsigned int nframes = num_frames(); for( unsigned int i=0; i0; end--) if (!track_break(end-1)) break; if (start==0 && end==num_frames()) return; for (int i=start, j = 0; i < end; ++i, ++j) { p_times[j] = p_times(i); for (int k = 0; k < num_channels(); k++) a_no_check(j, k) = a_no_check(i, k); p_is_val[j] = p_is_val(i); } p_values.resize(end-start, EST_CURRENT, 1); p_times.resize(num_frames()); p_is_val.resize(num_frames()); } void EST_Track::add_trailing_breaks() { int i, j, k; EST_FVector new_times; EST_FMatrix new_values; int new_num = num_frames(); if (!track_break(0)) new_num++; if (!track_break(num_frames() - 1)) new_num++; if (new_num == num_frames()) /*ie trailing breaks already there */ return; new_times.resize(new_num); new_values.resize(num_channels(), new_num); j = 0; if (!track_break(j)) set_break(j); for (i = 0; i < num_frames(); ++i, ++j) { new_times[j] = p_times(i); for (k = 0; k < num_channels(); ++k) new_values(j, k) = p_values.a_no_check(i, k); } if (!track_break(num_frames() - 1)) set_break(j); p_times = new_times; p_values = new_values; p_times.resize(num_frames()); p_values.resize(num_frames(), num_channels()); } void EST_Track::pad_breaks() { if (!p_single_break) return; if (!p_equal_space) EST_error("pad_breaks: Can only operate on fixed data\n"); EST_FVector new_times; EST_FMatrix new_values; EST_CVector new_is_break; int i, j, k, n; n = (int)(((end())/ shift()) + 1.0); int s = int(start()/ shift()); for (i = 0; i < n; ++i) { new_times[i] = (float) (i * shift()); for (k = 0; k < num_channels(); ++k) new_values(k, i) = 0.0; new_is_break[i] = 0; } for (i = 0, j = s; j < n; ++i, ++j) { if (track_break(i)) { for (; new_times(j) < p_times(i + 1); ++j); --j; } else { new_is_break[j] = 1; for (k = 0; k < num_channels(); ++k) new_values(j, k) = p_values.a_no_check(i, k); } } new_is_break[j] = 1; for (k = 0; k < num_channels(); ++k) new_values(j, k) = p_values.a_no_check(i, k); p_times = new_times; p_values = new_values; p_is_val = new_is_break; p_times.resize(num_frames()); p_is_val.resize(num_frames()); p_values.resize(num_frames(), num_channels()); p_single_break = FALSE; } static bool bounds_check(const EST_Track &t, int f, int c, int set) { const char *what = set? "set" : "access"; if (f<0 || f >= t.num_frames()) { cerr << "Attempt to " << what << " frame " << f << " of " << t.num_frames() << " frame track\n"; return FALSE; } if (c<0 || c >= t.num_channels()) { cerr << "Attempt to " << what << " channel " << c << " of " << t.num_channels() << " channel track\n"; return FALSE; } return TRUE; } static bool bounds_check(const EST_Track &t, int f, int nf, int c, int nc, int set) { const char *what = set? "set" : "access"; if (nf>0) { if (f<0 || f >= t.num_frames()) { cerr << "Attempt to " << what << " frame " << f << " of " << t.num_frames() << " frame track\n"; return FALSE; } if (f+nf-1 >= t.num_frames()) { cerr << "Attempt to " << what << " frame " << f+nf-1 << " of " << t.num_frames() << " frame track\n"; return FALSE; } } if (nc>0) { if (c<0 || c >= t.num_channels()) { cerr << "Attempt to " << what << " channel " << c << " of " << t.num_channels() << " channel track\n"; return FALSE; } if (c+nc-1 >= t.num_channels()) { cerr << "Attempt to " << what << " channel " << c+nc-1 << " of " << t.num_channels() << " channel track\n"; return FALSE; } } return TRUE; } float &EST_Track::a(int i, int c) { if (!bounds_check(*this, i,c,0)) return *(p_values.error_return); return p_values.a_no_check(i,c); } float EST_Track::a(int i, int c) const { return ((EST_Track *)this)->a(i,c); } int EST_Track::empty() const { int i, num; for (i = num = 0; i < num_frames(); ++i) if (val(i)) return 0; // i.e. false return 1; // i.e. true } void EST_Track::channel(EST_FVector &cv, const char * name, int startf, int nf) { int n; if ((n = channel_position(name)) == -1) { cerr << "No such channel " << name << endl; return; } channel(cv, n, startf, nf); } void EST_Track::sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, int nchans) { int start_chan; if (start_chan_name == "") start_chan = 0; if ((start_chan = channel_position(start_chan_name)) == -1) EST_error("sub_track: No such channel %s\n", (const char *)start_chan_name); sub_track(st, start_frame, nframes, start_chan, nchans); } void EST_Track::sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, const EST_String &end_chan_name) { int start_chan, end_chan, nchans=0; if ((start_chan = channel_position(start_chan_name)) == -1) EST_error("sub_track: No such channel %s\n", (const char *)start_chan_name); if (end_chan_name == "") nchans = EST_ALL; else { if ((end_chan = channel_position(end_chan_name)) == -1) EST_error("sub_track: No such channel %s\n", (const char*)end_chan_name); else nchans = end_chan - start_chan + 1; } sub_track(st, start_frame, nframes, start_chan, nchans); } void EST_Track::sub_track(EST_Track &st, int start_frame, int nframes, int start_chan, int nchans) { if (nframes <0) nframes = num_frames() - start_frame; if (nchans <0) nchans = num_channels() - start_chan; if (!bounds_check(*this, start_frame, nframes, start_chan, nchans, 0)) return; p_values.sub_matrix(st.p_values, start_frame, nframes, start_chan, nchans); p_times.sub_vector(st.p_times, start_frame, nframes); p_is_val.sub_vector(st.p_is_val, start_frame, nframes); p_channel_names.sub_vector(st.p_channel_names, start_chan, nchans); // All auxiliary information is included. These are effectively // pointer statements p_aux.sub_matrix(st.p_aux, start_frame, nframes, 0, EST_ALL); p_aux_names.sub_vector(st.p_aux_names, 0, EST_ALL); st.p_t_offset = p_t_offset; st.p_equal_space = p_equal_space; st.p_single_break = p_single_break; st.copy_features(*this); if (p_map!=0) st.p_map = new EST_TrackMap(p_map, start_chan, EST_TM_REFCOUNTED); else st.p_map = NULL; } void EST_Track::copy_sub_track(EST_Track &st, int start_frame, int nframes, int start_chan, int nchans) const { if (nframes <0) nframes = num_frames() - start_frame; if (nchans <0) nchans = num_channels() - start_chan; if (!bounds_check(*this, start_frame, nframes, start_chan, nchans, 0)) return; st.resize(nframes, nchans); for (int ff=0; ffrecognise) continue; EST_TrackFile::Load_TokenStream * l_fun =info->load; if (l_fun == NULL) continue; stat = (*l_fun)(ts, *this, ishift, startt); if (stat != read_format_error) { if (stat == read_ok) set_file_type(t); break; } } return stat; } EST_read_status EST_Track::load(const EST_String filename, float ishift, float startt) { EST_read_status stat = read_error; for(int n=0; n< EST_TrackFile::map.n() ; n++) { EST_TrackFileType t = EST_TrackFile::map.token(n); if (t == tff_none) continue; EST_TrackFile::Info *info = &(EST_TrackFile::map.info(t)); if (! info->recognise) continue; EST_TrackFile::Load_File * l_fun =info->load; if (l_fun == NULL) continue; stat = (*l_fun)(filename, *this, ishift, startt); if (stat == read_ok) { set_file_type(t); break; } else if (stat == read_error) break; } return stat; } EST_read_status EST_Track::load(const EST_String filename, const EST_String type, float ishift, float startt) { EST_TrackFileType t = EST_TrackFile::map.token(type); if (t == tff_none) { cerr << "Unknown Track file type " << type << endl; return read_error; } EST_TrackFile::Load_File * l_fun = EST_TrackFile::map.info(t).load; if (l_fun == NULL) { cerr << "Can't load tracks from file type" << type << endl; return read_error; } set_file_type(t); return (*l_fun)(filename, *this, ishift, startt); } EST_write_status EST_Track::save_channel_names(const EST_String filename) { FILE *file; if ((file=fopen(filename, "wb"))==NULL) return write_fail; for(int c=0; cget(type)) != NO_SUCH_CHANNEL) return a(t, c, interp); else { cerr << "no channel '" << EST_default_channel_names.name(type) << "' = " << (int)type << "\n"; } return *(p_values.error_return); } void EST_Track::assign_map(EST_TrackMap::P map) { p_map = map; } void EST_Track::create_map(EST_ChannelNameMap &names) { EST_TrackMap::P map = new EST_TrackMap(EST_TM_REFCOUNTED); for (int i = 0; i < num_channels(); i++) { EST_ChannelType type = names.token(p_channel_names(i)); if (type != channel_unknown) map->set(type, i); } assign_map(map); } void EST_Track::resize(int new_num_frames, EST_TrackMap &map) { resize(new_num_frames, map.last_channel()+1); assign_map(map); } int EST_Track::channel_position(EST_ChannelType type, int offset) const { if (p_map!=0) { int p = (*p_map)(type); return (p!= NO_SUCH_CHANNEL)?(p+offset): NO_SUCH_CHANNEL; } return channel_position(EST_default_channel_names.name(type), offset); } float &EST_Track::a(int i, EST_ChannelType type, int offset) { short c = NO_SUCH_CHANNEL; if (p_map!=0 && ((c = p_map->get(type)) != NO_SUCH_CHANNEL)) return p_values.a_no_check(i, c+offset); else { cerr << "no channel '" << EST_default_channel_names.name(type) << "' = " << (int)type << "\n"; } return *(p_values.error_return); } EST_Track::IPointer_f::IPointer_f() { frame = new EST_Track(); } EST_Track::IPointer_f::IPointer_f(const IPointer_f &p) { frame=new EST_Track(*(p.frame)); } EST_Track::IPointer_f::~IPointer_f() { if (frame != NULL) { delete frame; frame=NULL; } } #if defined(INSTANTIATE_TEMPLATES) Instantiate_TIterator_T(EST_Track, EST_Track::IPointer_f, EST_Track, Track_itt) #endif speech_tools/speech_class/wave_t.cc0000644000076400007640000000617310044502522016112 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* Instantiation of wave specific template functions */ /* */ /*=======================================================================*/ #include "EST_TList.h" #include "EST_TVector.h" #include "EST_Wave.h" Declare_TList(EST_Wave) Declare_TVector(EST_Wave) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TVector.cc" Instantiate_TList(EST_Wave) Instantiate_TVector(EST_Wave) #endif speech_tools/speech_class/track_t.cc0000644000076400007640000000600407262605664016270 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : Decemeber 1997 */ /*-----------------------------------------------------------------------*/ /* Instantiation of track specific template functions */ /* */ /*=======================================================================*/ #include "EST_TList.h" #include "EST_Track.h" Declare_TList(EST_Track) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList(EST_Track) #endif speech_tools/speech_class/EST_wave_aux.cc0000644000076400007640000002535111465017156017172 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor and Alan Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* more EST_Wave class methods */ /* */ /*=======================================================================*/ #include #include "EST_unix.h" #include #include "EST_cutils.h" #include "EST_string_aux.h" #include "EST_Wave.h" #include "EST_wave_utils.h" #include "EST_wave_aux.h" #include "EST_io_aux.h" #include "EST_error.h" void extract(EST_Wave &sig, EST_Option &al); /* Allow EST_Wave to be used in an EST_Val */ VAL_REGISTER_CLASS(wave,EST_Wave) static EST_TValuedEnumDefinition st_names[] = { {st_unknown, {"undef"}}, {st_schar, {"schar","byte"}}, {st_uchar, {"uchar"}}, {st_short, {"short"}}, {st_shorten, {"shorten"}}, {st_int, {"int"}}, {st_float, {"float"}}, {st_double, {"double"}}, {st_mulaw, {"mulaw"}}, {st_adpcm, {"adpcm"}}, {st_alaw, {"alaw"}}, {st_ascii, {"ascii"}}, {st_unknown, {0}} }; EST_TNamedEnum EST_sample_type_map(st_names); void differentiate(EST_Wave &sig) { for (int i = 0; i < sig.num_samples() -1; ++i) sig.a(i) = sig.a(i + 1) - sig.a(i); sig.resize(sig.num_samples()-1); } void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list) { if (&single == &multi) { // some nasty person has passed us the same wave for output and input. EST_Wave tmp; extract_channels(tmp, multi, ch_list); single.copy(tmp); return; } int channel, i; int c = multi.num_channels(); int num_samples = multi.num_samples(); short *buf = new short [num_samples]; EST_Litem *p; single.resize(num_samples, ch_list.length()); single.set_sample_rate(multi.sample_rate()); single.set_file_type(multi.file_type()); for (i = 0, p = ch_list.head(); p; p = p->next(), ++i) { channel = ch_list(p); if (channel < 0 || channel >= c) EST_error("Can't extract channel %d from %d channel waveform\n", channel, c); multi.copy_channel(channel, buf); single.set_channel(i, buf); } } int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel) { if (&single == &multi) { // some nasty person has passed us the same wave for output and input. EST_Wave tmp; int v = wave_extract_channel(tmp, multi, channel); if(v==0) single.copy(tmp); return v; } int c = multi.num_channels(); if (channel < 0 || channel >= c) { cerr << "Can't extract channel " << channel << " from " << c << " channel waveform\n"; return -1; } EST_Wave subwave; multi.sub_wave(subwave, 0, EST_ALL, channel, 1); single.copy(subwave); return 0; } void extract_channels(EST_Wave &single, const EST_Wave &multi, int channel) { EST_IList a; a.append(channel); extract_channels(single, multi, a); } void wave_combine_channels(EST_Wave &s,const EST_Wave &m) { if (&s == &m) { // some nasty person has passed us the same wave for output and input. EST_Wave tmp; wave_combine_channels(tmp,m); s = tmp; return; } s.resize(m.num_samples(), 1, FALSE); s.set_sample_rate(m.sample_rate()); for(int i=0; i Extract sub-wave starting at this time, specified in \n" " seconds\n\n" "-end Extract sub-wave ending at this time, specified in \n" " seconds\n\n" "-from Extract sub-wave starting at this sample point\n\n" "-to Extract sub-wave ending at this sample point\n\n"; } EST_String options_wave_input(void) { // The standard waveform input options return EST_String("")+ "-itype Input file type (optional). If set to raw, this \n" " indicates that the input file does not have a header. While \n" " this can be used to specify file types other than raw, this is \n" " rarely used for other purposes\n" " as the file type of all the existing supported \n" " types can be determined automatically from the \n" " file's header. If the input file is unheadered, \n" " files are assumed to be shorts (16bit). \n" " Supported types are \n" " "+options_wave_filetypes()+"\n\n" "-n Number of channels in an unheadered input file \n\n" "-f Sample rate in Hertz for an unheadered input file \n\n" "-ibo Input byte order in an unheadered input file: \n" " possibliities are: MSB , LSB, native or nonnative. \n" " Suns, HP, SGI Mips, M68000 are MSB (big endian) \n" " Intel, Alpha, DEC Mips, Vax are LSB (little \n" " endian)\n\n" "-iswap Swap bytes. (For use on an unheadered input file)\n\n" "-istype Sample type in an unheadered input file:\n" " short, mulaw, byte, ascii\n\n" "-c Select a single channel (starts from 0). \n" " Waveforms can have multiple channels. This option \n" " extracts a single channel for progcessing and \n" " discards the rest. \n\n"+ options_subwave(); // old option // "-ulaw Assume unheadered input is 8k ulaw\n\n" // this facility moved into na_play // "-r* Select subrange of file. (ESPS compatible)\n\n" } EST_String options_wave_output(void) { return EST_String("")+ "-o Output filename. If not specified output is\n" " to stdout.\n\n" "-otype Output file type, (optional). If no type is\n" " Specified the type of the input file is assumed.\n" " Supported types are: \n" " "+options_wave_filetypes()+"\n\n" "-F Output sample rate in Hz. If this is different \n" " from the input sample rate, resampling will occur \n\n" "-obo Output byte order: MSB, LSB, native, or nonnative. \n" " Suns, HP, SGI Mips, M68000 are MSB (big endian) \n" " Intel, Alpha, DEC Mips, Vax are LSB \n" " (little endian)\n\n" "-oswap Swap bytes when saving to output\n\n"+ "-ostype Output sample type: short, mulaw, byte or ascii\n\n"; } Declare_TNamedEnum(EST_sample_type_t) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" Instantiate_TNamedEnum(EST_sample_type_t) #endif speech_tools/speech_class/EST_TrackFile.cc0000644000076400007640000016303311465017156017217 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : August 1995 */ /*-----------------------------------------------------------------------*/ /* File I/O functions for EST_Track class */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_unix.h" #include "EST_types.h" #include "EST_Track.h" #include "EST_track_aux.h" #include "EST_TrackMap.h" #include "EST_cutils.h" #include "EST_Token.h" #include "EST_TList.h" #include "EST_string_aux.h" #include "EST_walloc.h" #include "EST_TrackFile.h" #include "EST_FileType.h" #include "EST_WaveFile.h" #include "EST_wave_utils.h" // size of locally allocated buffer. If more channels than this we have to // call new #define NEARLY_ZERO 0.00001 #define REASONABLE_FRAME_SIZE (20) #define UNREASONABLE_FRAME_SIZE (80) #if 0 static const char *NIST_SIG = "NIST_1A\n 1024\n"; static const char *NIST_END_SIG = "end_head\n"; #define NIST_HDR_SIZE 1024 // default for tracks is the standard EMA sample rate static int def_load_sample_rate = 500; #endif // some functions written for reading NIST headered waveform files, // but useful here. int nist_get_param_int(char *hdr, char *field, int def_val); char *nist_get_param_str(char *hdr, char *field, char *def_val); const char *sample_type_to_nist(enum EST_sample_type_t sample_type); enum EST_sample_type_t nist_to_sample_type(char *type); EST_read_status read_est_header(EST_TokenStream &ts, EST_Features &hinfo, bool &ascii, EST_EstFileType &t); EST_read_status EST_TrackFile::load_esps(const EST_String filename, EST_Track &tr, float ishift, float startt) { (void)ishift; (void)startt; float **tt; float fsize; char **fields; int num_points, num_fields, num_values; int i,j; EST_read_status r_val; short fixed; int first_channel=0; r_val = get_track_esps(filename, &fields, &tt, &fsize, &num_points, &num_values, &fixed); if (r_val == misc_read_error) { cerr << "Error reading ESPS file " << filename << endl; return misc_read_error; } else if (r_val == wrong_format) return wrong_format; num_fields = num_values; if (!fixed) { --num_fields; ++first_channel; } tr.resize(num_points,num_fields); tr.fill_time(fsize); for (i = 0; i < num_points; ++i) { for (j = 0; j < num_fields; ++j) tr.a(i, j) = tt[i][j+first_channel]; tr.set_value(i); if (!fixed) tr.t(i) = tt[i][0]; } for (i = 0; i < num_fields; ++i) tr.set_channel_name(fields[i+first_channel], i); // REORG not sure what these should be -- awb tr.set_single_break(false); tr.set_equal_space(true); // get_track_esps allocs all the memory, we therefore need to release it for (i = 0; i < num_values; ++i) wfree(fields[i]); wfree(fields); for (i = 0; i < num_values; ++i) wfree(tt[i]); wfree(tt); tr.set_file_type(tff_esps); tr.set_name(filename); if (tr.channel_name(0) == "F0") espsf0_to_track(tr); return format_ok; } EST_read_status EST_TrackFile::load_ascii(const EST_String filename, EST_Track &tr, float ishift, float startt) { (void)startt; EST_TokenStream ts, tt; EST_StrList sl; int i, j, n_rows, n_cols=0; EST_String t; EST_Litem *p; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); if (ishift < NEARLY_ZERO) { cerr<< "Error: Frame spacing must be specified (or apparent frame shift nearly zero)\n"; return misc_read_error; } // first read in as list for (n_rows = 0; !ts.eof(); ++n_rows) sl.append(ts.get_upto_eoln().string()); if (n_rows > 0) { tt.open_string(sl.first()); for (n_cols = 0; !tt.eof(); ++n_cols) tt.get().string(); } // resize track and copy values in tr.resize(n_rows, n_cols); for (p = sl.head(), i = 0; p != 0; ++i, p = p->next()) { bool ok; tt.open_string(sl(p)); for (j = 0; !tt.eof(); ++j) tr.a(i, j) = tt.get().Float(ok); if (j != n_cols) { cerr << "Wrong number of points in row " << i << endl; cerr << "Expected " << n_cols << " got " << j << endl; return misc_read_error; } } tr.fill_time(ishift); tr.set_single_break(FALSE); tr.set_equal_space(TRUE); tr.set_file_type(tff_ascii); tr.set_name(filename); return format_ok; } EST_read_status EST_TrackFile::load_xgraph(const EST_String filename, EST_Track &tr, float ishift, float startt) { (void)ishift; (void)startt; EST_TokenStream ts, tt; EST_StrList sl; // const float NEARLY_ZERO = 0.001; int i, j, n_rows, n_cols; EST_String t; EST_Litem *p; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); // first read in as list for (n_rows = 0; !ts.eof(); ++n_rows) sl.append(ts.get_upto_eoln().string()); tt.open_string(sl.first()); for (n_cols = 0; !tt.eof(); ++n_cols) tt.get().string(); --n_cols; // first column is time marks // resize track and copy values in tr.resize(n_rows, n_cols); for (p = sl.head(), i = 0; p != 0; ++i, p = p->next()) { bool ok; tt.open_string(sl(p)); tr.t(i) = tt.get().Float(ok); for (j = 0; !tt.eof(); ++j) tr.a(i, j) = tt.get().Float(ok); if (j != n_cols) { cerr << "Wrong number of points in row " << i << endl; cerr << "Expected " << n_cols << " got " << j << endl; return misc_read_error; } } tr.set_single_break(FALSE); tr.set_equal_space(TRUE); tr.set_file_type(tff_xgraph); tr.set_name(filename); return format_ok; } EST_read_status EST_TrackFile::load_xmg(const EST_String filename, EST_Track &tr, float ishift, float startt) { (void)ishift; (void)startt; EST_TokenStream ts; EST_StrList sl; int i, n, sr; EST_String t, k, v; EST_Litem *p; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); if (ts.peek().string() != "XAO1") return wrong_format; ts.get().string(); while ((!ts.eof()) && (ts.peek().string() != "\014")) { k = ts.get().string(); v = ts.get().string(); if (k == "Freq") sr = v.Int() * 1000; else if (k == "YMin") /* tr.amin = atof(v) */; else if (k == "YMax") /*tr.amax = atof(v) */; } if (ts.eof()) { cerr << "Unexpected end of file in reading xmg header\n"; return misc_read_error; } ts.get().string(); // read control L ts.get_upto_eoln().string(); // read until end of header // read in lines to a list for (n = 0; !ts.eof(); ++n) sl.append(ts.get_upto_eoln().string()); // note the track size is total number of points *and* breaks tr.resize(n, 1 ); // REORG - fix this for multi channel work for (p = sl.head(), i = 0; p != 0; ++i, p = p->next()) { bool ok; ts.open_string(sl(p)); if (ts.peek().string() != "=") { tr.t(i) = ts.get().Float(ok) / 1000.0; tr.a(i) = ts.get().Float(ok); } else { ts.get().string(); tr.set_break(i); } } tr.set_single_break(TRUE); tr.set_equal_space(FALSE); tr.set_file_type(tff_xmg); tr.set_name(filename); return format_ok; } EST_read_status EST_TrackFile::load_est(const EST_String filename, EST_Track &tr, float ishift, float startt) { EST_TokenStream ts; EST_read_status r; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } // set up the character constant values for this stream ts.set_SingleCharSymbols(";"); tr.set_name(filename); r = load_est_ts(ts, tr, ishift, startt); if ((r == format_ok) && (!ts.eof())) { cerr << "Not end of file, but expected it\n"; return misc_read_error; } else return r; } static float get_float(EST_TokenStream &ts,int swap) { float f; ts.fread(&f,4,1); if (swap) swapfloat(&f); return f; } EST_read_status EST_TrackFile::load_est_ts(EST_TokenStream &ts, EST_Track &tr, float ishift, float startt) { (void)ishift; (void)startt; int i, j; int num_frames, num_channels, num_aux_channels; EST_Features hinfo; EST_EstFileType t; EST_String v; bool ascii; bool breaks; bool eq_space; EST_read_status r; int swap; if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) return r; if (t != est_file_track) return misc_read_error; breaks = hinfo.present("BreaksPresent") ? true : false; eq_space = false; if ((hinfo.present("EqualSpace")) && ((hinfo.S("EqualSpace") == "true") || (hinfo.S("EqualSpace") == "1"))) eq_space = true; num_frames = hinfo.I("NumFrames"); num_channels = hinfo.I("NumChannels"); num_aux_channels = hinfo.I("NumAuxChannels", 0); tr.resize(num_frames, num_channels); hinfo.remove("NumFrames"); hinfo.remove("EqualSpace"); hinfo.remove("NumChannels"); hinfo.remove("BreaksPresent"); hinfo.remove("DataType"); if (hinfo.present("NumAuxChannels")) hinfo.remove("NumAuxChannels"); EST_String strn, cname; EST_Features::Entries p, c; EST_StrList ch_map; for (p.begin(hinfo); p;) { c = p++; if (c->k.contains("Aux_Channel_")) { ch_map.append(c->v.String()); hinfo.remove(c->k); } else if (c->k.contains("Channel_")) { tr.set_channel_name(c->v.String(), c->k.after("Channel_").Int()); hinfo.remove(c->k); } } tr.resize_aux(ch_map); // tr.create_map(); // if (((hinfo.S("ByteOrder", "") == "01") ? bo_little : bo_big) if (!hinfo.present("ByteOrder")) swap = FALSE; // ascii or not there for some reason else if (((hinfo.S("ByteOrder") == "01") ? bo_little : bo_big) != EST_NATIVE_BO) swap = TRUE; else swap = FALSE; const int BINARY_CHANNEL_BUFFER_SIZE=1024; float *frame=0; float frame_buffer[BINARY_CHANNEL_BUFFER_SIZE]; if( !ascii ) { if( num_channels > BINARY_CHANNEL_BUFFER_SIZE ) frame = new float[num_channels]; else frame = frame_buffer; } // there are too many ifs here for (i = 0; i < num_frames; ++i) { bool ok; // Read Times if (ascii) { if (ts.eof()) { cerr << "unexpected end of file when looking for " << num_frames-i << " more frame(s)" << endl; return misc_read_error; } tr.t(i) = ts.get().Float(ok); if (!ok) return misc_read_error; } else tr.t(i) = get_float(ts,swap); // Read Breaks if (breaks) { if (ascii) { v = ts.get().string(); if (v == "0") tr.set_break(i); else tr.set_value(i); } else { if (get_float(ts,swap) == 0.0) tr.set_break(i); else tr.set_value(i); } } else tr.set_value(i); // Read Channels // for (j = 0; j < num_channels; ++j) // { // if(ascii) // { // tr.a(i, j) = ts.get().Float(ok); // if (!ok) // return misc_read_error; // } // else // tr.a(i,j) = get_float(ts,swap); // } if( ascii ){ for (j = 0; j < num_channels; ++j){ tr.a(i, j) = ts.get().Float(ok); if (!ok) return misc_read_error; } } else{ ts.fread( frame, sizeof(float), num_channels ); if( swap ) for( j=0; jk, (const char *) p->v.String()); fprintf(fp, "EST_Header_End\n"); for (i = 0; i < tr.num_frames(); ++i) { fprintf(fp, "%f\t", tr.t(i)); fprintf(fp, "%s\t", (char *)(tr.val(i) ? "1 " : "0 ")); for (j = 0; j < tr.num_channels(); ++j) fprintf(fp, "%f ", tr.a_no_check(i, j)); for (j = 0; j < tr.num_aux_channels(); ++j) fprintf(fp, "%s ", (const char *)tr.aux(i, j).string()); fprintf(fp, "\n"); } return write_ok; } EST_write_status EST_TrackFile::save_est_ascii(const EST_String filename, EST_Track tr) { FILE *fd; EST_write_status r; if (filename == "-") fd = stdout; else if ((fd = fopen(filename,"wb")) == NULL) return write_fail; r = save_est_ts(fd,tr); if (fd != stdout) fclose(fd); return r; } EST_write_status EST_TrackFile::save_est_binary(const EST_String filename, EST_Track tr) { FILE *fd; EST_write_status r; if (filename == "-") fd = stdout; else if ((fd = fopen(filename,"wb")) == NULL) return write_fail; r = save_est_binary_ts(fd,tr); if (fd != stdout) fclose(fd); return r; } EST_write_status EST_TrackFile::save_est_binary_ts(FILE *fp, EST_Track tr) { int i,j; // This should be made optional bool breaks = TRUE; fprintf(fp, "EST_File Track\n"); fprintf(fp, "DataType binary\n"); fprintf(fp, "ByteOrder %s\n", ((EST_NATIVE_BO == bo_big) ? "10" : "01")); fprintf(fp, "NumFrames %d\n", tr.num_frames()); fprintf(fp, "NumChannels %d\n",tr.num_channels()); fprintf(fp, "EqualSpace %d\n",tr.equal_space()); if(breaks) fprintf(fp, "BreaksPresent true\n"); fprintf(fp, "CommentChar ;\n\n"); for (i = 0; i < tr.num_channels(); ++i) fprintf(fp, "Channel_%d %s\n",i,tr.channel_name(i).str()); fprintf(fp, "EST_Header_End\n"); for (i = 0; i < tr.num_frames(); ++i) { // time if((int)fwrite(&tr.t(i),4,1,fp) != 1) return misc_write_error; // break marker if (breaks) { float bm = (tr.val(i) ? 1 : 0); if((int)fwrite(&bm,4,1,fp) != 1) return misc_write_error; } // data - restricted to floats at this time for (j = 0; j < tr.num_channels(); ++j) if((int)fwrite(&tr.a_no_check(i, j),4,1,fp) != 1) return misc_write_error; } return write_ok; } EST_write_status EST_TrackFile::save_ascii(const EST_String filename, EST_Track tr) { if (tr.equal_space() == TRUE) tr.change_type(0.0, FALSE); ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; outf->precision(5); outf->setf(ios::fixed, ios::floatfield); outf->width(8); for (int i = 0; i < tr.num_frames(); ++i) { for (int j = 0; j < tr.num_channels(); ++j) *outf << tr.a(i, j) << " "; *outf << endl; } if (outf != &cout) delete outf; return write_ok; } EST_write_status EST_TrackFile::save_xgraph(const EST_String filename, EST_Track tr) { ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; tr.change_type(0.0, TRUE); for (int j = 0; j < tr.num_channels(); ++j) { *outf << "\""<< tr.channel_name(j) << "\"\n"; for (int i = 0; i < tr.num_frames(); ++i) if (tr.val(i)) *outf << tr.t(i) << "\t" << tr.a(i, j) << endl; else *outf << "move "; } if (outf != &cout) delete outf; return write_ok; } EST_write_status save_snns_pat(const EST_String filename, EST_TrackList &inpat, EST_TrackList &outpat) { ostream *outf; int num_inputs, num_outputs, num_pats, i; EST_Litem *pi, *po; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; num_pats = 0; for (pi = inpat.head(); pi ; pi = pi->next()) num_pats += inpat(pi).num_frames(); *outf << "SNNS pattern definition file V3.2\n"; time_t thetime = time(0); char *date = ctime(&thetime); *outf << date; *outf << endl; num_inputs = inpat.first().num_channels(); num_outputs = outpat.first().num_channels(); *outf << "No. of patterns : " << num_pats << endl; *outf << "No. of input units : "<< num_inputs << endl; *outf << "No. of output units : "<< num_outputs << endl; *outf << endl << endl; for (pi = inpat.head(), po = outpat.head(); pi ; pi = pi->next(), po = po->next()) { if (inpat(pi).num_frames() != outpat(pi).num_frames()) { cerr << "Error: Input pattern has " << inpat(pi).num_frames() << " output pattern has " << outpat(pi).num_frames() << endl; if (outf != &cout) delete outf; return misc_write_error; } for (i = 0; i < inpat(pi).num_frames(); ++i) { int j; *outf << "#Input pattern " << (i + 1) << ":\n"; for (j = 0; j < inpat(pi).num_channels(); ++j) *outf << inpat(pi).a(i, j) << " "; *outf << endl; *outf << "#Output pattern " << (i + 1) << ":\n"; for (j = 0; j < outpat(po).num_channels(); ++j) *outf << outpat(po).a(i, j) << " "; *outf << endl; } } if (outf != &cout) delete outf; return write_ok; } /* EST_write_status EST_TrackFile::save_snns_pat(const EST_String filename, EST_TrackList &trlist) { ostream *outf; int num_inputs, num_outputs, i; EST_Litem *p; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; *outf << "SNNS pattern definition file V3.2\n"; char *date; date = ctime(clock()); *cout << date << endl; *cout << endl << endl; num_inputs = tr.first.num_channels(); num_outputs = tr.first.num_channels(); *cout << "No. of patterns : " << tr.size() << endl; *cout << "No. of input units : "<< num_inputs << endl; *cout << "No. of output units : "<< num_outputs << endl; for (i = 0, p = trlist.head(); p ; p = p->next(), ++i) { *outf << "#Input pattern " << i << ":\n"; for (int j = 0; j < num_inputs; ++j) *outf << << trlist(p)._name(j) << "\"\n"; for (int i = 0; i < tr.num_frames(); ++i) if (tr.val(i)) *outf << tr.t(i) << "\t" << tr.a(i, j) << endl; else *outf << "move "; } if (outf != &cout) delete outf; return write_ok; } */ EST_write_status EST_TrackFile::save_xmg(const EST_String filename, EST_Track tr) { ostream *outf; int i, j; // float min, max; int sr = 16000; // REORG - fixed sample rate until xmg is fixed // this takes care of rescaling tr.change_type(0.0, TRUE); if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; outf->precision(5); outf->setf(ios::fixed, ios::floatfield); outf->width(8); /* min = max = tr.a(0); for (i = 0; i < tr.num_frames(); ++i) { if (tr.a(i) > max) max = tr.a(i); if (tr.a(i) < min) min = tr.a(i); } */ *outf << "XAO1\n\n"; // xmg header identifier. *outf << "LineType segments \n"; *outf << "LineStyle solid \n"; *outf << "LineWidth 0 \n"; *outf << "Freq " << sr / 1000 << endl; // a REAL pain! *outf << "Format Binary \n"; // *outf << "YMin " << ((tr.amin != 0.0) ? tr.amin : min) << endl; // *outf << "YMax " << ((tr.amax != 0.0) ? tr.amax : max) << endl; /* if (tr.color != "") *outf << "LineColor " << tr.color << endl; */ *outf << char(12) << "\n"; // control L character // rm_excess_breaks(); // rm_trailing_breaks(); for (i = 0; i < tr.num_frames(); ++i) if (tr.val(i)) { *outf << tr.ms_t(i) << "\t"; for (j = 0; j < tr.num_channels(); ++j) *outf < 1) { cerr << "Warning: multiple channel track being written" << endl; cerr << " as discrete will only save channel 0 !" << endl; } for (i = 0; i < track.num_frames(); ++i) { short tempshort = (EST_BIG_ENDIAN ? (short)(track.a(i, 0)) : SWAPSHORT((short)(track.a(i, 0)))) ; fwrite((unsigned char*) &tempshort, 1, sizeof(short), outf); } } } else // not HTK_DISCRETE for (i = 0; i < track.num_frames(); ++i) { if ((type & HTK_EST_PS) != 0) { if(!EST_BIG_ENDIAN) swapfloat(&(track.t(i))); fwrite((unsigned char*) &(track.t(i)), 1, sizeof(float), outf); } for (j = 0; j < track.num_channels(); ++j) { if(!EST_BIG_ENDIAN) swapfloat(&(track.a(i,j))); fwrite((unsigned char*) &(track.a(i, j)), 1, sizeof(float), outf); } } if (outf != stdout) fclose(outf); return write_ok; } static int htk_sane_header(htk_header *htk) { return htk->num_samps > 0 && htk->samp_period > 0 && htk->samp_size > 0 && htk->samp_size < (short)(UNREASONABLE_FRAME_SIZE * sizeof(float)); } static int htk_swapped_header(htk_header *header) { // Tries to guess if the header is swapped. If so it // swaps the contents and returns TRUE, other returns FALSE // HTK doesn't have a magic number so we need heuristics to // guess when its byte swapped if (htk_sane_header(header)) return 0; header->num_samps = SWAPINT(header->num_samps); header->samp_period = SWAPINT(header->samp_period); header->samp_size = SWAPSHORT(header->samp_size); header->samp_type = SWAPSHORT(header->samp_type); if (htk_sane_header(header)) return 1; return -1; } EST_write_status EST_TrackFile::save_htk(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_FBANK); } EST_write_status EST_TrackFile::save_htk_fbank(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_FBANK); } EST_write_status EST_TrackFile::save_htk_mfcc(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_MFCC); } EST_write_status EST_TrackFile::save_htk_mfcc_e(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_MFCC | HTK_ENERGY); } EST_write_status EST_TrackFile::save_htk_user(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_USER); } EST_write_status EST_TrackFile::save_htk_discrete(const EST_String filename, EST_Track tmp) { return save_htk_as(filename, tmp, HTK_DISCRETE); } static EST_read_status load_ema_internal(const EST_String filename, EST_Track &tmp, float ishift, float startt, bool swap) { (void)ishift; (void)startt; int i, j, k, nframes, new_order; EST_TVector file_data; int sample_width, data_length; float shift; FILE *fp; if ((fp = fopen(filename, "rb")) == NULL) { cerr << "EST_Track load: couldn't open EST_Track input file" << endl; return misc_read_error; } fseek(fp, 0, SEEK_END); sample_width = 2; data_length = ftell(fp)/sample_width; new_order = 10; nframes = data_length /new_order; shift = 0.002; cout << "d length: " << data_length << " nfr " << nframes << endl; tmp.resize(nframes, new_order); tmp.fill_time(shift); tmp.set_equal_space(TRUE); file_data.resize(data_length); fseek(fp, 0, SEEK_SET); if ((int)fread(file_data.memory(), sample_width, data_length, fp) != data_length) { fclose(fp); return misc_read_error; } if (swap) swap_bytes_short(file_data.memory(), data_length); for (i = k = 0; i < nframes; ++i) for (j = 0; j < new_order; ++j, ++k) tmp.a(i, j) = (float)file_data.a_no_check(k); // name the fields EST_String t; // the first 'order' fields are always called c1,c2... // AWB bug -- the following corrupts memory /* for (i = 0; i < order; i++) { EST_String t2; t2 = EST_String("c") + itoString(i+1); tmp.set_field_name(t2, i); } i=order; */ cout << "here \n"; tmp.set_name(filename); tmp.set_file_type(tff_ema); fclose(fp); return format_ok; } EST_read_status EST_TrackFile::load_ema(const EST_String filename, EST_Track &tmp, float ishift, float startt) { return load_ema_internal(filename, tmp, ishift, startt, FALSE); } EST_read_status EST_TrackFile::load_ema_swapped(const EST_String filename, EST_Track &tmp, float ishift, float startt) { return load_ema_internal(filename, tmp, ishift, startt, TRUE); } #if 0 EST_read_status EST_TrackFile::load_NIST(const EST_String filename, EST_Track &tmp, float ishift, float startt) { (void)ishift; // what does this do ? (void)startt; char header[NIST_HDR_SIZE]; int samps,sample_width,data_length,actual_bo; unsigned char *file_data; enum EST_sample_type_t actual_sample_type; char *byte_order, *sample_coding; int n,i,j,k; int current_pos; int offset=0; EST_TokenStream ts; if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open track file " << filename << endl; return misc_read_error; } current_pos = ts.tell(); if (ts.fread(header,NIST_HDR_SIZE,1) != 1) return misc_read_error; if (strncmp(header,NIST_SIG,sizeof(NIST_SIG)) != 0) return wrong_format; samps = nist_get_param_int(header,"sample_count",-1); int num_channels = nist_get_param_int(header,"channel_count",1); sample_width = nist_get_param_int(header,"sample_n_bytes",2); int sample_rate = nist_get_param_int(header,"sample_rate",def_load_sample_rate); byte_order = nist_get_param_str(header,"sample_byte_format", (EST_BIG_ENDIAN ? "10" : "01")); sample_coding = nist_get_param_str(header,"sample_coding","pcm"); data_length = (samps - offset)*num_channels; file_data = walloc(unsigned char,sample_width * data_length); ts.seek(current_pos+NIST_HDR_SIZE+(sample_width*offset*(num_channels))); n = ts.fread(file_data,sample_width,data_length); if ((n < 1) && (n != data_length)) { wfree(file_data); wfree(sample_coding); wfree(byte_order); return misc_read_error; } else if ((n < data_length) && (data_length/num_channels == n)) { fprintf(stderr,"TRACK read: nist header is (probably) non-standard\n"); fprintf(stderr,"TRACK read: assuming different num_channel interpretation\n"); data_length = n; /* wrongly headered file */ } else if (n < data_length) { fprintf(stderr,"TRACK read: short file %s\n", (const char *)ts.filename()); fprintf(stderr,"WAVE read: at %d got %d instead of %d samples\n", offset,n,data_length); data_length = n; } actual_sample_type = nist_to_sample_type(sample_coding); actual_bo = ((strcmp(byte_order,"10") == 0) ? bo_big : bo_little); short *data; data = convert_raw_data(file_data,data_length, actual_sample_type,actual_bo); // copy into the Track int num_samples = data_length/num_channels; tmp.resize(num_samples, num_channels); tmp.set_equal_space(TRUE); tmp.fill_time(1/(float)sample_rate); cerr << "shift " << 1/(float)sample_rate << endl; k=0; for (i=0; i REASONABLE_FRAME_SIZE){ compressA = new float[num_values]; compressB = new float[num_values]; } else{ compressA = compressA_Buffer; compressB = compressB_Buffer; } if( (fread( compressA, sizeof(float), num_values, fp )) != static_cast(num_values) ){ fclose( fp ); return read_format_error; } if( (fread( compressB, sizeof(float), num_values, fp )) != static_cast(num_values) ){ fclose( fp ); return read_format_error; } if (swap){ swap_bytes_float( compressA, num_values ); swap_bytes_float( compressB, num_values ); } // subtract extra frames to account for the two vectors of floats // used for decompression. new_frames = header.num_samps - (2*(sizeof(float)-sizeof(short int))); } else{ num_channels = num_values = header.samp_size / sizeof(float); new_frames = header.num_samps; } if (num_values > UNREASONABLE_FRAME_SIZE){ fclose(fp); return read_format_error; } if (time_included) num_channels -= 1; float shift = ((float)header.samp_period/ (float)HTK_UNITS_PER_SECOND); tmp.resize(new_frames, num_channels); if ((startt > 0) && (startt < NEARLY_ZERO )) EST_warning( "setting htk file start to %f", startt ); tmp.fill_time(shift, startt); tmp.set_equal_space(!time_included); // check length of file is as expected from header info long dataBeginPosition = ftell(fp); if( dataBeginPosition == -1 ){ fclose(fp); return wrong_format; } if (fseek(fp,0,SEEK_END)){ fclose(fp); return wrong_format; } long file_length; if ((file_length = ftell(fp)) == -1){ fclose(fp); return wrong_format; } long expected_vals; if( fileIsCompressed ){ expected_vals = (file_length-dataBeginPosition) / sizeof(short int); if( header.samp_type & HTK_CRC ) expected_vals -= 1; // just ignore the appended cyclic redundancy checksum } else expected_vals = (file_length-dataBeginPosition) / sizeof(float); /* printf( "%d %d %d %d %d %d\n", expected_vals, file_length, dataBeginPosition, sizeof(float), num_values, new_frames ); */ if( expected_vals != (num_values * new_frames) ){ // it probably isn't HTK format after all fclose(fp); return wrong_format; } // work out the order of the analysis // Reorg -- surely you can't increase order order = num_channels; if( samp_type & HTK_NO_E ) order++; if( samp_type & HTK_AC ) order /= 3; else if( samp_type & HTK_DELTA ) order /= 2; if( samp_type & HTK_ENERGY ) order--; // go to start of data if( fseek(fp, dataBeginPosition, SEEK_SET) == -1 ){ cerr << "Couldn't position htk file at start of data" << endl; fclose(fp); return misc_read_error; } if( fileIsCompressed ){ short int *frame, frame_buffer[REASONABLE_FRAME_SIZE]; if( num_values > REASONABLE_FRAME_SIZE ) frame = new short int[num_values]; else frame = frame_buffer; int first_channel = time_included?1:0; for( i=0; i REASONABLE_FRAME_SIZE) frame = new float[num_values]; else frame = frame_buffer; int first_channel = time_included?1:0; for( i=0; inext()) tlist(p).save(tlist(p).name(), otype); return write_ok; } EST_read_status read_TrackList(EST_TrackList &tlist, EST_StrList &files, EST_Option &al) { EST_Track s; EST_Litem *p, *plp; for (p = files.head(); p; p = p->next()) { tlist.append(s); plp = tlist.tail(); if (read_track(tlist(plp), files(p), al) != format_ok) exit (-1); tlist(plp).set_name(files(p)); } return format_ok; } int read_track(EST_Track &tr, const EST_String &in_file, EST_Option &al) { float ishift = 0; float startt = 0.0; if( al.present("-startt") ) startt = al.fval( "-startt" ); if (al.present("ishift")) ishift = al.fval("ishift"); else if (al.present("-s")) ishift = al.fval("-s"); else if (al.present("time_channel")) ishift = 1.0; // doesn't matter, will be reset by track if (al.present("-itype")) { if (tr.load(in_file, al.val("-itype", 0), ishift, startt) != format_ok) return -1; } else { if (tr.load(in_file, ishift, startt ) != format_ok) return -1; } // tr.create_map(); // cout << "f0 "<< tr.has_channel(channel_f0) << ".\n"; // if (al.present("time_channel") && tr.has_channel(al.sval("time_channel"))) // { // cout << " time from channel " << al.sval("time_channel") << "\n"; // channel_to_time(tr, al.sval("time_channel"), al.fval("time_scale")); // } // cout << tr; return 0; } EST_String EST_TrackFile::options_short(void) { EST_String s(""); for(int n=0; n< EST_TrackFile::map.n() ; n++) { const char *nm = EST_TrackFile::map.name(EST_TrackFile::map.token(n)); if (s != "") s += ", "; s += nm; } return s; } EST_String EST_TrackFile::options_supported(void) { EST_String s("AvailablE track file formats:\n"); for(int n=0; n< EST_TrackFile::map.n() ; n++) { const char *nm = EST_TrackFile::map.name(EST_TrackFile::map.token(n)); const char *d = EST_TrackFile::map.info(EST_TrackFile::map.token(n)).description; s += EST_String::cat(" ", nm, EST_String(" ")*(13-strlen(nm)), d, "\n"); } return s; } // note the order here defines the order in which loads are tried. static EST_TValuedEnumDefinition trackfile_names[] = { { tff_none, { "none" }, {FALSE, NULL, NULL, "unknown track file type"}}, {tff_esps, { "esps" }, {TRUE, EST_TrackFile::load_esps, EST_TrackFile::save_esps, "entropic sps file"}}, {tff_est_ascii, { "est", "est_ascii" }, {TRUE, EST_TrackFile::load_est, EST_TrackFile::save_est_ascii, "Edinburgh Speech Tools track file"}}, {tff_est_binary, { "est_binary" }, {TRUE, EST_TrackFile::load_est, EST_TrackFile::save_est_binary, "Edinburgh Speech Tools track file"}} , {tff_htk, { "htk" }, {TRUE, EST_TrackFile::load_htk, EST_TrackFile::save_htk, "htk file"}}, //{tff_NIST, { "NIST" }, //{TRUE, EST_TrackFile::load_NIST, EST_TrackFile::save_NIST, // "NIST"}}, {tff_htk_fbank, { "htk_fbank" }, {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_fbank, "htk file (as FBANK)"}}, {tff_htk_mfcc, { "htk_mfcc" }, {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_mfcc, "htk file (as MFCC)"}}, {tff_htk_mfcc_e, { "htk_mfcc_e" }, {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_mfcc_e, "htk file (as MFCC_E)"}}, {tff_htk_user, { "htk_user" }, {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_user, "htk file (as USER)"}}, {tff_htk_discrete, { "htk_discrete" }, {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_discrete, "htk file (as DISCRETE)"}}, {tff_ssff, {"ssff"}, {TRUE, EST_TrackFile::load_ssff, EST_TrackFile::save_ssff, "Macquarie University's Simple Signal File Format"}}, {tff_xmg, { "xmg" }, {TRUE, EST_TrackFile::load_xmg, EST_TrackFile::save_xmg, "xmg file viewer"}}, {tff_xgraph, { "xgraph" }, {FALSE, EST_TrackFile::load_xgraph, EST_TrackFile::save_xgraph, "xgraph display program format"}}, {tff_ema, { "ema" }, {FALSE, EST_TrackFile::load_ema, NULL, "ema"}}, {tff_ema_swapped, { "ema_swapped" }, {FALSE, EST_TrackFile::load_ema_swapped, NULL, "ema, swapped"}}, {tff_ascii, { "ascii" }, {TRUE, EST_TrackFile::load_ascii, EST_TrackFile::save_ascii, "ascii decimal numbers"}}, { tff_none, {"none"}, {FALSE, NULL, NULL, "unknown track file type"} } }; EST_TNamedEnumI EST_TrackFile::map(trackfile_names); static EST_TValuedEnumDefinition track_ts_names[] = { { tff_none, { "none" }, {FALSE, NULL, NULL, "unknown track file type"}}, {tff_est_ascii, {"est"}, {TRUE, EST_TrackFile::load_est_ts, EST_TrackFile::save_est_ts, "Edinburgh Speech Tools track file"}}, {tff_est_binary, {"est_binary"}, {TRUE, EST_TrackFile::load_est_ts, EST_TrackFile::save_est_binary_ts, "Edinburgh Speech Tools track file"}}, {tff_ssff, {"ssff"}, {TRUE, EST_TrackFile::load_ssff_ts, EST_TrackFile::save_ssff_ts, "Macquarie University's Simple Signal File Format"}}, { tff_none, { "none" }, {FALSE, NULL, NULL, "unknown track file type"}} }; EST_TNamedEnumI EST_TrackFile::ts_map(track_ts_names); #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" template class EST_TNamedEnumI; template class EST_TValuedEnumI; template class EST_TNamedEnumI; template class EST_TValuedEnumI; #endif speech_tools/speech_class/EST_WaveFile.cc0000644000076400007640000003652711146565373017071 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Richard Caley */ /* ------------------------------------------------------------------- */ /* Wave file input and output. */ /* */ /*************************************************************************/ #include #include "EST_Wave.h" #include "EST_WaveFile.h" #include "waveP.h" #include "EST_cutils.h" #include "EST_Option.h" #include "EST_io_aux.h" #include "stdio.h" #include "math.h" void extract(EST_Wave &sig, EST_Option &al); typedef EST_read_status (*standard_load_fn_fp)(EST_TokenStream &ts, short **data, int *nsamp, int *nchan, int *wsize, int *srate, EST_sample_type_t *stype, int *bo, int offset, int length); typedef EST_write_status (*standard_save_fn_fp)(FILE *fp, const short *data, int offset, int nsamp, int nchan, int srate, EST_sample_type_t stype, int bo); static EST_read_status load_using(standard_load_fn_fp fn, EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { short *data; int nsamp; int wsize; int srate = rate; EST_read_status status = (*fn)(ts, &data, &nsamp, &nchan, &wsize, &srate, &stype, &bo, offset, length); if (status == read_ok) { wv.values().set_memory(data, 0, nsamp, nchan, TRUE); wv.set_sample_rate(srate); } return status; } static EST_write_status save_using(standard_save_fn_fp fn, FILE *fp, const EST_Wave wv, EST_sample_type_t stype, int bo) { EST_write_status status = (*fn)(fp, wv.values().memory(), 0, wv.num_samples(), wv.num_channels(), wv.sample_rate(), stype, bo); return status; } EST_read_status EST_WaveFile::load_nist(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_nist, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_nist(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_nist, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_est(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { (void) ts; return load_using(load_wave_est, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_est(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_est, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_aiff(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_aiff, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_aiff(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_aiff, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_riff(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_riff, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_riff(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_riff, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_esps(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_sd, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_esps(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_sd, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_audlab(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_audlab, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_audlab(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_audlab, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_snd(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_snd, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_snd(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { return save_using(save_wave_snd, fp, wv, stype, bo); } EST_read_status EST_WaveFile::load_raw(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { short *data; int nsamp; int wsize; int srate = rate; EST_read_status status = load_wave_raw(ts, &data, &nsamp, &nchan, &wsize, &srate, &stype, &bo, offset, length, rate, stype, bo, nchan); if (status == read_ok) { wv.values().set_memory(data, 0, nsamp, nchan, TRUE); wv.set_sample_rate(srate); } return status; } EST_write_status EST_WaveFile::save_raw(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { EST_write_status status = save_wave_raw(fp, (short *)wv.values().memory(), 0, wv.num_samples(), wv.num_channels(), wv.sample_rate(), stype, bo); return status; } EST_read_status EST_WaveFile::load_ulaw(EST_TokenStream &ts, EST_Wave &wv, int rate, EST_sample_type_t stype, int bo, int nchan, int offset, int length) { return load_using(load_wave_ulaw, ts, wv, rate, stype, bo, nchan, offset, length); } EST_write_status EST_WaveFile::save_ulaw(FILE *fp, const EST_Wave &wv, EST_sample_type_t stype, int bo) { EST_Wave localwv = wv; localwv.resample(8000); return save_using(save_wave_ulaw, fp, localwv, stype, bo); } static int parse_esps_r_option(EST_String arg, int &offset, int &length) { EST_String s, e; if (arg.contains("-")) { s = arg.before("-"); e = arg.after("-"); } else if (arg.contains(":")) { s = arg.before(":"); e = arg.after(":"); } else { cerr << "Argument to -r is illformed " << arg << endl; return -1; } if (!s.matches(RXint)) { cerr << "First argument to -r must be an integer " << arg << endl; return -1; } offset = atoi(s); if (e.contains("+")) { e = e.after("+"); length = atoi(e); } else length = atoi(e) - offset; if (length <= 0) { cerr << "length is negative or zero " << arg << endl; return -1; } return 0; } EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al) { char *sr; EST_String fname, file_type, sample_type; int sample_rate; EST_read_status rval; int num_channels; int offset=0, length=0; int bo; if (in_file == "-") fname = stdin_to_file(); else fname = in_file; if (al.present("-n")) num_channels = al.ival("-n", 0); else num_channels = 1; if (al.present("-ulaw")) { al.add_item("-itype","ulaw"); al.add_item("-f","8000"); } if (al.present("-iswap")) al.add_item("-ibo","other"); if (al.present("-istype")) sample_type = al.val("-istype"); else sample_type = sig.sample_type(); // else default type; if (al.present("-itype")) file_type = al.val("-itype"); // else default type; else file_type = "undef"; if (al.present("-f")) sample_rate = al.ival("-f", 0); else if ((sr = getenv("NA_PLAY_SAMPLE_RATE")) != NULL) { sample_rate = atoi(sr); cerr << "Warning: no sample rate specified, " << " using NA_PLAY_SAMPLE_RATE environment variable\n"; } else { sample_rate = EST_Wave::default_sample_rate; if (file_type == "raw") cerr << "Warning: no sample rate specified - using default " << sample_rate << endl; } if (file_type == "ulaw") { sample_rate = 8000; sample_type = "mulaw"; } if (al.present("-r")) // only load in part of waveform { if (parse_esps_r_option(al.val("-r"), offset, length) != 0) return read_error; } else offset = length = 0; if (al.present("-iswap")) bo = str_to_bo("swap"); else bo = str_to_bo("native"); if (al.present("-ibo")) // can override -iswap bo = str_to_bo(al.val("-ibo")); if (file_type == "" ||file_type == "undef") rval = sig.load(fname, offset, length, sample_rate); else rval = sig.load_file(fname,file_type, sample_rate, sample_type, bo, num_channels, offset, length); if ((rval == wrong_format) && (al.present("-basic"))) { // For HTML audio/basic, it seems to mean headered or ulaw 8k // so try to load it again as ulaw 8k. rval = sig.load_file(fname, "raw", 8000, "mulaw", bo, 1, offset, length); } if (rval != format_ok) { if (in_file == "-") unlink(fname); cerr << "Cannot recognize file format or cannot access file: \"" << in_file << "\"\n"; return read_error; } if (al.present("-start") || al.present("-end") || al.present("-to") || al.present("-from")) extract(sig, al); if (in_file == "-") unlink(fname); return read_ok; } EST_write_status write_wave(EST_Wave &sig, const EST_String &out_file, EST_Option &al) { EST_String file_type, sample_type; int bo; if (al.present("-otype")) file_type = al.val("-otype"); else file_type = sig.file_type(); if (al.present("-ostype")) sample_type = al.val("-ostype"); else sample_type = "undef"; if (al.present("-oswap")) bo = str_to_bo("swap"); else bo = str_to_bo("native"); if (al.present("-obo")) // can over ride -oswap bo = str_to_bo(al.val("-obo")); if (sample_type == "undef" || sample_type == "") sample_type = "short"; if (sig.save_file(out_file, file_type, sample_type, bo) != write_ok) { cerr << "Cannot write file: \"" << out_file << "\"\n"; return write_error; } return write_ok; } EST_String EST_WaveFile::options_short(void) { EST_String s(""); for(int n=0; n< EST_WaveFile::map.n() ; n++) { const char *nm = EST_WaveFile::map.name(EST_WaveFile::map.token(n)); if (s != "") s += ", "; s += nm; } return s; } EST_String EST_WaveFile::options_supported(void) { EST_String s("Available wave file formats:\n"); for(int n=0; n< EST_WaveFile::map.n() ; n++) { const char *nm = EST_WaveFile::map.name(EST_WaveFile::map.token(n)); const char *d = EST_WaveFile::map.info(EST_WaveFile::map.token(n)).description; s += EST_String::cat(" ", nm, EST_String(" ")*(12-strlen(nm)), d, "\n"); } return s; } typedef struct TInfo { bool recognise; const char *description; } TInfo; // note the order here defines the order in which loads are tried. static EST_TValuedEnumDefinition wavefile_names[] = { { wff_none, { NULL }, { FALSE, NULL, NULL, "unknown track file type"} }, { wff_nist, { "nist", "timit" }, { TRUE, EST_WaveFile::load_nist, EST_WaveFile::save_nist, "nist/timit" } }, { wff_est, { "est"}, { TRUE, EST_WaveFile::load_est, EST_WaveFile::save_est, "est" } }, { wff_esps, { "esps", "sd"}, { TRUE, EST_WaveFile::load_esps, EST_WaveFile::save_esps, "esps SD waveform" } }, { wff_audlab, { "audlab", "vox"}, { TRUE, EST_WaveFile::load_audlab, EST_WaveFile::save_audlab, "audlab waveform" } }, { wff_snd, { "snd", "au"}, { TRUE, EST_WaveFile::load_snd, EST_WaveFile::save_snd, "Sun snd file" } }, { wff_aiff, { "aiff" }, { TRUE, EST_WaveFile::load_aiff, EST_WaveFile::save_aiff, "Apple aiff file" } }, { wff_riff, { "riff", "wav" }, { TRUE, EST_WaveFile::load_riff, EST_WaveFile::save_riff, "Microsoft wav/riff file" } }, { wff_raw, { "raw" }, { FALSE, EST_WaveFile::load_raw, EST_WaveFile::save_raw, "Headerless File" } }, { wff_ulaw, { "ulaw", "basic" }, { FALSE, EST_WaveFile::load_ulaw, EST_WaveFile::save_ulaw, "Headerless 8K ulaw File" } }, { wff_none, {NULL} } }; EST_TNamedEnumI EST_WaveFile::map(wavefile_names); #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" template class EST_TNamedEnumI; template class EST_TValuedEnumI; #endif speech_tools/speech_class/htk.h0000644000076400007640000001007007262605664015267 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Mon Nov 3 1997 */ /* -------------------------------------------------------------------- */ /* Defines for HTK format. */ /* */ /*************************************************************************/ #ifndef __HTK_H__ #define __HTK_H__ #define HTK_ENERGY 0x0040 #define HTK_NO_E 0x0080 #define HTK_DELTA 0x0100 #define HTK_AC 0x0200 #define HTK_COMP 0x0400 #define HTK_ZM 0x0800 #define HTK_CRC 0x1000 #define HTK_0CEP 0x2000 #define HTK_EST_PS 0x4000 // This is a local one and may become illegal #define HTK_MASK 0x003f #define HTK_WAVE 0x0000 #define HTK_LPC 0x0001 #define HTK_LPCREFC 0x0002 #define HTK_LPCCEP 0x0003 #define HTK_LPDELCEP 0x0004 #define HTK_IREFC 0x0005 #define HTK_MFCC 0x0006 #define HTK_FBANK 0x0007 #define HTK_MELSPEC 0x0008 #define HTK_USER 0x0009 #define HTK_DISCRETE 0x000A /* 100ns = 10 per us = 10 000 per ms = 10 000 000 per second*/ #define HTK_UNITS_PER_SECOND 10000000 struct htk_header { int num_samps; int samp_period; /* in 100ns units -design choice of the century*/ /* I don't think this is right -- awb, is this an old HTK format ? */ short samp_size; /* number of bytes per sample */ short samp_type; /* code from 0 to 10 indicating sample kind */ /* - see HTK reference manual, or #defs above */ }; #endif speech_tools/speech_class/esps_utils.h0000644000076400007640000002011710044502522016653 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* Licence free version of esps file i/o functions: headers */ /* */ /*=======================================================================*/ #ifndef __ESPS_IO_H__ #define __ESPS_IO_H__ #define ESPS_MAGIC 27162 struct ESPS_PREAMBLE { int machine_code; /* the machine that generated this (4 is sun) */ int check_code; /* dunno */ int data_offset; /* offset from start to start of data records */ int record_size; /* data record size in bytes */ int check; /* ESPS magic number */ int edr; /* byte order independent order or native */ int fil1; /* dunno */ int foreign_hd; /* foreign header -- not supported */ }; struct ESPS_FIXED_HDR { short thirteen; /* seems to be always 13 */ short sdr_size; /* always 0 */ int magic; /* magic number again */ char date[26]; /* file creation date */ char version[8]; /* header version */ char prog[16]; /* program used to create file */ char vers[8]; /* program version */ char progcompdate[26]; /* when that program was compile d */ int num_samples; /* number of samples (can be 0) */ int filler; int num_doubles; /* num of doubles in record */ int num_floats; int num_ints; int num_shorts; int num_chars; int fsize; /* always 40 */ int hsize; /* wish I knew, it does vary */ char username[8]; /* user who created this file */ int fil1[5]; /* dunno */ short fea_type; /* may be */ short fil2; short num_fields; /* number of fields in a record */ short fil3; int fil4[9]; /* a bunch of numbers that look like addresses */ int fil5[8]; /* all zeros */ }; struct ESPS_FEA_struct { short type; short clength; char *name; int count; short dtype; union { int *ival; char *cval; float *fval; double *dval; short *sval; } v; struct ESPS_FEA_struct *next; }; typedef struct ESPS_FEA_struct *esps_fea; /* FEA files consist of record which can contain fields (off different */ /* data types) The following is used to represent arbitrary records */ /* names of the records are given in the header structure */ struct ESPS_FIELD_struct { int type; int dimension; union { int *ival; char *cval; float *fval; double *dval; short *sval; } v; }; typedef struct ESPS_FIELD_struct *esps_field; struct ESPS_REC_struct { int num_fields; int size; esps_field *field; }; typedef struct ESPS_REC_struct *esps_rec; enum esps_file_type {ESPS_FEA, ESPS_SD, ESPS_SPGRAM, ESPS_FILT}; /* This is what the user gets/gives, just the useful information */ struct ESPS_HDR_struct { enum esps_file_type file_type; int swapped; /* byte order in file */ int hdr_size; /* full size of file header in bytes */ int num_records; int num_fields; char **field_name; short *field_type; int *field_dimension; esps_fea fea; /* list of FEA */ }; typedef struct ESPS_HDR_struct *esps_hdr; #define ESPS_DOUBLE 1 #define ESPS_FLOAT 2 #define ESPS_INT 3 #define ESPS_SHORT 4 #define ESPS_CHAR 5 /* I doubt I'm treating char and byte appropriately */ #define ESPS_CODED 7 /* enumerated type. Same size as short */ #define ESPS_BYTE 8 /* There are others too including COMPLEX ones */ /* Some random numbers on FEA records */ #define ESPS_FEA_FILE 1 #define ESPS_FEA_DIRECTORY 15 #define ESPS_FEA_COMMAND 11 esps_fea new_esps_fea(void); void delete_esps_fea(esps_fea r); void print_esps_fea(esps_fea r); esps_fea read_esps_fea(FILE *fd, esps_hdr hdr); void write_esps_fea(FILE *fd, esps_fea t, esps_hdr hdr); esps_hdr make_esps_hdr(void); esps_hdr make_esps_sd_hdr(void); void delete_esps_hdr(esps_hdr h); enum EST_read_status read_esps_hdr(esps_hdr *hdr,FILE *fd); enum EST_write_status write_esps_hdr(esps_hdr hdr,FILE *fd); int fea_value_d(const char *name,int pos,esps_hdr hdr,double *d); int fea_value_f(const char *name,int pos,esps_hdr hdr,float *d); int fea_value_s(const char *name,int pos,esps_hdr hdr,short *d); int fea_value_i(const char *name,int pos,esps_hdr hdr,int *d); int fea_value_c(const char *name,int pos,esps_hdr hdr,char *d); double get_field_d(esps_rec r, int field, int pos); float get_field_f(esps_rec r, int field, int pos); int get_field_i(esps_rec r, int field, int pos); short get_field_s(esps_rec r, int field, int pos); char get_field_c(esps_rec r, int field, int pos); void set_field_d(esps_rec r, int field, int pos, double d); void set_field_f(esps_rec r, int field, int pos, float d); void set_field_i(esps_rec r, int field, int pos, int d); void set_field_s(esps_rec r, int field, int pos, short d); void set_field_c(esps_rec r, int field, int pos, char d); esps_rec new_esps_rec(esps_hdr hdr); void delete_esps_rec(esps_rec r); int read_esps_rec(esps_rec r, esps_hdr h, FILE *fd); int write_esps_rec(esps_rec r, esps_hdr h, FILE *fd); void add_field(esps_hdr hdr,const char *name, int type, int dimension); void add_fea_d(esps_hdr hdr,const char *name, int pos, double d); void add_fea_s(esps_hdr hdr,const char *name, int pos, short d); void add_fea_i(esps_hdr hdr,const char *name, int pos, int d); void add_fea_f(esps_hdr hdr,const char *name, int pos, float d); void add_fea_c(esps_hdr hdr,const char *name, int pos, char d); void add_fea_special(esps_hdr hdr,int type,const char *name); #endif /* __ESPS_IO_H__ */ speech_tools/speech_class/waveP.h0000644000076400007640000001550107262605664015567 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black and Paul Taylor */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* Non public wave related functions */ /* */ /*=======================================================================*/ #ifndef __WAVEP_H__ #define __WAVEP_H__ #include /* The follow two (raw and ulaw) cannot be in the table as they cannot */ /* identify themselves from files (both are unheadered) */ enum EST_read_status load_wave_raw(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length, int isample_rate, enum EST_sample_type_t isample_type, int ibo, int inc); enum EST_write_status save_wave_raw(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo) ; enum EST_read_status load_wave_ulaw(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_ulaw(FILE *fp, const short *data, int offset, int length, int num_channels, int sample_rate, enum EST_sample_type_t, int bo); enum EST_read_status load_wave_nist(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_nist(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_est(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_est(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_sd(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_sd(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_audlab(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_audlab(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_snd(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_snd(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_aiff(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_aiff(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); enum EST_read_status load_wave_riff(EST_TokenStream &ts, short **data, int *num_samples, int *num_channels, int *word_size, int *sample_rate, enum EST_sample_type_t *sample_type, int *bo, int offset, int length); enum EST_write_status save_wave_riff(FILE *fp, const short *data, int offset, int num_samples, int num_channels, int sample_rate, enum EST_sample_type_t sample_type, int bo); #endif /* __EST_WAVEP_H__ */ speech_tools/speech_class/EST_wave_utils.h0000644000076400007640000000764107262605664017410 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan Black and Paul Taylor */ /* Date : June 1996 */ /*-----------------------------------------------------------------------*/ /* General low level wave utils (C++) */ /* Conversion routines and lowest level file format independent read */ /* and write functions */ /* */ /*=======================================================================*/ #ifndef __EST_WAVE_UTILS_H__ #define __EST_WAVE_UTILS_H__ #include #include "EST_cutils.h" #include "EST_rw_status.h" #include "EST_WaveFile.h" void ConvertToIeeeExtended(double num,unsigned char *bytes); double ConvertFromIeeeExtended(unsigned char *bytes); int get_word_size(enum EST_sample_type_t sample_type); enum EST_sample_type_t str_to_sample_type(const char *type); const char *sample_type_to_str(enum EST_sample_type_t type); short *convert_raw_data(unsigned char *file_data,int data_length, enum EST_sample_type_t sample_type,int bo); enum EST_write_status save_raw_data(FILE *fp, const short *data, int offset, int num_samples, int num_channels, enum EST_sample_type_t sample_type, int bo); enum EST_write_status save_raw_data_nc(FILE *fp, const short *data, int offset, int num_samples, int num_channels, enum EST_sample_type_t sample_type, int bo); #endif /* __EST_WAVE_UTILS_H__ */ speech_tools/speech_class/EST_TrackFile.h0000644000076400007640000001637710570320134017056 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri Nov 14 1997 */ /* -------------------------------------------------------------------- */ /* Track file formats known to the speech tools. */ /* */ /*************************************************************************/ #ifndef __EST_TRACKFILE_H__ #define __EST_TRACKFILE_H__ #include "EST_Token.h" #include "EST_TNamedEnum.h" #include "EST_String.h" #include "EST_rw_status.h" #include "htk.h" #include "ssff.h" class EST_TrackFile { public: // We have to use #defines for what should be done with just // typedefs because Sun CC thinks you shouldn't be allowed to // declare a member function via a typedef. #define LoadTrackFileArgs const EST_String filename, \ EST_Track &tr, float ishift, float startt #define SaveTrackFileArgs const EST_String filename, EST_Track tr #define LoadTrack_TokenStreamArgs EST_TokenStream &ts, \ EST_Track &tr, float ishift, float startt #define SaveTrac_TokenStreamArgs FILE *fp, EST_Track tr typedef EST_read_status Load_File(LoadTrackFileArgs); typedef EST_write_status Save_File(SaveTrackFileArgs); typedef EST_read_status Load_TokenStream(LoadTrack_TokenStreamArgs); typedef EST_write_status Save_TokenStream(SaveTrac_TokenStreamArgs); typedef struct Info { bool recognise; Load_File *load; Save_File *save; const char *description; } Info; typedef struct TS_Info { bool recognise; Load_TokenStream *load; Save_TokenStream *save; const char *description; } TS_Info; static EST_write_status save_ascii(SaveTrackFileArgs); static EST_read_status load_ascii(LoadTrackFileArgs); static EST_write_status save_esps(SaveTrackFileArgs); static EST_read_status load_esps(LoadTrackFileArgs); static EST_write_status save_est_ts(SaveTrac_TokenStreamArgs); static EST_read_status load_est_ts(LoadTrack_TokenStreamArgs); static EST_write_status save_est(SaveTrackFileArgs); static EST_read_status load_est(LoadTrackFileArgs); static EST_write_status save_est_binary(SaveTrackFileArgs); static EST_write_status save_est_binary_ts(SaveTrac_TokenStreamArgs); static EST_write_status save_est_ascii(SaveTrackFileArgs); static EST_read_status load_est_ascii(LoadTrackFileArgs); static EST_write_status save_htk(SaveTrackFileArgs); static EST_read_status load_htk(LoadTrackFileArgs); static EST_write_status save_htk_fbank(SaveTrackFileArgs); static EST_read_status load_htk_fbank(LoadTrackFileArgs); static EST_write_status save_htk_mfcc_e(SaveTrackFileArgs); static EST_write_status save_htk_mfcc(SaveTrackFileArgs); static EST_read_status load_htk_mfcc(LoadTrackFileArgs); static EST_write_status save_htk_user(SaveTrackFileArgs); static EST_read_status load_htk_user(LoadTrackFileArgs); static EST_write_status save_htk_discrete(SaveTrackFileArgs); static EST_read_status load_htk_discrete(LoadTrackFileArgs); static EST_write_status save_xmg(SaveTrackFileArgs); static EST_read_status load_xmg(LoadTrackFileArgs); static EST_write_status save_xgraph(SaveTrackFileArgs); static EST_read_status load_xgraph(LoadTrackFileArgs); static EST_write_status save_ema(SaveTrackFileArgs); static EST_read_status load_ema(LoadTrackFileArgs); static EST_write_status save_ema_swapped(SaveTrackFileArgs); static EST_read_status load_ema_swapped(LoadTrackFileArgs); static EST_write_status save_NIST(SaveTrackFileArgs); static EST_read_status load_NIST(LoadTrackFileArgs); static EST_write_status save_ssff_ts(SaveTrac_TokenStreamArgs); static EST_read_status load_ssff_ts(LoadTrack_TokenStreamArgs); static EST_write_status save_ssff(SaveTrackFileArgs); static EST_read_status load_ssff(LoadTrackFileArgs); static EST_TNamedEnumI map; static EST_TNamedEnumI ts_map; static EST_String options_supported(void); static EST_String options_short(void); }; int track_to_espsf0(EST_Track &track, EST_Track &fz); int espsf0_to_track(EST_Track &fz); int track_to_htk_lpc(EST_Track &track, EST_Track &lpc); EST_write_status put_esps(const char *filename, const char *style, float *t, float *a, int *v, float fsize, float rate, int num_points); enum EST_write_status put_track_esps(const char *filename, char **f_names, float **a, float fsize, float rate, int order, int num_points, short fixed); EST_read_status get_esps(const char *filename, const char *style, float **t, float **a, int **v, float *fsize, int *num_points); EST_read_status get_track_esps(const char *filename, char ***fields, float ***a, float *fsize, int *num_points, int *num_fields, short *fixed); #endif speech_tools/speech_class/EST_WaveFile.h0000644000076400007640000001275007262605664016725 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Wave file formats known to the speech tools. */ /* */ /*************************************************************************/ #ifndef __EST_WAVEFILE_H__ #define __EST_WAVEFILE_H__ #include "EST_TNamedEnum.h" #include "EST_String.h" #include "EST_Token.h" #include "EST_rw_status.h" #include "EST_Wave.h" #include "EST_wave_aux.h" typedef enum EST_WaveFileType{ wff_none, wff_nist, wff_esps, wff_est, wff_audlab, wff_snd, wff_aiff, wff_riff, wff_raw, wff_ulaw } EST_WaveFileType; class EST_WaveFile { public: // We have to use #defines for what should be done with just // typedefs because Sun CC thinks you shouldn't be allowed to // declare a member function via a typedef. #define LoadWaveFileArgs const EST_String filename, \ EST_Wave &wv, \ int rate, EST_sample_type_t stype, \ int bo, int nc, \ int offset, int length #define SaveWaveFileArgs const EST_String filename, \ const EST_Wave &wv, \ EST_sample_type_t stype, int bo #define LoadWave_TokenStreamArgs EST_TokenStream &ts, \ EST_Wave &wv, \ int rate, EST_sample_type_t stype, \ int bo, int nc, \ int offset, int length #define SaveWave_TokenStreamArgs FILE *fp, \ const EST_Wave &wv, \ EST_sample_type_t stype, int bo typedef EST_read_status Load_TokenStream(LoadWave_TokenStreamArgs); typedef EST_write_status Save_TokenStream(SaveWave_TokenStreamArgs); typedef struct Info { bool recognise; Load_TokenStream *load; Save_TokenStream *save; const char *description; } Info; static EST_write_status save_nist(SaveWave_TokenStreamArgs); static EST_read_status load_nist(LoadWave_TokenStreamArgs); static EST_write_status save_est(SaveWave_TokenStreamArgs); static EST_read_status load_est(LoadWave_TokenStreamArgs); static EST_write_status save_esps(SaveWave_TokenStreamArgs); static EST_read_status load_esps(LoadWave_TokenStreamArgs); static EST_write_status save_audlab(SaveWave_TokenStreamArgs); static EST_read_status load_audlab(LoadWave_TokenStreamArgs); static EST_write_status save_snd(SaveWave_TokenStreamArgs); static EST_read_status load_snd(LoadWave_TokenStreamArgs); static EST_write_status save_aiff(SaveWave_TokenStreamArgs); static EST_read_status load_aiff(LoadWave_TokenStreamArgs); static EST_write_status save_riff(SaveWave_TokenStreamArgs); static EST_read_status load_riff(LoadWave_TokenStreamArgs); static EST_write_status save_raw(SaveWave_TokenStreamArgs); static EST_read_status load_raw(LoadWave_TokenStreamArgs); static EST_write_status save_ulaw(SaveWave_TokenStreamArgs); static EST_read_status load_ulaw(LoadWave_TokenStreamArgs); static EST_TNamedEnumI map; static EST_String options_supported(void); static EST_String options_short(void); }; #endif speech_tools/speech_class/ssff.h0000644000076400007640000000572507262605664015455 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1999 */ /*-----------------------------------------------------------------------*/ /* Version of code for reading and writing Macquarie's SSFF format as */ /* used in emulabel */ /* */ /*=======================================================================*/ #ifndef __SSFF_H__ #define __SSFF_H__ #endif /* __SSFF_H__ */ speech_tools/speech_class/Makefile0000644000076400007640000000636507262605664016004 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Speech Class Makefile ## ## ## ##=======================================================================## TOP=.. DIRNAME=speech_class LOCAL_DEFAULT_LIBRARY = estbase H = htk.h esps_utils.h waveP.h EST_wave_utils.h \ EST_TrackFile.h EST_WaveFile.h ssff.h TSRCS = EST_TrackMap.cc EST_Track.cc \ wave_t.cc track_t.cc EST_wave_aux.cc \ EST_TrackFile.cc EST_WaveFile.cc CPPSRCS = EST_Wave.cc EST_track_aux.cc \ EST_wave_temp.cc EST_wave_cuts.cc ssff.cc \ esps_io.cc esps_utils.cc EST_wave_io.cc EST_wave_utils.cc \ $(TSRCS) # EST_wave_stream.cc SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) $(H) Makefile SHAREABLE_OBJECTS = $(OBJS) ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/sigpr/EST_Window.cc0000644000076400007640000003122210127000720015263 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King (taken from Tony Robinson) */ /* Date : July 1994 */ /*-----------------------------------------------------------------------*/ /* windowing functions */ /* */ /*=======================================================================*/ #include #include #include "EST_system.h" //#include "EST_sigpr.h" #include "sigpr/EST_Window.h" #include "EST_TNamedEnum.h" #include "EST_math.h" static inline int irint(float f) { return (int)(f+0.5); } static inline int irint(double f) { return (int)(f+0.5); } static inline int min(int a, int b) { return (ab)?a:b; } /*************************************************************************/ /* */ /* The actual window functions are defined here. */ /* */ /*************************************************************************/ static void Rectangular(int size, EST_TBuffer &r_window, int window_centre=-1) { // this may be a little silly (void) window_centre; // not useful for rectangular window r_window.ensure(size); for( int i=0; i &r_window, int window_centre=-1) { int i, c, end=size-1; r_window.ensure(size); if( window_centre < 0 ) { // symmetric window (default) c=size/2; const float k = 2.0 / (float)size; if( (size & 1) != 0 ) // odd r_window[c]=1.0; for( i=0; i &r_window, int window_centre=-1) { int i,c; float k; r_window.ensure(size); int end = size-1; if( window_centre < 0 ){ // symmetric window (default) c = size/2; // only need to calculate one half + copy if( (size & 1) != 0) // when odd r_window[c]=1.0; k = 2.0 * M_PI / size; for( i=0; i &r_window, int window_centre=-1) { float k; int i, c, end=size-1; r_window.ensure(size); if( window_centre < 0 ){ // symmetric window (default) c=size/2; k = 2.0 * M_PI / size; if( (size & 1) != 0) // odd r_window[c]=1.0; for( i=0; i window_names[] = { { wf_none, { "none" }, {NULL, "unknown window type"}}, { wf_rectangle, {"rectangle", "rect", "rectangular"}, {Rectangular, "Rectangular window"}}, { wf_triangle, {"triangle", "tri", "triangular"}, {Triangular, "Triangular window"}}, { wf_hanning, {"hanning", "han"}, {Hanning, "Hanning window"}}, { wf_hamming, {"hamming", "ham"}, {Hamming, "Hamming window"}}, { wf_none, { NULL }}, }; static EST_TNamedEnumI map(window_names); EST_Window::Func *EST_Window::creator(const char *name, bool report_error) { EST_WindowType key = map.token(name); if (key == wf_none) { if (report_error) cerr << "no such window type %s" << name << endl; return NULL; } else return map.info(key).func; } EST_String EST_Window::description(const char *name) { EST_WindowType key = map.token(name); return map.info(key).description; } /** Return the dc offset for a section of speech. * This can safely go off the limits of the waveform. */ static float find_dc(const EST_Wave &sig, int start, int size) { int i; double sum = 0; start = max(0, start); size = min(size, sig.num_samples()-start); for(i=0; i &window_vals, int size, const char *name, int window_centre ) { EST_WindowFunc *make_window = EST_Window::creator(name); window_vals.ensure(size, (bool)FALSE); make_window(size, window_vals, window_centre); } void EST_Window::make_window( EST_FVector &window_vals, int size, const char *name, int window_centre ) { EST_TBuffer fwindow; EST_WindowFunc *make_window = EST_Window::creator(name); fwindow.ensure(size, (bool)FALSE); make_window(size, fwindow, window_centre); window_vals.resize(size); for (int i = 0; i < size; ++i) window_vals[i] = fwindow[i]; } void EST_Window::window_signal(const EST_Wave &sig, EST_WindowFunc *make_window, int start, int size, EST_TBuffer &window) { EST_TBuffer window_vals(size); int i; float dc; // create the window shape make_window(size, window_vals,-1); window.ensure(size, (bool)FALSE); dc = find_dc(sig, start, size); /* There are three separate loops, one each for the beginning and ends, where virtual values off the end of the sig array are requested, and one for the majority of the processing which falls in the middle of the sig array.*/ for(i=0; i window_vals(size); // create the window shape make_window(size, window_vals,-1); window_signal(sig, window_vals, start, size, frame, resize); } void EST_Window::window_signal(const EST_Wave &sig, EST_TBuffer &window_vals, int start, int size, EST_FVector &frame, int resize) { int i; float dc; if (resize) frame.resize(size); else if (frame.length() < size) { cerr << "Frame is wrong size: expected " << size << " got " << frame.length() << endl; return; } /* cout << "window vals\n"; for (i = 0; i < size; ++i) cout << window_vals[i] << " "; cout << endl << endl; */ dc = find_dc(sig, start, size); // cout << "dc is " << dc << endl; /* There are three separate loops, one each for the beginning and ends, where virtual values off the end of the sig array are requested, and one for the majority of the processing which falls in the middle of the sig array.*/ for(i = 0; i < size && start+i< 0; i++) frame.a_no_check(i) = 0; for (; (i < size) && (start + i < sig.num_samples()); i++) frame.a_no_check(i) = (window_vals(i) * (sig.a_no_check(start + i) - dc) + dc); for(; i < frame.length(); i++) frame.a_no_check(i) = 0; /* cout << "sig vals\n"; for (i = 0; i < size; ++i) cout << sig.a(i + start) << " "; cout << "frame vals\n"; for (i = 0; i < size; ++i) cout << frame[i] << " "; cout << endl << endl; */ } EST_String EST_Window::options_supported(void) { EST_String s; for(int n=0; n< map.n() ; n++) { const char *nm = map.name(map.token(n)); const char *d = map.info(map.token(n)).description; s += EST_String::cat(" ", nm, EST_String(" ")*(12-strlen(nm)), d, "\n"); } return s; } EST_String EST_Window::options_short(void) { EST_String s(""); for(int n=0; n< map.n() ; n++) { const char *nm = map.name(map.token(n)); if (s != "") s += ", "; s += nm; } return s; } #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" template class EST_TNamedEnumI; template class EST_TValuedEnumI; #endif speech_tools/sigpr/delta.cc0000644000076400007640000001466310127000720014404 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Compute delta coefficients for */ /* Tracks and Tracks */ /* */ /*=======================================================================*/ #include #include "EST_Track.h" #include "EST_Wave.h" # define MAX_DELTA_ORDER 2 /// max. number of points on which the delta co-eff is based # define MAX_REGRESSION_LENGTH 4 static float compute_gradient(const EST_FVector &x, int num_points); void delta(EST_Track &tr, EST_Track &d, int regression_length) { int reg_index, this_index; // need at least two points to compute gradient if ((regression_length < 2)||(regression_length > MAX_REGRESSION_LENGTH)){ cerr << "delta(EST_Track&, int) : ERROR : regression_length is " << regression_length << endl; exit(0); } // temp stores the points passed to compute_gradient EST_FVector temp(regression_length); for (int j = 0; j < tr.num_channels(); j++ ) for (int i = 0; i < tr.num_frames(); i++) { // copy values needed to compute gradient into temp[] for (reg_index=0; reg_index= 0) temp[reg_index] = tr.a(this_index, j); } // gradient at frame 0 is defined as 0 if (i < 1) d.a(i, j) = 0.0; else if (i < regression_length - 1) // enough data, but would prefer more // number of points available is only i+1 d.a(i, j) = compute_gradient(temp, i + 1); else // plenty of data, use the last regression_length points d.a(i, j) = compute_gradient(temp, regression_length); } } void delta(EST_Wave &tr, EST_Wave &d, int regression_length) { int reg_index, this_index; // need at least two points to compute gradient if ((regression_length < 2)||(regression_length > MAX_REGRESSION_LENGTH)){ cerr << "delta(EST_Track&, int) : ERROR : regression_length is " << regression_length << endl; exit(0); } // temp stores the points passed to compute_gradient EST_FVector temp(regression_length); for (int j = 0; j < tr.num_channels(); j++ ) for (int i = 0; i < tr.num_samples(); i++) { // copy values needed to compute gradient into temp[] for (reg_index=0; reg_index= 0) temp.a_no_check(reg_index) = (float)tr.a(this_index, j); } // gradient at frame 0 is defined as 0 if (i < 1) d.a(i, j) = 0; else if (i < regression_length - 1) // enough data, but would prefer more // number of points available is only i+1 d.a(i, j) = (short)compute_gradient(temp, i + 1); else // plenty of data, use the last regression_length points d.a(i, j) = (short)compute_gradient(temp, regression_length); } } static float compute_gradient(const EST_FVector &x, int num_points) { float gradient; // NB x[0] is the point LATEST in time // so x[1] is really x[t-1] // time between points is assumed to be one unit // These are solutions to least-squares fit of straight line // to num_points points. switch (num_points){ case 1: gradient = 0.0; break; case 2: gradient = x(0) - x(1); break; case 3: gradient = (x(0) -x(2)) / 2.0; break; case 4: gradient = ( (3.0*x(0)) + x(1) - x(2) - (3.0 * x(3)) ) / 10.0; break; default: cerr << "compute_gradient(float*, int) : ERROR : num_points is" << num_points << endl; exit(0); break; } return gradient; } speech_tools/sigpr/filter.cc0000644000076400007640000004221310127000720014570 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : October 1996 */ /*-----------------------------------------------------------------------*/ /* Filter functions */ /* */ /*=======================================================================*/ #include #include "EST_math.h" #include "sigpr/EST_filter.h" #include "sigpr/EST_fft.h" #include "EST_wave_aux.h" #include "EST_TBuffer.h" #include "sigpr/EST_Window.h" #include "EST_error.h" // there are multiple possible styles of this because of different // possibilities of where to change the filter coefficients. void lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res) { int i, j; double s; for (i = 0; i < sig.num_samples(); ++i) { s = 0; for (j = 1; j < a.n(); ++j) s += a(j) * (float)sig.a_safe(i - j); sig.a(i) = (short) s + res.a(i); } } void inv_lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res) { int i, j; double r; for (i = 0; i < a.n(); ++i) { r = sig.a_no_check(i); for (j = 1; j < a.n(); ++j) r -= a.a_no_check(j) * (float)sig.a_safe(i - j); res.a(i) = (short) r; } for (i = a.n(); i < sig.num_samples(); ++i) { r = sig.a_no_check(i); for (j = 1; j < a.n(); ++j) r -= a.a_no_check(j) * (float)sig.a_no_check(i - j); res.a(i) = (short) r; } } /*void filter(EST_FVector &in, EST_FVector &out, EST_FVector &filter) { double r; for (int i = 0; i < in.length(); ++i) { r = in.a(i); for (int j = 1; j < filter.length(); ++j) r -= filter(j) * in.a(i - j); out[i] = r; } } */ void inv_lpc_filter_ola(EST_Wave &in_sig, EST_Track &lpc, EST_Wave &out_sig) { int i, j, k, start, end, size; EST_FVector filter; EST_FVector window_vals; EST_Wave in_sub, out_sub; // copy attributes and size to waveform, fill with zeros. out_sig.resize(in_sig.num_samples(), 1); out_sig.set_sample_rate(in_sig.sample_rate()); out_sig.fill(0); for(i = 1; i < lpc.num_frames() - 1; ++i) { start = (int)((float)lpc.t(i - 1) * in_sig.sample_rate()); end = (int)((float)lpc.t(i + 1) * in_sig.sample_rate()); if (end > out_sig.num_samples()) end = out_sig.num_samples(); size = end - start; lpc.frame(filter, i); if (size < filter.n()) break; // basically a mismatch between lpc and waveform in_sig.sub_wave(in_sub, start, size); out_sub.resize(size); inv_lpc_filter(in_sub, filter, out_sub); int centreIndex = (int)(lpc.t(i) * (float)in_sig.sample_rate()); EST_Window::make_window(window_vals, size, "hanning", centreIndex-start); // printf( "%d %d %d (start centre end)\n", start, centreIndex, end ); // overlap and add using hanning window on original for (k = 0, j = start; j < end; ++j, ++k){ out_sig.a_no_check(j) += (int)((float)out_sub.a_no_check(k) * window_vals.a_no_check(k)); } } } void lpc_filter_1(EST_Track &lpc, EST_Wave & res, EST_Wave &sig) { int i, j, k; int start, end; EST_FVector filter; float s; // int order = lpc.num_channels() - 1; // EST_Wave sig_sub, res_sub; sig.resize(res.num_samples()); sig.set_sample_rate(res.sample_rate()); sig.fill(0); for (start = 0, i = 0; i < lpc.num_frames() - 1; ++i) { end = int((lpc.t(i) + lpc.t(i + 1)) * (float)res.sample_rate()) / 2; if (end > res.num_samples()) end = res.num_samples(); lpc.frame(filter, i); // res.sub_wave(res_sub, start, (end - start)); // sig.sub_wave(sig_sub, start, (end - start)); // this should really be done by the lpc_frame filter function // but it needs access to samples off the start of the frame // in question. if (start < filter.n()) for (k = start; k < end; ++k) { for (s = 0,j = 1; j < filter.n(); ++j) s += filter.a_no_check(j) * (float)sig.a_safe(k - j); sig.a_no_check(k) = (short) s + res.a_no_check(k); } else for (k = start; k < end; ++k) { s = 0; for (j = 1; j < filter.n(); ++j) s += filter.a_no_check(j) * (float)sig.a_no_check(k - j); sig.a_no_check(k) = (short) s + res.a_no_check(k); } start = end; } } void lpc_filter_fast(EST_Track &lpc, EST_Wave & res, EST_Wave &sig) { // An (unfortunately) faster version of the above. This is about // three time faster than the above. Improvements would need to be // done of signal access to make the above compete. // Note the rescaling of the residual is packaged within here too int i, j, k, m, n; int start, end; float s; int order = lpc.num_channels() - 1; if (order < 0) order = 0; // when lpc as no frames float *buff = walloc(float,res.num_samples()+order); float *filt = walloc(float,order+1); short *residual = res.values().memory(); sig.resize(res.num_samples(),1,0); // no reseting of values sig.set_sample_rate(res.sample_rate()); for (k=0; k res.num_samples()) end = res.num_samples(); for (j=1; j maxval) // maxval = absval(fddata[i]); } } void pre_emphasis(EST_Wave &sig, float a) { float x = 0.0; float x_1 = 0.0; for (int j = 0; j < sig.num_channels(); ++j) for (int i = 0; i < sig.num_samples(); i++) { x = sig.a_no_check(i, j); sig.a_no_check(i, j) = sig.a_no_check(i, j) - int(a * x_1); x_1 = x; } } void pre_emphasis(EST_Wave &sig, EST_Wave &out, float a) { out.resize(sig.num_samples(), sig.num_channels()); for (int j = 0; j < sig.num_channels(); ++j) { out.a_no_check(0, j) = sig.a_no_check(0, j); for (int i = 1; i < sig.num_samples(); i++) out.a_no_check(i, j) = sig.a_no_check(i, j) - int(a * (float)sig.a_no_check(i-1, j)); } } void post_emphasis(EST_Wave &sig, EST_Wave &out, float a) { out.resize(sig.num_samples(), sig.num_channels()); for (int j = 0; j < sig.num_channels(); ++j) { out.a_no_check(0, j) = sig.a_no_check(0, j); for (int i = 1; i < sig.num_samples(); i++) out.a_no_check(i, j) = sig.a_no_check(i, j) + int(a * (float)sig.a_no_check(i-1, j)); } } void simple_mean_smooth(EST_Wave &c, int n) { // simple mean smoother of order n int i, j, h, k=1; float *a = new float[c.num_samples()]; float sum; h = n/2; for (i = 0; (i < h); ++i) { k = (i * 2) + 1; sum = 0.0; for (j = 0; (j < k) && (k < c.num_samples()); ++j) sum += c.a_no_check(j); a[i] = sum /(float) k; } for (i = h; i < c.num_samples() - h; ++i) { sum = 0.0; for (j = 0; j < n; ++j) sum += c.a_no_check(i - h + j); a[i] = sum /(float) k; } for (; i < c.num_samples(); ++i) { k = ((c.num_samples() - i)* 2) -1; sum = 0.0; for (j = 0; j < k; ++j) sum += c.a_no_check(i - (k/2) + j); a[i] = sum /(float) k; } for (i = 0; i < c.num_samples(); ++i) c.a_no_check(i) = (short)(a[i] + 0.5); delete [] a; } void FIRfilter(EST_Wave &in_sig, const EST_FVector &numerator, int delay_correction) { EST_Wave out_sig; out_sig.resize(in_sig.num_samples()); out_sig.set_sample_rate(in_sig.sample_rate()); out_sig.set_file_type(in_sig.file_type()); FIRfilter(in_sig, out_sig, numerator, delay_correction); in_sig = out_sig; } void FIRfilter(const EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator, int delay_correction) { if (delay_correction < 0) EST_error("Can't have negative delay !\n"); if (numerator.n() <= 0) EST_error("Can't filter EST_Wave with given filter"); int i,j,n=in_sig.num_samples(); out_sig.resize(n); // could speed up here with three loops : // 1 for first part (filter overlaps start of wave, one 'if') // 2 for middle part (filter always within wave, no 'if's) // 3 for last part (filter overlaps end of wave, one 'if') // To make this faster do the float conversion once and hold it // in a conventional array. Note this has been checked to be // safe but if you change the code below you'll have to confirm it // remains safe. If access through FVector was fast I'd use them // but this is about twice as fast. float *in = walloc(float,n); for (i=0; i < n; ++i) in[i] = (float)in_sig.a_no_check(i); float *numer = walloc(float,numerator.n()); for (i=0; i < numerator.n(); ++i) numer[i] = numerator.a_no_check(i); float *out = walloc(float,n); for (i = 0; i < n; ++i) { out[i] = 0; int jlow=0; int jhigh=numerator.n(); if(i+delay_correction >= n) jlow = i + delay_correction - n + 1; if(i+delay_correction - jhigh < 0) jhigh = i + delay_correction; for(j=jlow; j= 0) && ((i+delay_correction - j) < n)) out[i] += in[i+delay_correction - j] * numer[j]; } for (i=0; i ALMOST1) logarea[i] = log((1.0 - ALMOST1) / (1.0 + ALMOST1)); else if (ref(i) < -ALMOST1) logarea[i] = log((1.0 + ALMOST1)/(1.0 - ALMOST1)); else logarea[i] = log((1.0 - ref(i)) / (1.0 + ref(i))); } } void ref2truearea(const EST_FVector &ref, EST_FVector &area) { int order = ref.length() -1; area[1] = (1.0 - ref(1)) / (1.0 + ref(1)); for(int i = 2; i <= order; i++) area[i] = area[i - 1] * (1.0 - ref(i)) / (1.0 + ref(i)); } void lpc2cep(const EST_FVector &lpc, EST_FVector &cep) { int n, k; float sum; int order = lpc.length() - 1; for (n = 1; n <= order && n <= cep.length(); n++) { sum = 0.0; for (k = 1; k < n; k++) sum += k * cep(k-1) * lpc(n - k); cep[n-1] = lpc(n) + sum / n; } /* be wary of these interpolated values */ for(n = order + 1; n <= cep.length(); n++) { sum = 0.0; for (k = n - (order - 1); k < n; k++) sum += k * cep(k-1) * lpc(n - k); cep[n-1] = sum / n; } /* very occasionally the above can go unstable, fudge if this happens */ for (n = 0; n < cep.length(); n++) { // check if NaN -- happens on some frames of silence if (isnanf(cep[n]) ) cep[n] = 0.0; if (cep[n] > MAX_ABS_CEPS){ cerr << "WARNING : cepstral coeff " << n << " was " << cep[n] << endl; cerr << "lpc coeff " << n << " = " << lpc(n + 1) << endl; cep[n] = MAX_ABS_CEPS; } if (cep[n] < -MAX_ABS_CEPS) { cerr << "WARNING : cepstral coeff " << n << " was " << cep[n] << endl; cep[n] = -MAX_ABS_CEPS; } } } // REORG - test this!! void lpc2ref(const EST_FVector &lpc, EST_FVector &ref) { // seem to get weird output from this - best not to use it ! EST_error("lpc2ref Code unfinished\n"); // LPC to reflection coefficients // from code from Borja Etxebarria // This code does clever things with pointer and so has been // left using float * arrays. // simonk (May 99) : fixed because lpc coeffs always have energy at // coeff 0 - the code here would need changing is lpc coeff 0 was // ever made optional. int lpc_offset=1; int order = lpc.length() - 1; int i,j; float f,ai; float *vo,*vx; float *vn = new float[order]; i = order - 1; ref[i] = lpc(i+lpc_offset); ai = lpc(i+lpc_offset); f = 1-ai*ai; i--; for (j=0; j<=i; j++) ref[j] = (lpc(j+lpc_offset)+((ai*lpc(i-j+lpc_offset))))/f; /* vn=vtmp in previous #define */ // Check whether this should really be a pointer vo = new float[order]; for (i = 0; i < order; ++i) vo[i] = ref(i); for ( ;i>0; ) { ai=vo[i]; f = 1-ai*ai; i--; for (j=0; j<=i; j++) vn[j] = (vo[j]+((ai*vo[i-j])))/f; ref[i]=vn[i]; vx = vn; vn = vo; vo = vx; } delete [] vn; } void ref2lpc(const EST_FVector &ref, EST_FVector &lpc) { // Here we use Christopher Longet Higgin's algorithm converted to // an equivalent by awb. It doesn't have the reverse order or // negation requirement. int order = ref.length() - 1; float a, b; int n, k; for (n=0; n < order; n++) { lpc[n] = ref(n); for (k=0; 2 * (k+1) <= n + 1; k++) { a = lpc[k]; b = lpc[n-(k + 1)]; lpc[k] = a-b * lpc[n]; lpc[n-(k+1)] = b-a * lpc[n]; } } } /************************************************************ ** LPC_TO_LSF - ** pass the LENGTH of the LPC vector - this is the LPC ** order plus 1. Must pre-allocate lsfs to length+1 ************************************************************/ void lpc2lsf(const EST_FVector &lpc, EST_FVector &lsf) { (void) lpc; (void) lsf; EST_error("LSF Code unfinished\n"); } void lsf2lpc(const EST_FVector &lpc, EST_FVector &lsf) { (void) lpc; (void) lsf; EST_error("LSF Code unfinished\n"); } void sig2lpc(const EST_FVector &sig, EST_FVector &acf, EST_FVector &ref, EST_FVector &lpc) { int i, j; float e, ci, sum; int order = lpc.length() -1; EST_FVector tmp(order); int stableorder=-1; if ((acf.length() != ref.length()) || (acf.length() != lpc.length())) EST_error("sig2lpc: acf, ref are not of lpc's order"); //cerr << "sig2lpc order " << order << endl; for (i = 0; i <= order; i++) { sum = 0.0; for(j = 0; j < sig.length() - i; j++) sum += sig.a_no_check(j) * sig.a_no_check(j + i); acf.a_no_check(i) = sum; } // find lpc coefficients e = acf.a_no_check(0); lpc.a_no_check(0) = 1.0; for (i = 1; i <= order; i++) { ci = 0.0; for(j = 1; j < i; j++) ci += lpc.a_no_check(j) * acf.a_no_check(i-j); if (e == 0) ref.a_no_check(i) = ci = 0.0; else ref.a_no_check(i) = ci = (acf.a_no_check(i) - ci) / e; //Check stability of the recursion if (absval(ci) < 1.000000) { lpc.a_no_check(i) = ci; for (j = 1; j < i; j++) tmp.a_no_check(j) = lpc.a_no_check(j) - (ci * lpc.a_no_check(i-j)); for( j = 1; j < i; j++) lpc.a_no_check(j) = tmp.a_no_check(j); e = (1 - ci * ci) * e; stableorder = i; } else break; } if (stableorder != order) { fprintf(stderr, "warning:levinson instability, order restricted to %d\n", stableorder); for (; i <= order; i++) lpc.a_no_check(i) = 0.0; } // normalisation for frame length lpc.a_no_check(0) = e / sig.length(); } void sig2pow(EST_FVector &frame, float &power) { power = 0.0; for (int i = 0; i < frame.length(); i++) power += pow(frame(i), float(2.0)); power /= frame.length(); } void sig2rms(EST_FVector &frame, float &rms_energy) { sig2pow(frame, rms_energy); rms_energy = sqrt(rms_energy); } float lpredict2(EST_FVector &adc, int wsize, EST_FVector &acf, float *ref, float *lpc, int order) { int i, j; float e, ci, sum; EST_TBuffer tmp(order); int stableorder=-1; EST_FVector vref(order + 1), vlpc(order + 1); for (i = 0; i <= order; i++) { sum = 0.0; for (j = 0; j < wsize - i; j++) sum += adc[j] * adc[j + i]; acf[i] = sum; } /* find lpc coefficients */ e = acf[0]; lpc[0] = 1.0; for(i = 1; i <= order; i++) { ci = 0.0; for(j = 1; j < i; j++) ci += lpc[j] * acf[i-j]; ref[i] = ci = (acf[i] - ci) / e; //Check stability of the recursion if (absval(ci) < 1.000000) { lpc[i] = ci; for(j = 1; j < i; j++) tmp[j] = lpc[j] - ci * lpc[i-j]; for(j = 1; j < i; j++) lpc[j] = tmp[j]; e = (1 - ci * ci) * e; stableorder = i; } else break; } if (stableorder != order) { fprintf(stderr, "warning:levinson instability, order restricted to %d\n", stableorder); for (;i<=order;i++) lpc[i]=0.0; } return(e); } void sig2fbank(const EST_FVector &sig, EST_FVector &fbank_frame, const float sample_rate, const bool use_power_rather_than_energy, const bool take_log) { EST_FVector fft_frame; int i,fbank_order; float Hz_per_fft_coeff; // upper and lower limits of filter bank // where the upper limit depends on the sampling frequency // TO DO : add low/high pass filtering HERE float mel_low=0; float mel_high=Hz2Mel(sample_rate / 2); // FFT this frame. FFT order will be computed by sig2fft // FFT frame returned will be half length of actual FFT performed sig2fft(sig,fft_frame,use_power_rather_than_energy); // this is more easily understood as half the sampling // frequency over half the fft order, but fft_frame_length() // is already halved Hz_per_fft_coeff = 0.5 * sample_rate / fft_frame.length(); fbank_order = fbank_frame.length(); // store the list of centre frequencies and lower and upper bounds of // the triangular filters EST_FVector mel_fbank_centre_frequencies(fbank_order+2); mel_fbank_centre_frequencies[0]=mel_low; for(i=1;i<=fbank_order;i++) mel_fbank_centre_frequencies[i] = mel_low + (float)(i) * (mel_high - mel_low) / (fbank_order+1); mel_fbank_centre_frequencies[fbank_order+1]=mel_high; // bin FFT in Mel filters fft2fbank(fft_frame, fbank_frame, Hz_per_fft_coeff, mel_fbank_centre_frequencies); if(take_log) for(i=0;i fft_order) fft_order *= 2; fft_vec = sig; // pad with zeros fft_vec.resize(fft_order); // in place FFT (void)fastFFT(fft_vec); // of course, we only need the lower half of the fft half_fft_order = fft_order/2; for(i=0;i half_fft_order-1) fft_index_stop = half_fft_order-1; filter_vector_length = fft_index_stop - fft_index_start + 1; filter.resize(filter_vector_length); for(i=0;inext()) { t = types(s); if (op.present(t + "_order")) { int actual_order = op.I(t + "_order"); if(actual_order < 1) { cerr << "Invalid " << t << "_order" << " : "; cerr << actual_order; cerr << " (using 1 instead) " << endl; actual_order = 1; } int lowest_coef=0,highest_coef=actual_order-1; if(t == "lpc") // For lpc coefficients, we ALWAYS include energy as the // 0th coefficient, so when the users gives lpc_order of // 16, we produce 17 coefficients (0 to 16) highest_coef=actual_order; if(t == "melcep") { // Mel cepstra have special names - if we are not // including c0, then the coefficients are numbered // 1...order, and NOT 0...order-1 highest_coef=actual_order; if(op.present("include_c0")) lowest_coef = 0; else lowest_coef = 1; } if(actual_order == 1) map.append(t + dos); else map.append("$" + t + dos + "-"+itoString(lowest_coef)+"+"+itoString(highest_coef)); } else map.append(t + dos); } } void sigpr_base(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist) { EST_Track fill, tmp; EST_String b_name; EST_String k; float frame_factor; EST_WindowFunc *wf; int fbank_order; float liftering_parameter=0; bool use_power_rather_than_energy=false, take_logs=true, include_c0=false; parse_op_settings(op, wf, frame_factor); for (EST_Litem *s = slist.head(); s; s = s->next()) { k = slist(s); EST_String start_channel="0"; if( (slist(s) == "melcep") && !op.present("include_c0")) start_channel = "1"; if (fv.has_channel(k)) fv.sub_track(fill, 0, EST_ALL, k , 1); else fv.sub_track(fill, 0, EST_ALL, k + "_" + start_channel, k + "_N"); if(op.present("usepower")) cerr << "USING POWER" << endl; if ((slist(s) == "lpc") || (slist(s) == "cep") ||(slist(s) == "ref") || (slist(s) == "lsf")) sig2coef(sig, fill, slist(s), frame_factor, wf); else if (slist(s) == "power") power(sig, fill, frame_factor); else if (slist(s) == "energy") energy(sig, fill, frame_factor); else if (slist(s) == "f0") { op.set("srpd_resize", 0); op.set("pda_frame_shift", op.F("frame_shift")); pda(sig, fill, op, "srpd"); } // else if (slist(s) == "rasta") // rasta(sig, fill, op); else if (slist(s) == "fbank") { use_power_rather_than_energy = op.present("usepower"); fbank(sig, fill, frame_factor, wf, use_power_rather_than_energy, take_logs); } else if (slist(s) == "melcep") { fbank_order=op.I("fbank_order"); use_power_rather_than_energy = op.present("usepower"); include_c0=op.present("include_c0"); if(op.present("lifter")) liftering_parameter=op.F("lifter"); //cerr << "calling melcep " << fill.num_channels() << endl; melcep(sig, fill, frame_factor, fbank_order, liftering_parameter, wf, include_c0, use_power_rather_than_energy); } else EST_error("Error: Unnknown type of processing requested: %s\n", ((const char*) slist(s))); } } void sigpr_delta(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_String &k) { EST_Track base, fill; // cout << "type: " << k << endl; // look to see if base coefficients already exist EST_String start_channel="0"; if( (k == "melcep") && !op.present("include_c0")) start_channel = "1"; if (fv.has_channel(k)) fv.sub_track(base, 0, EST_ALL, k , 1); else if (fv.has_channel(k + "_" + start_channel)) fv.sub_track(base, 0, EST_ALL, k + "_" + start_channel, k + "_N"); else // otherwise make them in temporary track { // cout << "making tmp cpoefs\n"; EST_StrList tmp_base, tmp_map; tmp_base.append(k); add_channels_to_map(tmp_map, tmp_base, op, 0); base.resize(fv.num_frames(), tmp_map); base.fill_time(fv); base.set_equal_space(false); sigpr_base(sig, base, op, tmp_base); // cout << "BASE\n" << base; // cout <<"after\n"; } if (fv.has_channel(k + "_d")) fv.sub_track(fill, 0, EST_ALL, k+"_d", 1); else fv.sub_track(fill, 0, EST_ALL, k+"_d_" + start_channel, k+"_d_N"); /* cout << "base\n"; track_info(base); cout << "fill\n"; track_info(fill); */ delta(base, fill); } void sigpr_acc(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_String &k) { EST_Track base, fill; // cout << endl << endl << "acc\n"; // cout << "type: " << k << endl; // look to see if delta coefficients already exist EST_String start_channel="0"; if( (k == "melcep") && !op.present("include_c0")) start_channel = "1"; if (fv.has_channel(k+"_d")) fv.sub_track(base, 0, EST_ALL, k + "_d", 1); else if (fv.has_channel(k + "_d_" + start_channel)) fv.sub_track(base, 0, EST_ALL, k + "_d_" + start_channel, k + "_d_N"); else // otherwise make them in temporary track { EST_StrList tmp_base, tmp_map; tmp_base.append(k); add_channels_to_map(tmp_map, tmp_base, op, 1); base.resize(fv.num_frames(), tmp_map); base.fill_time(fv); base.set_equal_space(false); sigpr_delta(sig, base, op, tmp_base); } if (fv.has_channel(k + "_a")) fv.sub_track(fill, 0, EST_ALL, k+"_a", 1); else fv.sub_track(fill, 0, EST_ALL, k+"_a_" + start_channel, k+"_a_N"); // cout << "base\n"; // track_info(base); // cout << "fill\n"; // track_info(fill); delta(base, fill); } void sigpr_acc(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist) { for (EST_Litem *s = slist.head(); s; s = s->next()) sigpr_acc(sig, fv, op, slist(s)); } void sigpr_delta(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist) { for (EST_Litem *s = slist.head(); s; s = s->next()) sigpr_delta(sig, fv, op, slist(s)); } int get_frame_size(EST_Track &pms, int i, int sample_rate, int prefer_prev) { int prev = -1; int next = -1; if (i>0) prev = irint((pms.t(i) - pms.t(i-1))*sample_rate); if (i=0?prev:(next>=0?next:0); return next>=0?next:(prev>=0?prev:0); } float get_time_frame_size(EST_Track &pms, int i, int prefer_prev) { float prev = -1; float next = -1; if (i > 0) prev = pms.t(i) - pms.t(i-1); if (i < pms.num_frames() -1) next = pms.t(i+1) - pms.t(i); if (prefer_prev) return prev>=0 ? prev: (next>=0 ? next : 0.0); return next>=0 ? next: (prev>=0 ? prev : 0.0); } /*void sig2lpc(EST_Wave &sig, EST_Track &lpc, EST_WindowFunc *wf, float factor) { int order = lpc.num_channels() - 1; EST_FVector coefs(order + 1); int k; int window_start, window_size, length; // can be merged with window_size int sample_rate = sig.sample_rate(); EST_FVector frame; for (k = 0; k < lpc.num_frames(); ++k) { int pos = irint(lpc.t(k) * sample_rate); length = get_local_frame_size(lpc, k, sig.sample_rate()); window_size = irint(length * factor); window_start = pos - (window_size/2); EST_Window::window_signal(sig, wf, window_start, window_size, frame, 1); lpc.frame(coefs, k); sig2lpc(frame, coefs); } lpc.save("test.est", "est"); } */ /*typedef void EST_FrameFunc(const EST_FVector &in_frame, EST_FVector &out_frame); void sig2coef(EST_Wave &sig, EST_Track &lpc, EST_WindowFunc *wf, EST_FrameFunc *ff, float factor) { EST_FVector coefs, frame; int start, size; for (int k = 0; k < lpc.num_frames(); ++k) { size = irint(get_local_frame_size(lpc, k, sig.sample_rate())* factor); start = (irint(lpc.t(k) * sig.sample_rate()) - (size/2)); EST_Window::window_signal(sig, wf, start, size, frame, 1); lpc.frame(coefs, k); (*ff)(frame, coefs); } } */ void sig2coef(EST_Wave &sig, EST_Track &tr, EST_String type, float factor, EST_WindowFunc *wf) { EST_FVector coefs, frame; int start, size; // cout << "TYPE IS " << type << endl; for (int k = 0; k < tr.num_frames(); ++k) { if (factor < 0) // want fixed frame rate size = (int)(-1.0 * factor * (float)sig.sample_rate()); else size = irint(get_frame_size(tr, k, sig.sample_rate())* factor); start = (irint(tr.t(k) * sig.sample_rate()) - (size/2)); EST_Window::window_signal(sig, wf, start, size, frame, 1); tr.frame(coefs, k); frame_convert(frame, "sig", coefs, type); } } void power(EST_Wave &sig, EST_Track &pow, float factor) { EST_FVector frame; int window_start, window_size, pos, k; EST_WindowFunc *wf = EST_Window::creator("rectangular"); for (k = 0; k < pow.num_frames(); ++k) { pos = irint(pow.t(k) * sig.sample_rate()); if (factor < 0) // want fixed frame rate window_size = (int)(-1.0 * factor * (float)sig.sample_rate()); else window_size = irint(get_frame_size(pow, k, sig.sample_rate()) * factor); window_start = pos - window_size/2; EST_Window::window_signal(sig, wf, window_start, window_size,frame, 1); sig2pow(frame, pow.a(k)); } } void energy(EST_Wave &sig, EST_Track &pow, float factor) { EST_FVector frame; int window_start, window_size, pos, k; EST_WindowFunc *wf = EST_Window::creator("rectangular"); for (k = 0; k < pow.num_frames(); ++k) { pos = irint(pow.t(k) * sig.sample_rate()); if (factor < 0) // want fixed frame rate window_size = (int)(-1.0 * factor * (float)sig.sample_rate()); else window_size = irint(get_frame_size(pow, k, sig.sample_rate()) * factor); window_start = pos - window_size/2; EST_Window::window_signal(sig, wf, window_start, window_size,frame,1); sig2rms(frame, pow.a(k)); } } static EST_String determine_type(const EST_String &intype) { return (intype.contains("_") ? intype.before("_"): intype); } void convert_track(EST_Track &in_track, EST_Track &out_track, const EST_String &out_type, const EST_String &in_type) { if (in_track.num_frames() != out_track.num_frames()) EST_error("In track has %d frames, out track has %d\n", in_track.num_frames(), out_track.num_frames()); EST_String tmp; tmp = ((in_type == "") ? determine_type(in_track.channel_name(0)):in_type); EST_FVector in_frame(in_track.num_channels()); EST_FVector out_frame(out_track.num_channels()); for (int i = 0; i < in_track.num_frames(); ++i) { in_track.frame(in_frame, i); out_track.frame(out_frame, i); frame_convert(in_frame, tmp, out_frame, out_type); } } void fbank(EST_Wave &sig, EST_Track &fbank_track, const float factor, EST_WindowFunc *wf, const bool use_power_rather_than_energy, const bool take_log) { // still to add : high/low pass filtering int window_start, window_size, pos, k; EST_FVector frame,fbank_frame; // get_order(...) gives wrong answer ... Paul ? int fbank_order = fbank_track.num_channels(); // sanity check if(fbank_order < 1) { EST_error("Filterbank order of %i makes no sense.\n",fbank_order); return; } for (k = 0; k < fbank_track.num_frames(); ++k) { if (factor < 0) // want fixed frame rate window_size = (int)(-1.0 * factor * (float)sig.sample_rate()); else window_size = irint(get_frame_size(fbank_track, k, sig.sample_rate()) * factor); pos = irint(fbank_track.t(k) * sig.sample_rate()); window_start = pos - window_size/2; EST_Window::window_signal(sig, wf, window_start, window_size,frame, 1); fbank_track.frame(fbank_frame,k); sig2fbank(frame,fbank_frame,sig.sample_rate(), use_power_rather_than_energy,take_log); } } void melcep(EST_Wave &sig, EST_Track &mfcc_track, float factor, int fbank_order, float liftering_parameter, EST_WindowFunc *wf, const bool include_c0, const bool use_power_rather_than_energy) { EST_FVector frame,mfcc_frame,fbank_frame; int k; // first, do filterbank analysis // need a temporary track, with the same setup as mfcc_track EST_Track fbank_track; // cout << "MELPCEP\n" << fbank_order << endl; fbank_track.resize(mfcc_track.num_frames(), fbank_order); fbank_track.fill_time(mfcc_track); fbank_track.set_equal_space(false); // temp removed by pault 24/02/99 // make_timed_track(mfcc_track, fbank_track, "filter", fbank_order, 0); // 'true' makes fbank(...) take logs fbank(sig, fbank_track, factor, wf, use_power_rather_than_energy, true); /* if(include_c0) cerr << "melcep c0" << endl; else cerr << "melcep no c0" << endl; */ for (k = 0; k < mfcc_track.num_frames(); ++k) { mfcc_track.frame(mfcc_frame,k); fbank_track.frame(fbank_frame,k); fbank2melcep(fbank_frame, mfcc_frame,liftering_parameter,include_c0); } } speech_tools/sigpr/pitchmark.cc0000644000076400007640000002002710056153701015275 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author: Paul Taylor */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* Pitchmark Laryngograph Signals */ /* */ /*=======================================================================*/ /* Note - this is based on a pitchmarker developed by Mike Macon and written in matlab. */ #include "stdlib.h" #include "sigpr/EST_filter.h" #include "sigpr/EST_pitchmark.h" #include "ling_class/EST_Relation.h" #include "EST_math.h" #include "EST_inline_utils.h" #include "EST_wave_aux.h" #include "EST_track_aux.h" void delta(EST_Wave &tr, EST_Wave &d, int regression_length); EST_Track pitchmark(EST_Wave &lx, int lx_lf, int lx_lo, int lx_hf, int lx_ho, int df_lf, int df_lo, int mo, int debug) { EST_Track pm; EST_Wave lxdiff; pm.set_equal_space(false); // pre-filtering if (debug) cout << "pitchmark 1\n"; FIRlowpass_double_filter(lx, lx_lf, lx_lo); FIRhighpass_double_filter(lx, lx_hf, lx_ho); if (debug) cout << "pitchmark 2\n"; if (debug) lx.save("tmpfilt.lx"); // cout << "df " << df_lf << " df_o " << df_lo << endl; // lxdiff = lx; // differentiate(lxdiff); lxdiff.resize(lx.num_samples()); lxdiff.set_sample_rate(lx.sample_rate()); delta(lx, lxdiff, 4); if (debug) lxdiff.save("tmpdiff.lx"); // it was found that median smoothing worked better here. if (df_lo > 0) FIRlowpass_double_filter(lxdiff, df_lf, df_lo); if (mo > 0) simple_mean_smooth(lxdiff, mo); if (debug) lxdiff.save("tmpfiltdiff.lx"); neg_zero_cross_pick(lxdiff, pm); return pm; } EST_Track pitchmark(EST_Wave &lx, EST_Features &op) { EST_Track pm; EST_Wave lxdiff; int lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo, mo, debug; lx_lf = op.present("lx_low_frequency") ? op.I("lx_low_frequency") : 400; lx_lo = op.present("lx_low_order") ? op.I("lx_low_order") : 19; lx_hf = op.present("lx_high_frequency") ? op.I("lx_high_frequency") : 40; lx_ho = op.present("lx_high_order") ? op.I("lx_high_order") : 19; df_lf = op.present("df_low_frequency") ? op.I("df_low_frequency") : 1000; df_lo = op.present("df_low_order") ? op.I("df_low_order") : 0; mo = op.present("median_order") ? op.I("median_order") : 19; debug = op.present("pm_debug") ? 1 : 0; return pitchmark(lx, lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo, mo, debug); } /** Iterate through track and eliminate any frame whose distance to a preceding frames is less than min seconds*/ void pm_min_check(EST_Track &pm, float min) { int i, j; for (i = j = 0; i < pm.num_frames() - 1; ++i, ++j) { pm.t(j) = pm.t(i); while ((i < (pm.num_frames() - 1)) && ((pm.t(i + 1) - pm.t(i)) < min)) ++i; } if (i < pm.num_frames()) pm.t(j) = pm.t(i); pm.resize(j, pm.num_channels()); } void pm_fill(EST_Track &pm, float new_end, float max, float min, float def) { EST_FVector new_pm; if (new_end < 0) new_end = pm.end(); // if (debug) // cout<< "new end:" << new_end << endl; // largest possible set of new pitchmarks // cout << "num frames:" << pm.num_frames() << endl; // cout << "num frames:" << pm.end() << endl; // cout << "num frames:" << min << endl; new_pm.resize(int(new_end / min)); // cout << "num frames:" << pm.end()/min << endl; // cout << "num frames:" << new_pm.n() << endl; int i, j, npm=0; float last = 0.0; int dropped=0, added=0; for(j = 0; j < pm.num_frames(); j++) { float current = pm.t(j); if (current > new_end) break; if (current - last < min) { // drop current pitchmark dropped++; } else if (current-last > max) { // interpolate int num = ifloor((current - last)/ def); float size = (current-last) / num; for (i = 1; i <= num; i++) { new_pm[npm] = last + i * size; npm++; added++; } } else { new_pm[npm] = pm.t(j); npm++; } last=current; } if (new_end - last > max) { // interpolate int num = ifloor((new_end - last)/ def); float size = (new_end -last) / num; for (i = 1; i <= num; i++) { new_pm[npm] = last + i * size; npm++; added++; } } // if (debug) // if (dropped>0 || added >0) // cout << "Dropped " << dropped<< " and added " << added << " PMs\n"; // if (debug) pm.resize(npm, pm.num_channels()); for (i = 0; i < npm; i++) pm.t(i) = new_pm(i); } void neg_zero_cross_pick(EST_Wave &lx, EST_Track &pm) { int i, j; pm.resize(lx.num_samples(), EST_CURRENT); for (i = 1, j = 0; i < lx.num_samples(); ++i) if ((lx.a(i -1) > 0) && (lx.a(i) <= 0)) pm.t(j++) = lx.t(i); pm.resize(j, EST_CURRENT); for (i = 0; i < pm.num_frames(); ++i) pm.set_value(i); } void pm_to_label(EST_Track &pm, EST_Relation &lab) { EST_Item *seg; lab.clear(); for (int i = 0; i < pm.num_frames(); ++i) { seg = lab.append(); seg->set("name",""); seg->set("end",pm.t(i)); } } void pm_to_f0(EST_Track &pm, EST_Track &f0) { float prev_pm = 0.0; f0 = pm; f0.resize(EST_ALL, 1); for (int i = 0; i < f0.num_frames(); ++i) { f0.a(i, 0) = 1.0 / (f0.t(i) - prev_pm); prev_pm = f0.t(i); } } void pm_to_f0(EST_Track &pm, EST_Track &fz, float shift) { int i; float period; fz.resize((int)(pm.end()/shift), 1); fz.fill_time(shift); for (i = 0; i < fz.num_frames() -1 ; ++i) { period = get_time_frame_size(pm, pm.index_below(fz.t(i))); fz.a(i) = 1.0 /period; } } speech_tools/sigpr/spectrogram.cc0000644000076400007640000001474710127000720015644 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : December 96 */ /*-----------------------------------------------------------------------*/ /* Spectrogram Generation */ /* */ /*=======================================================================*/ #include #include #include /* needed for FLT_MAX */ #include "EST_error.h" #include "EST_Track.h" #include "EST_Wave.h" #include "sigpr/EST_Window.h" #include "EST_Option.h" #include "sigpr/EST_fft.h" #include "sigpr/EST_spectrogram.h" #include "sigpr/EST_misc_sigpr.h" void make_spectrogram(EST_Wave &sig, EST_Track &sp, EST_Features &op) { EST_Wave psig; EST_pre_emphasis(sig, psig, op.F("preemph")); // calculate raw spectrogram raw_spectrogram(sp, psig, op.F("frame_length"), op.F("frame_shift"), op.I("frame_order"), op.present("slow_fft")); if (op.present("raw")) { cout << "no scaling\n"; return; } // coerce the values so as to emphasis important features if (op.present("sp_range") || op.present("sp_wcut") || op.present("sp_bcut")) { if (!op.present("sp_range")) op.set("sp_range", 1.0); if (!op.present("sp_wcut")) op.set("sp_wcut", 1.0); if (!op.present("sp_bcut")) op.set("sp_bcut", 0.0); scale_spectrogram(sp, op.F("sp_range"),op.F("sp_wcut"),op.F("sp_bcut")); } } void scale_spectrogram(EST_Track &sp, float range, float wcut, float bcut) { float max, min, scale, v; int i, j; max = -FLT_MIN; min = FLT_MAX; // find min and max values for (i = 0; i < sp.num_frames(); ++i) for (j = 0; j < sp.num_channels(); ++j) { float vv = sp.a_no_check(i, j); if (vv > max) max = vv; if (vv < min) min = vv; } scale = (max - min); // for every value: // 1. Effectively scale in range 0 to 1 // 2. Impose white and black cut offs // 3. Rescale to 0 and 1 // 4. scale to fit in "range" // this can obviously be done more efficiently float mag = (float)range / (float)(bcut - wcut); for (i = 0; i < sp.num_frames(); ++i) for (j = 0; j < sp.num_channels(); ++j) { v = (((sp.a_no_check(i, j) - min) / scale) - wcut) * mag; if (v > range) v = range; if (v < 0.0) v = 0.0; sp.a_no_check(i, j) = v; } } void raw_spectrogram(EST_Track &sp, EST_Wave &sig, float length, float shift, int order, bool slow) { int frame_length = (int) (length * (float) sig.sample_rate() +0.5); int frame_shift = (int) (shift * (float) sig.sample_rate() +0.5); EST_WindowFunc *make_window = EST_Window::creator("hamming"); // sanity check, we can't analyse more signal than order allows. if (frame_length > order) { EST_warning("frame_length reduced to %f (%d samples) to fit order\n", (float)order/(float) sig.sample_rate(), order); frame_length=order; } // enough frames to cover the entire signal int num_frames= (int)ceil(sig.num_samples()/(float)frame_shift); // spectrogram gets order/2 powers, the moduli of order/2 // complex numbers sp.resize(num_frames, order/2, FALSE); EST_FVector real(order); EST_FVector imag(order); // create the window shape EST_TBuffer window_vals(frame_length); make_window(frame_length, window_vals,-1); for (int k = 0 ; k < num_frames ; k++) { int pos = frame_shift * k; int window_start = pos - frame_length/2; real.empty(); // imag not used in old FFT code if (slow) imag.empty(); EST_Window::window_signal(sig, window_vals, window_start, frame_length, real, FALSE); int state = slow?power_spectrum_slow(real, imag):power_spectrum(real, imag); if (state != 0) { fprintf(stderr, "FFT Failed for frame %d\n", k); for (int i = 0; i < order /2; ++i) sp.a_no_check(k, i) = 0; } else sp.copy_frame_in(k, real); } sp.fill_time(shift); } speech_tools/sigpr/misc.cc0000644000076400007640000001035407262605664014267 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Some generally useful signal processing things. */ /* */ /*************************************************************************/ #include "EST_Wave.h" #include "EST_TBuffer.h" #include "sigpr/EST_misc_sigpr.h" #include "EST_inline_utils.h" static void short_set(EST_Wave &to, int ch, const EST_TBuffer &from, double maxval) { for(int i=0; i fpdata(num_samples); for(int i=0; i maxval) maxval = absval(fpdata[i]); } psignal.resize(num_samples,1,FALSE); psignal.set_sample_rate(signal.sample_rate()); short_set(psignal, 0, fpdata, maxval); } /* redundant - see new version in filter */ void EST_post_deemphasis(EST_Wave &signal, EST_Wave &dsignal, float a) { int num_samples = signal.num_samples(); double last=0; double maxval=0; EST_TBuffer fddata(num_samples); for(int i=0; i maxval) maxval = absval(fddata[i]); } dsignal.resize(num_samples,1,FALSE); dsignal.set_sample_rate(signal.sample_rate()); short_set(dsignal, 0, fddata, maxval); } speech_tools/sigpr/fft.cc0000644000076400007640000003162510127000720014067 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King (taken from Tony Robinson) */ /* Date : July 1994 */ /*-----------------------------------------------------------------------*/ /* FFT functions */ /* */ /*=======================================================================*/ #include //#include //#include #include "sigpr/EST_fft.h" #include "EST_math.h" #include "EST_error.h" #define PI8 0.392699081698724 /* PI / 8.0 */ #define RT2 1.4142135623731 /* sqrt(2.0) */ #define IRT2 0.707106781186548 /* 1.0/sqrt(2.0) */ static void FR2TR(int, float*, float*); static void FR4TR(int, int, float*, float*, float*, float*); static void FORD1(int, float*); static void FORD2(int, float*); /* ** FAST(b,n) ** This routine replaces the float vector b ** of length n with its finite discrete fourier transform. ** DC term is returned in b[0]; ** n/2th harmonic float part in b[1]. ** jth harmonic is returned as complex number stored as ** b[2*j] + i b[2*j + 1] ** (i.e., remaining coefficients are as a DPCOMPLEX vector). ** */ static int slowFFTsub(EST_FVector &real, EST_FVector &imag, float f) { // f = -1 for FFT, 1 for IFFT // would be nicer if we used a complex number class, // but we don't, so it isn't // taken from the FORTRAN old chestnut // in various sig proc books // FORTRAN uses 1..n arrays, so subtract 1 all over the place float u_real,u_imag; float w_real,w_imag; float t_real,t_imag; float tmp_real,tmp_imag; int M,N; int i,j,k,l; M = fastlog2(real.n()); N = (int)pow(float(2.0),(float)M); if (N != real.n()) { EST_warning("Illegal FFT order %d", real.n()); return -1; } for(l=1;l<=M;l++){ int le = (int)pow(float(2.0),(float)(M+1-l)); int le1=le/2; u_real = 1.0; u_imag = 0.0; w_real=cos(PI/le1); w_imag=f * sin(PI/le1); for (j=1;j<=le1;j++) { for (i=j;i<=N-le1;i+=le) { int ip=i+le1; t_real = real.a_no_check(i-1) + real.a_no_check(ip-1); t_imag = imag.a_no_check(i-1) + imag.a_no_check(ip-1); tmp_real = real.a_no_check(i-1) - real.a_no_check(ip-1); tmp_imag = imag.a_no_check(i-1) - imag.a_no_check(ip-1); real.a_no_check(ip-1) = tmp_real*u_real - tmp_imag*u_imag; imag.a_no_check(ip-1) = tmp_real*u_imag + tmp_imag*u_real; real.a_no_check(i-1) = t_real; imag.a_no_check(i-1) = t_imag; } tmp_real = u_real*w_real - u_imag*w_imag; tmp_imag = u_real*w_imag + u_imag*w_real; u_real=tmp_real; u_imag=tmp_imag; } } int NV2=N/2; int NM1=N-1; j=1; for (i=1; i<=NM1;i++) { if (i < j) { t_real=real(j-1); t_imag=imag(j-1); real[j-1] = real(i-1); imag[j-1] = imag(i-1); real[i-1] = t_real; imag[i-1] = t_imag; } k=NV2; while(k < j) { j=j-k; k=k/2; } j=j+k; } return 0; } int slowFFT(EST_FVector &real, EST_FVector &imag) { return slowFFTsub(real,imag,-1.0); } int slowIFFT(EST_FVector &real, EST_FVector &imag) { int N=real.n(); if (N <=0 ) return -1; if (slowFFTsub(real,imag,1.0) != 0) return -1; for(int i=1;i<=N;i++){ real[i-1] /= (float)N; imag[i-1] /= (float)N; } return 0; } int energy_spectrum(EST_FVector &real, EST_FVector &imag) { if (slowFFT(real, imag) != 0) return -1; int i; for(i=0;i0) { k0 = in*4 + 1; kl = k0 + in - 1; for (k=k0;k<=kl;k++) { kk = k-1; pr = IRT2 * (b1[kk]-b3[kk]); pi = IRT2 * (b1[kk]+b3[kk]); b3[kk] = b2[kk] + pi; b1[kk] = pi - b2[kk]; b2[kk] = b0[kk] - pr; b0[kk] = b0[kk] + pr; } } } else { arg = th2*piovn; c1 = cos(arg); s1 = sin(arg); c2 = c1*c1 - s1*s1; s2 = c1*s1 + c1*s1; c3 = c1*c2 - s1*s2; s3 = c2*s1 + s2*c1; int4 = in*4; j0=jr*int4 + 1; k0=ji*int4 + 1; jlast = j0+in-1; for(j=j0;j<=jlast;j++) { k = k0 + j - j0; kk = k-1; jj = j-1; r1 = b1[jj]*c1 - b5[kk]*s1; r5 = b1[jj]*s1 + b5[kk]*c1; t2 = b2[jj]*c2 - b6[kk]*s2; t6 = b2[jj]*s2 + b6[kk]*c2; t3 = b3[jj]*c3 - b7[kk]*s3; t7 = b3[jj]*s3 + b7[kk]*c3; t0 = b0[jj] + t2; t4 = b4[kk] + t6; t2 = b0[jj] - t2; t6 = b4[kk] - t6; t1 = r1 + t3; t5 = r5 + t7; t3 = r1 - t3; t7 = r5 - t7; b0[jj] = t0 + t1; b7[kk] = t4 + t5; b6[kk] = t0 - t1; b1[jj] = t5 - t4; b2[jj] = t2 - t7; b5[kk] = t6 + t3; b4[kk] = t2 + t7; b3[jj] = t3 - t6; } jr += 2; ji -= 2; if(ji-jl <= 0) { ji = 2*jr - 1; jl = jr; } } } } /* an inplace reordering subroutine */ void FORD1(int m, float *b) { int j, k = 4, kl = 2, n = 0x1 << m; float t; for(j = 4; j <= n; j += 2) { if (k - j>0) { t = b[j-1]; b[j - 1] = b[k - 1]; b[k - 1] = t; } k -= 2; if (k - kl <= 0) { k = 2*j; kl = j; } } } /* the other inplace reordering subroutine */ void FORD2(int m, float *b) { float t; int n = 0x1<>= 1; power += 1; if (n & 0x01) { if (n > 1) return(0); else return(power); } } return(0); } speech_tools/sigpr/Makefile0000644000076400007640000000620207262605664014462 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1994,1995,1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Signal processing Makefile # # # #=========================================================================# TOP=.. DIRNAME=sigpr LIB_BUILD_DIRS = pda BUILD_DIRS = $(LIB_BUILD_DIRS) ALL_DIRS = $(BUILD_DIRS) # sigpr_development LOCAL_DEFAULT_LIBRARY = estbase H = TSRCS = EST_Window.cc # Some versions of gcc can't optimize this file (most can) NOOPTSRCS = fft.cc CPPSRCS = delta.cc filter.cc \ sigpr_frame.cc sigpr_utt.cc \ pitchmark.cc spectrogram.cc misc.cc $(NOOPTSRCS) SRCS = $(TSRCS) $(CPPSRCS) OBJS = $(SRCS:.cc=.o) DOCXX = lpc.cc FILES = $(SRCS) $(H) Makefile ALL = .buildlib $(BUILD_DIRS) include $(TOP)/config/common_make_rules speech_tools/sigpr/pda/pcb_smoother.cc0000644000076400007640000002213110127000720016530 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Bagshaw */ /* Date : 1993 */ /*-----------------------------------------------------------------------*/ /* */ /* The above copyright was given by Paul Bagshaw, he retains */ /* his original rights */ /* */ /*************************************************************************/ #include #include #include "array_smoother.h" #include "EST_cutils.h" #define MAX_LEN 127 #define MODULE "array_smoother" float median (int *counter, float valin, float valbuf[], int lmed, int mmed); float hanning (int *counter, float valin, float valhan[], float win_coeff[], struct Ms_Op *ms); void mk_window_coeffs (int length, float win_coeff[]); struct Ms_Op *default_ms_op(struct Ms_Op *ms); void array_smoother (float *p_array, int arraylen, struct Ms_Op *ms) { int i, j, mid1, mid2 = 0, filler, nloops; int C1, C2 = 0, C3 = 0, C4 = 0, c1, c2, c3, c4; int delay, delx = 0, dely = 0; int in = 0, out = 0; float input, output; float *inarray; float xdel[2 * MAX_LEN - 2], ydel[2 * MAX_LEN - 2]; float medbuf1[MAX_LEN], medbuf2[MAX_LEN]; float hanbuf1[MAX_LEN], hanbuf2[MAX_LEN], win_coeffs[MAX_LEN]; float medval1, medval2, hanval1, hanval2, zatn; inarray = new float[arraylen]; for (i = 0; i < arraylen; ++i) inarray[i] = p_array[i]; if (ms == NULL) { ms = new Ms_Op; default_ms_op(ms); } mk_window_coeffs (ms->window_length, win_coeffs); /* determine the size and delay of each stage concerned */ mid1 = ms->first_median / 2; C1 = delay = ms->first_median - 1; if (ms->apply_hanning) { C2 = ms->window_length - 1; delay = ms->first_median + ms->window_length - 2; } if (ms->smooth_double) { mid2 = ms->second_median / 2; C3 = ms->second_median - 1; if (!ms->apply_hanning) { delx = ms->first_median; dely = ms->second_median; } else { C4 = ms->window_length - 1; delx = ms->first_median + ms->window_length - 1; dely = ms->second_median + ms->window_length - 1; } delay = delx + dely - 2; } /* prepare for smoothing */ c1 = C1; c2 = C2; c3 = C3; c4 = C4; if (!ms->extrapolate) { /* pad with breakers at the beginning */ for (i = 0; i < delay / 2; i++) p_array[out++] = ms->breaker; filler = 0; nloops = arraylen; } else { /* extrapolate by initialising filter with dummy breakers */ filler = delay / 2; nloops = arraylen + delay; } /* smooth track element by track element */ for (j = 0; j < nloops; j++) { if (j < filler || j >= nloops - filler) input = ms->breaker; else input = inarray[in++]; /* store input value if double smoothing */ if (ms->smooth_double) { for (i = delx - 1; i > 0; i--) xdel[i] = xdel[i - 1]; xdel[0] = input; } /* first median smoothing */ medval1 = median (&c1, input, medbuf1, ms->first_median, mid1); if (c1 == -1) { output = medval1; /* first hanning window (optional) */ if (ms->apply_hanning) { hanval1 = hanning (&c2, medval1, hanbuf1, win_coeffs, ms); if (c2 == -1) output = hanval1; else continue; } /* procedures for double smoothing (optional) */ if (ms->smooth_double) { /* compute rough component z(n) */ if (output != ms->breaker && xdel[delx - 1] != ms->breaker) zatn = xdel[delx - 1] - output; else zatn = ms->breaker; /* store results of first smoothing */ for (i = dely - 1; i > 0; i--) ydel[i] = ydel[i - 1]; ydel[0] = output; /* second median smoothing */ medval2 = median (&c3, zatn, medbuf2, ms->second_median, mid2); if (c3 == -1) { output = medval2; /* second hanning smoothing (optional) */ if (ms->apply_hanning) { hanval2 = hanning (&c4, medval2, hanbuf2, win_coeffs, ms); if (c4 == -1) output = hanval2; else continue; } if (output != ms->breaker && ydel[dely - 1] != ms->breaker) output += ydel[dely - 1]; else output = ms->breaker; } else continue; } /* write filtered result */ p_array[out++] = output; } } if (!ms->extrapolate) /* pad with breakers at the end */ for (i = 0; i < delay / 2; i++) p_array[out++] = ms->breaker; delete inarray; } float median (int *counter, float valin, float valbuf[], int lmed, int mmed) { int i, j; float tmp, filmed[MAX_LEN]; for (i = lmed - 1; i > 0; i--) valbuf[i] = valbuf[i - 1]; valbuf[0] = valin; if (*counter > 0) { (*counter)--; return (0.0); } else { *counter = -1; for (i = 0; i < lmed; i++) filmed[i] = valbuf[i]; for (j = lmed - 1; j > 0; j--) for (i = 0; i < j; i++) if (filmed[i] > filmed[i + 1]) { tmp = filmed[i + 1]; filmed[i + 1] = filmed[i]; filmed[i] = tmp; } return (filmed[mmed]); } } #define TWO_PI 6.28318530717958647698 void mk_window_coeffs (int length, float win_coeff[]) { int i; double x; for (i = 0; i < length; i++) { x = TWO_PI * (i + 1.0) / (length + 1.0); win_coeff[i] = (1.0 - (float) cos (x)) / (length + 1.0); } } float hanning (int *counter, float valin, float valhan[], float win_coeff[], struct Ms_Op *par) { int i, j, k = 0; float valout = 0.0, weight[MAX_LEN]; for (i = par->window_length - 1; i > 0; i--) valhan[i] = valhan[i - 1]; valhan[0] = valin; if (*counter > 0) { (*counter)--; return (0.0); } else { *counter = -1; for (i = 0; i < par->window_length; i++) if (valhan[i] == par->breaker) k++; if (!k) for (i = 0; i < par->window_length; i++) valout += valhan[i] * win_coeff[i]; else if (k <= par->window_length / 2 && par->extrapolate) { mk_window_coeffs (par->window_length - k, weight); for (i = 0, j = 0; i < par->window_length; i++) if (valhan[i] != par->breaker) valout += valhan[i] * weight[j++]; } else valout = par->breaker; return (valout); } } void initialise_parameters (struct Ms_Op *p_par) { p_par->smooth_double = 0; p_par->apply_hanning = 0; p_par->extrapolate = 0; p_par->window_length = DEFAULT_WLEN; p_par->first_median = DEFAULT_MED_1; p_par->second_median = DEFAULT_MED_2; return; } struct Ms_Op *default_ms_op(struct Ms_Op *ms) { ms->smooth_double = FALSE; ms->apply_hanning = TRUE; ms->extrapolate = TRUE; ms->first_median = 11; ms->second_median = 1; ms->window_length = 7; ms->breaker = -1.0; return (ms); } speech_tools/sigpr/pda/smooth_pda.cc0000644000076400007640000001452410127000720016210 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1994 */ /*-----------------------------------------------------------------------*/ /* Smooth F0 contours */ /*=======================================================================*/ /*#include #include #include #include */ //#include "sigpr/EST_pda.h" #include "EST_Track.h" #include "EST_Features.h" #include "array_smoother.h" #include "EST_math.h" void smooth_portion(EST_Track &c, EST_Features &op); static void interp(const EST_Track &c, const EST_Track &speech, int fill, EST_Track &interp); static int parse_ms_list(EST_Features &al, struct Ms_Op *ms); struct Ms_Op *default_ms_op(struct Ms_Op *ms); void smooth_phrase(EST_Track &fz, EST_Track &speech, EST_Features &op, EST_Track &smi_fz) { int n=0; EST_Track sm_fz; char nstring[10]; if (fz.empty()) { smi_fz = fz; return; } sm_fz = fz; sm_fz.set_channel_name("F0", 0); n = (int)(op.F("window_length") / fz.shift()); sprintf(nstring, "%d", n); op.set("point_window_size", nstring); if (!op.present("icda_no_smooth")) smooth_portion(sm_fz, op); if (op.present("icda_no_interp")) { sm_fz = fz; return; // no unvoiced interpolation } int fill = op.present("icda_fi") ? 1 : 0; interp(sm_fz, speech, fill, smi_fz); // fill unvoiced region n = (int)(op.F("second_length") / fz.shift()); sprintf(nstring, "%d", n); op.set("point_window_size", nstring); if (!op.present("icda_no_smooth")) smooth_portion(smi_fz, op); } void smooth_portion(EST_Track &c, EST_Features &op) { int i; float *a; // need float * so it can be passed to array_smoother struct Ms_Op *ms; ms = new Ms_Op; default_ms_op(ms); parse_ms_list(op, ms); if (op.present("point_window_size")) ms->window_length = op.I("point_window_size"); a = new float[c.num_frames()]; for (i = 0; i < c.num_frames(); ++i) a[i] = c.track_break(i) ? -1.0 : c.a(i); array_smoother(a, c.num_frames(), ms); for (i = 0; i < c.num_frames(); ++i) { // occasionally NaNs result... if (isnanf(a[i])) { c.set_break(i); c.a(i) = 0.0; } else { if (a[i] < 0.0) c.set_break(i); else c.set_value(i); c.a(i) = a[i]; } } delete a; } static void interp(const EST_Track &c, const EST_Track &speech, int fill, EST_Track &interp) { // Interpolate between unvoiced sections, and ensure breaks // during silences int i, n, p; float m; float n_val, p_val; float f = c.shift(); interp = c; // copy track if (speech.num_frames() < c.num_frames()) interp.resize(speech.num_frames(), interp.num_channels()); for (i = 1; i < interp.num_frames(); ++i) { if ((fill == 1) || (speech.a(i) > 0.5)) { if (!interp.track_break(i)) continue; // already has a value p = i - 1; if ((n = interp.next_non_break(i)) == 0) n = interp.num_frames() - 1; n_val = interp.a(n); p_val = interp.a(p); if (n_val <= 0) n_val = p_val; if (p_val <= 0) p_val = n_val; // if they are both zero, well we'll learn to live it. m = (n_val - p_val) / ( interp.t(n) - interp.t(p)); interp.a(i) = (m * f) + p_val; interp.set_value(i); } else interp.set_break(i); } } int parse_ms_list(EST_Features &al, struct Ms_Op *ms) { default_ms_op(ms); if (al.present("smooth_double")) ms->smooth_double = al.I("smooth_double"); if (al.present( "hanning")) ms->apply_hanning = al.I("hanning"); if (al.present("extrapolate")) ms->extrapolate = al.I("extrapolate"); if (al.present("first_length")) ms->first_median = al.I("first_length"); if (al.present("second_length")) ms->second_median = al.I("second_length"); if (al.present("window_length")) ms->window_length = al.I("window_length"); return 0; } speech_tools/sigpr/pda/pda.cc0000644000076400007640000003221010266455571014635 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1994 */ /*************************************************************************/ #include "EST_speech_class.h" #include "sigpr/EST_sigpr_utt.h" #include "sigpr/EST_filter.h" #include "srpd.h" #include "EST_error.h" #include "EST_string_aux.h" int read_next_wave_segment (EST_Wave &sig, struct Srpd_Op *paras, SEGMENT_ *p_seg); static void srpd(EST_Wave &sig, EST_Track &fz, Srpd_Op &srpd_op, int resize); static struct Srpd_Op *default_srpd_op(struct Srpd_Op *srpd); static void parse_srpd_list(EST_Features &a_list, struct Srpd_Op *srpd); void pda(EST_Wave &sig, EST_Track &fz, EST_Features &op, EST_String method) { if (method == "") { if (op.present("pda_method")) method = op.S("pda_method"); } if (method == "") srpd(sig, fz, op); else if (method == "srpd") srpd(sig, fz, op); else EST_error("Unknown pda %s\n", (const char *)method); } void icda(EST_Wave &sig, EST_Track &fz, EST_Track &speech, EST_Features &op, EST_String method) { // intonation contour detection algorithm EST_Track raw_fz; if (method == "") { if (op.present("pda_method")) method = op.S("pda_method"); } if (method == "") srpd(sig, raw_fz, op); else if (method == "srpd") srpd(sig, raw_fz, op); else EST_error("Unknown pda %s\n", (const char *)method); smooth_phrase(raw_fz, speech, op, fz); } void srpd(EST_Wave &sig, EST_Track &fz, EST_Features &op) { Srpd_Op srpd_op; default_srpd_op(&srpd_op); // default values parse_srpd_list(op, &srpd_op); // override with options if (op.I("do_low_pass",0)) FIRlowpass_filter(sig, op.I("lpf_cutoff"),op.I("lpf_order")); srpd(sig, fz, srpd_op, op.I("srpd_resize", 0)); } /*void do_srpd_fz(EST_Wave &sig, EST_Track &fz) { Srpd_Op srpd_op; default_srpd_op(&srpd_op); srpd(sig, fz, srpd_op, 1); } */ void srpd(EST_Wave &sig, EST_Track &fz, Srpd_Op &srpd_op, int resize) { int i, rns, tracklen, j = 0; SEGMENT_ segment; CROSS_CORR_ cc; STATUS_ pda_status, held_status; srpd_op.sample_freq = sig.sample_rate(); float min, max; min = srpd_op.min_pitch; // must store as set up routines corrupt max = srpd_op.max_pitch; initialise_structures (&srpd_op, &segment, &cc); initialise_status (&srpd_op, &pda_status); initialise_status (&srpd_op, &held_status); tracklen = (sig.num_samples() - segment.length) / segment.shift + 1; if (resize) { fz.set_equal_space(true); fz.resize(tracklen, 1); fz.set_channel_name("F0", 0); fz.fill_time(srpd_op.shift/1000); } if (!fz.equal_space()) EST_error("Pitch tracking algorithm must have equal spaced track\n"); while ((rns = read_next_wave_segment (sig, &srpd_op, &segment)) != 0) { if (rns == 2) { for (i = 0; i < cc.size; cc.coeff[i++] = 0.0); initialise_status (&srpd_op, &pda_status); } else super_resolution_pda (&srpd_op, segment, &cc, &pda_status); if (pda_status.s_h == HOLD) { held_status.pitch_freq = pda_status.pitch_freq; held_status.v_uv = VOICED; held_status.s_h = HELD; held_status.cc_max = pda_status.cc_max; held_status.threshold = pda_status.threshold; continue; } if (held_status.s_h == HELD) { if (pda_status.pitch_freq == BREAK_NUMBER) { held_status.pitch_freq = BREAK_NUMBER; held_status.v_uv = UNVOICED; } held_status.s_h = SENT; if (held_status.v_uv != VOICED) fz.set_break(j); fz.a(j++) = held_status.pitch_freq; // printf( "track set: %d (of %d) to %f\n", j-1, fz.length(), held_status.pitch_freq ); } if (pda_status.v_uv != VOICED) fz.set_break(j); fz.a(j++) = pda_status.pitch_freq; //printf( "track set: %d (of %d) to %f\n", j-1, fz.length(), pda_status.pitch_freq ); } if (held_status.s_h == HELD) { held_status.pitch_freq = BREAK_NUMBER; held_status.v_uv = UNVOICED; fz.set_break(j); fz.a(j++) = held_status.pitch_freq; } end_structure_use (&segment, &cc); } static struct Srpd_Op *default_srpd_op(struct Srpd_Op *srpd) { srpd->L = DEFAULT_DECIMATION; srpd->min_pitch = DEFAULT_MIN_PITCH; srpd->max_pitch = DEFAULT_MAX_PITCH; srpd->shift = DEFAULT_SHIFT; srpd->length = DEFAULT_LENGTH; srpd->Tsilent = DEFAULT_TSILENT; srpd->Tmin = DEFAULT_TMIN; srpd->Tmax_ratio = DEFAULT_TMAX_RATIO; srpd->Thigh = DEFAULT_THIGH; srpd->Tdh = DEFAULT_TDH; srpd->make_ascii = 0; srpd->peak_tracking = 0; srpd->sample_freq = DEFAULT_SF; /* p_par->Nmax and p_par->Nmin cannot be initialised */ return(srpd); } static void parse_srpd_list(EST_Features &al, struct Srpd_Op *srpd) { if (al.present("decimation")) srpd->L = al.I("decimation"); if (al.present("min_pitch")) srpd->min_pitch = al.F("min_pitch"); if (al.present("max_pitch")) srpd->max_pitch = al.F("max_pitch"); if (al.present("pda_frame_shift")) srpd->shift = al.F("pda_frame_shift") * 1000.0; if (al.present("pda_frame_length")) srpd->length = al.F("pda_frame_length") * 1000.0; if (al.present("noise_floor")) srpd->Tsilent = al.I("noise_floor"); if (al.present("v2uv_coeff_thresh")) srpd->Thigh = al.F("v2uv_coef_thresh"); if (al.present("min_v2uv_coef_thresh")) srpd->Tmin = al.F("min_v2uv_coef_thresh"); if (al.present("v2uv_coef_thresh_ratio")) srpd->Tmax_ratio = al.F("v2uv_coef_thresh_ratio"); if (al.present("anti_doubling_thresh")) srpd->Tdh = al.F("anti_doubling_thresh"); if (al.present("peak_tracking")) srpd->peak_tracking = al.I("peak_tracking"); if (al.present("sample_frequency")) srpd->sample_freq = al.I("sample_frequency"); } void default_pda_options(EST_Features &al) { al.set("min_pitch", "40.0"); al.set("max_pitch", "400.0"); al.set("pda_frame_shift", "0.005"); al.set("pda_frame_length", DEFAULT_LENGTH / 1000.0); al.set("lpf_cutoff", "600"); al.set("lpf_order", "49"); al.set("f0_file_type", "esps"); al.set("decimation", DEFAULT_DECIMATION); al.set("noise_floor", DEFAULT_TSILENT); al.set("min_v2uv_coef_thresh", DEFAULT_TMIN); al.set("v2uv_coef_thresh_ratio", DEFAULT_TMAX_RATIO); al.set("v2uv_coef_thresh", DEFAULT_THIGH); al.set("anti_doubling_thresh", DEFAULT_TDH); al.set("peak_tracking", 0); } EST_String options_pda_general(void) { // The standard waveform input options return EST_String("")+ "-L Perform low pass filtering on input. This option should always \n" " be used in normal processing as it usually increases \n" " performance considerably\n\n" "-P perform peak tracking\n\n" "-fmin miniumum F0 value. Sets the minimum allowed F0 in \n" " output track. Default is "+ftoString(DEFAULT_MIN_PITCH)+".\n " " Changing this to suit the speaker usually increases \n" " performance. Typical recommended values are 60-90Hz for\n" " males and 120-150Hz for females\n\n" "-fmax maxiumum F0 value. Sets the maximum allowed F0 in \n" " output track. Default is "+ftoString(DEFAULT_MAX_PITCH)+". \n" " Changing this to suit the speaker usually increases \n" " performance. Typical recommended values are 200Hz for \n" " males and 300-400Hz for females\n\n" "-shift frame spacing in seconds for fixed frame analysis. \n" " This doesn't have to be the same as the output file spacing - \n" " the -S option can be used to resample the track before saving \n" " default: "+ftoString(DEFAULT_SHIFT/1000.0) +"\n\n" "-length analysis frame length in seconds.\n" " default: "+ftoString(DEFAULT_LENGTH/1000.0) +"\n\n" "-lpfilter Low pass filter, with cutoff frequency in Hz \n" " Filtering is performed by a FIR filter which is built at run \n" " time. The order of the filter can be given by -forder. The \n" " default value is 199\n\n" "-forder Order of FIR filter used for lpfilter and \n" " hpfilter. This must be ODD. Sensible values range \n" " from 19 (quick but with a shallow rolloff) to 199 \n" " (slow but with a steep rolloff). The default is 199.\n\n"; } EST_String options_pda_srpd(void) { // The standard waveform input options return EST_String("")+ "-d decimation factor\n" " set down-sampling for quicker computation so that only one in \n" " decimation factor samples are used in the first instance. \n" " Must be in the range of one to ten inclusive. Default is four. \n" " For data sampled at 10kHz, it is advised that a decimation \n" " factor of two isselected.\n\n" "-n Inoise floor.\n" " Set the maximum absolute signal amplitude that represents \n" " silence to Inoise floor. If the absolute amplitude of \n" " the first segment in a given frame is below this level at all \n" " times, then the frame is classified as representing silence. \n" " Must be a positive number. Default is 120 ADC units.\n\n" "-H unvoiced to voiced coeff threshold\n" " set the correlation coefficient threshold which must be \n" " exceeded in a transition from an unvoiced classified frame \n" " of speech to a voiced frame as the unvoiced to voiced coeff \n" " threshold. Must be in the range zero to one inclusive. \n" " Default is 0.88.\n\n" "-m min voiced to unvoiced coeff threshold \n" " set the minimum allowed correlation coefficient threshold \n" " which must not be exceeded in a transition from a voiced \n" " classified frame of speech to an unvoiced frame, as \n" " min voiced to unvoiced coeff threshold. Must be in the \n" " range zero to unvoiced to voiced coeff threshold \n" " inclusive. Default is 0.75.\n\n" "-R voiced to unvoiced coeff threshold-ratio \n" " set the scaling factor used in determining the correlation\n" " coefficient threshold which must not be exceeded in a voiced \n" " frame to unvoiced frame transition, as voiced to unvoiced \n" " coeff threshold -ratio. The voiced to unvoiced coefficient \n" " threshold is determined by multiplying this scaling factor \n" " with the maximum cross-correlation coefficient of the \n" " previously voiced frame. If this product is less than \n" " min voiced to unvoiced coeff threshold then this is used \n" " instead. Must be in the range zero to one inclusive. \n" " Default is 0.85.\n\n" "-t anti pitch doubling/halving threshold\n" " set the threshold used in eliminating (as far as possible) \n" " pitch doubling and pitch halving errors as anti pitch \n" " double/halving threshold. Must be in the range zero to \n" " one inclusive. Default is 0.77.\n\n"; } speech_tools/sigpr/pda/srpd1.3.cc0000644000076400007640000006103310127000720015242 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Bagshaw */ /* Date : 1993 */ /*************************************************************************/ /* */ /* The above copyright was given by Paul Bagshaw, he retains */ /* his original rights */ /* */ /*************************************************************************/ /**************************************************************************** * * * Pitch Determination Algorithm. * * * * Super Resolution Pitch Determinator with No Headers (SRPD_HD). * * * * Analysis synchronised with cepstral analysis, pitch biasing option, and * * optimised for minimum gross pitch errors and accurate voiced/unvoiced * * classification. All known bugs resolved! * * * * 4th February 1992: * * Additional option [-w] added to give an artificial frame length, thus * * allowing the output data to be synchronised with other signal processing * * algorithms such as cepstral analysis and formant tracking. * * * * Y. Medan, E. Yair, and D. Chazan, "Super resolution pitch determination * * of speech signals," IEEE Trans. Signal Processing Vol.39 No.1 * * pp.40-48 (1991). * * * * Implementation by Paul Bagshaw, Centre for Speech Technology Research, * * University of Edinburgh, 80 South Bridge, Edinburgh EH1 1HN. * * * *****************************************************************************/ /************************ * include header files * ************************/ #include #include #include #include "srpd.h" #include "EST_cutils.h" #include "EST_Wave.h" #ifndef MAXSHORT #define MAXSHORT 32767 #endif void super_resolution_pda (struct Srpd_Op *paras, SEGMENT_ seg, CROSS_CORR_ *p_cc, STATUS_ *p_status) { static int zx_lft_N, zx_rht_N; static double prev_pf = BREAK_NUMBER; int n, j, k, N0 = 0, N1, N2, N_, q, lower_found = 0, score = 1, apply_bias; int x_index, y_index, z_index; int zx_rate = 0, zx_at_N0 = 0, prev_sign; int seg1_zxs = 0, seg2_zxs = 0, total_zxs; short prev_seg1, prev_seg2; short x_max = -MAXSHORT, x_min = MAXSHORT; short y_max = -MAXSHORT, y_min = MAXSHORT; double xx = 0.0, yy = 0.0, zz = 0.0, xy = 0.0, yz = 0.0, xz = 0.0; double max_cc = 0.0, coefficient, coeff_weight; double xx_N, yy_N, xy_N, y1y1_N, xy1_N, yy1_N, beta; LIST_ *sig_pks_hd, *sig_pks_tl, *sig_peak, *head, *tail; sig_pks_hd = head = NULL; sig_pks_tl = tail = NULL; /* set correlation coefficient threshold */ if (p_status->v_uv == UNVOICED || p_status->v_uv == SILENT) p_status->threshold = paras->Thigh; else /* p_status->v_uv == VOICED */ p_status->threshold = (paras->Tmin > paras->Tmax_ratio * p_status->cc_max) ? paras->Tmin : paras->Tmax_ratio * p_status->cc_max; /* determine if a bias should be applied */ if (paras->peak_tracking && prev_pf != BREAK_NUMBER && p_status->v_uv == VOICED && p_status->s_h != HOLD && p_status->pitch_freq < 1.75 * prev_pf && p_status->pitch_freq > 0.625 * prev_pf) apply_bias = 1; else apply_bias = 0; /* consider first two segments of period n = Nmin */ prev_seg1 = seg.data[paras->Nmax - paras->Nmin] < 0 ? -1 : 1; prev_seg2 = seg.data[paras->Nmax] < 0 ? -1 : 1; for (j = 0; j < paras->Nmin; j += paras->L) { /* find max and min amplitudes in x and y segments */ x_index = paras->Nmax - paras->Nmin + j; y_index = paras->Nmax + j; if (seg.data[x_index] > x_max) x_max = seg.data[x_index]; if (seg.data[x_index] < x_min) x_min = seg.data[x_index]; if (seg.data[y_index] > y_max) y_max = seg.data[y_index]; if (seg.data[y_index] < y_min) y_min = seg.data[y_index]; /* does new sample in x or y segment represent an input zero-crossing */ if (seg.data[x_index] * prev_seg1 < 0) { prev_seg1 *= -1; seg1_zxs++; } if (seg.data[y_index] * prev_seg2 < 0) { prev_seg2 *= -1; seg2_zxs++; } /* calculate parts for first correlation coefficient */ xx += (double) seg.data[x_index] * seg.data[x_index]; yy += (double) seg.data[y_index] * seg.data[y_index]; xy += (double) seg.data[x_index] * seg.data[y_index]; } /* low amplitude segment represents silence */ if (abs (x_max) + abs (x_min) < 2 * paras->Tsilent || abs (y_max) + abs (y_min) < 2 * paras->Tsilent) { for (q = 0; q < p_cc->size; p_cc->coeff[q++] = 0.0); prev_pf = p_status->pitch_freq; p_status->pitch_freq = BREAK_NUMBER; p_status->v_uv = SILENT; p_status->s_h = SEND; p_status->cc_max = 0.0; return; } /* determine first correlation coefficients, for period n = Nmin */ p_cc->coeff[0] = p_status->cc_max = xy / sqrt (xx) / sqrt (yy); for (q = 1; q < p_cc->size && q < paras->L; p_cc->coeff[q++] = 0.0); total_zxs = seg1_zxs + seg2_zxs; prev_sign = p_cc->coeff[0] < 0.0 ? -1 : 1; prev_seg1 = seg.data[paras->Nmax - paras->Nmin] < 0 ? -1 : 1; /* iteratively determine correlation coefficient for next possible period */ for (n = paras->Nmin + paras->L; n <= paras->Nmax; n += paras->L, j += paras->L) { x_index = paras->Nmax - n; y_index = paras->Nmax + j; /* does new samples in x or y segment represent an input zero-crossing */ if (seg.data[x_index] * prev_seg1 < 0) { prev_seg1 *= -1; total_zxs++; } if (seg.data[y_index] * prev_seg2 < 0) { prev_seg2 *= -1; total_zxs++; } /* determine next coefficient */ xx += (double) seg.data[x_index] * seg.data[x_index]; yy += (double) seg.data[y_index] * seg.data[y_index]; for (k = 0, xy = 0.0; k < n; k += paras->L) xy += (double) seg.data[paras->Nmax - n + k] * seg.data[paras->Nmax + k]; p_cc->coeff[n - paras->Nmin] = xy / sqrt (xx) / sqrt (yy); if (p_cc->coeff[n - paras->Nmin] > p_status->cc_max) p_status->cc_max = p_cc->coeff[n - paras->Nmin]; /* set unknown coefficients to zero */ for (q = n - paras->Nmin + 1; q < p_cc->size && q < n - paras->Nmin + paras->L; p_cc->coeff[q++] = 0.0); /* is there a slope with positive gradient in the coefficients track yet */ if (p_cc->coeff[n - paras->Nmin] > p_cc->coeff[n - paras->Nmin - paras->L]) lower_found = 1; /* has new coefficient resulted in a zero-crossing */ if (p_cc->coeff[n - paras->Nmin] * prev_sign < 0.0) { prev_sign *= -1; zx_rate++; } /* does the new coefficient represent a pitch period candidate */ if (N0 != 0 && zx_rate > zx_at_N0) { add_to_list (&sig_pks_hd, &sig_pks_tl, N0, 1); N0 = 0; max_cc = 0.0; } if (apply_bias && n > zx_lft_N && n < zx_rht_N) coeff_weight = 2.0; else coeff_weight = 1.0; if (p_cc->coeff[n - paras->Nmin] > max_cc && total_zxs > 3 && lower_found) { max_cc = p_cc->coeff[n - paras->Nmin]; if (max_cc * coeff_weight >= p_status->threshold) { zx_at_N0 = zx_rate; N0 = n; } } } /* unvoiced if no significant peak found in coefficients track */ if (sig_pks_hd == NULL) { prev_pf = p_status->pitch_freq; p_status->pitch_freq = BREAK_NUMBER; p_status->v_uv = UNVOICED; p_status->s_h = SEND; return; } /* find which significant peak in list corresponds to true pitch period */ sig_peak = sig_pks_hd; while (sig_peak != NULL) { yy = zz = yz = 0.0; for (j = 0; j < sig_peak->N0; j++) { y_index = paras->Nmax + j; z_index = paras->Nmax + sig_peak->N0 + j; yy += (double) seg.data[y_index] * seg.data[y_index]; zz += (double) seg.data[z_index] * seg.data[z_index]; yz += (double) seg.data[y_index] * seg.data[z_index]; } if (yy == 0.0 || zz == 0.0) coefficient = 0.0; else coefficient = yz / sqrt (yy) / sqrt (zz); if (apply_bias && sig_peak->N0 > zx_lft_N && sig_peak->N0 < zx_rht_N) coeff_weight = 2.0; else coeff_weight = 1.0; if (coefficient * coeff_weight >= p_status->threshold) { sig_peak->score = 2; if (head == NULL) { head = sig_peak; score = 2; } tail = sig_peak; } sig_peak = sig_peak->next_item; } if (head == NULL) head = sig_pks_hd; if (tail == NULL) tail = sig_pks_tl; N0 = head->N0; if (tail != head) { xx = 0.0; for (j = 0; j < tail->N0; j++) xx += (double) seg.data[paras->Nmax - tail->N0 + j] * seg.data[paras->Nmax - tail->N0 + j]; sig_peak = head; while (sig_peak != NULL) { if (sig_peak->score == score) { xz = zz = 0.0; for (j = 0; j < tail->N0; j++) { z_index = paras->Nmax + sig_peak->N0 + j; xz += (double) seg.data[paras->Nmax - tail->N0 + j] * seg.data[z_index]; zz += (double) seg.data[z_index] * seg.data[z_index]; } coefficient = xz / sqrt (xx) / sqrt (zz); if (sig_peak == head) max_cc = coefficient; else if (coefficient * paras->Tdh > max_cc) { N0 = sig_peak->N0; max_cc = coefficient; } } sig_peak = sig_peak->next_item; } } p_status->cc_max = p_cc->coeff[N0 - paras->Nmin]; /* voiced segment period now found */ if ((tail == head && score == 1 && p_status->v_uv != VOICED) || p_cc->coeff[N0 - paras->Nmin] < p_status->threshold) p_status->s_h = HOLD; else p_status->s_h = SEND; /* find left and right boundaries of peak in coefficients track */ zx_lft_N = zx_rht_N = 0; for (q = N0; q >= paras->Nmin; q -= paras->L) if (p_cc->coeff[q - paras->Nmin] < 0.0) { zx_lft_N = q; break; } for (q = N0; q <= paras->Nmax; q += paras->L) if (p_cc->coeff[q - paras->Nmin] < 0.0) { zx_rht_N = q; break; } /* define small region around peak */ if (N0 - paras->L < paras->Nmin) { N1 = N0; N2 = N0 + 2 * paras->L; } else if (N0 + paras->L > paras->Nmax) { N1 = N0 - 2 * paras->L; N2 = N0; } else { N1 = N0 - paras->L; N2 = N0 + paras->L; } /* compensate for decimation factor L */ if (paras->L != 1) { xx = yy = xy = 0.0; for (j = 0; j < N1; j++) { x_index = paras->Nmax - N1 + j; y_index = paras->Nmax + j; xx += (double) seg.data[x_index] * seg.data[x_index]; xy += (double) seg.data[x_index] * seg.data[y_index]; yy += (double) seg.data[y_index] * seg.data[y_index]; } p_cc->coeff[N1 - paras->Nmin] = p_status->cc_max = xy / sqrt (xx) / sqrt (yy); N0 = N1; for (n = N1 + 1; n <= N2; n++, j++) { xx += (double) seg.data[paras->Nmax - n] * seg.data[paras->Nmax - n]; yy += (double) seg.data[paras->Nmax + j] * seg.data[paras->Nmax + j]; for (k = 0, xy = 0.0; k < n; k++) xy += (double) seg.data[paras->Nmax - n + k] * seg.data[paras->Nmax + k]; p_cc->coeff[n - paras->Nmin] = xy / sqrt (xx) / sqrt (yy); if (p_cc->coeff[n - paras->Nmin] > p_status->cc_max) { p_status->cc_max = p_cc->coeff[n - paras->Nmin]; N0 = n; } } } /* compensate for finite resolution in estimating pitch */ if (N0 - 1 < paras->Nmin || N0 == N1) N_ = N0; else if (N0 + 1 > paras->Nmax || N0 == N2) N_ = N0 - 1; else if (p_cc->coeff[N0 - paras->Nmin] - p_cc->coeff[N0 - paras->Nmin - 1] < p_cc->coeff[N0 - paras->Nmin] - p_cc->coeff[N0 - paras->Nmin + 1]) N_ = N0 - 1; else N_ = N0; xx_N = yy_N = xy_N = y1y1_N = xy1_N = yy1_N = 0.0; for (j = 0; j < N_; j++) { x_index = paras->Nmax - N_ + j; y_index = paras->Nmax + j; xx_N += (double) seg.data[x_index] * seg.data[x_index]; yy_N += (double) seg.data[y_index] * seg.data[y_index]; xy_N += (double) seg.data[x_index] * seg.data[y_index]; y1y1_N += (double) seg.data[y_index + 1] * seg.data[y_index + 1]; xy1_N += (double) seg.data[x_index] * seg.data[y_index + 1]; yy1_N += (double) seg.data[y_index] * seg.data[y_index + 1]; } beta = (xy1_N * yy_N - xy_N * yy1_N) / (xy1_N * (yy_N - yy1_N) + xy_N * (y1y1_N - yy1_N)); if (beta < 0.0) { N_--; beta = 0.0; } else if (beta >= 1.0) { N_++; beta = 0.0; } else p_status->cc_max = ((1.0 - beta) * xy_N + beta * xy1_N) / sqrt (xx_N * ((1.0 - beta) * (1.0 - beta) * yy_N + 2.0 * beta * (1.0 - beta) * yy1_N + beta * beta * y1y1_N)); prev_pf = p_status->pitch_freq; p_status->pitch_freq = (double) (paras->sample_freq) / (double) (N_ + beta); p_status->v_uv = VOICED; free_list (&sig_pks_hd); return; } /************* * LEVEL TWO * ************/ void add_to_list (LIST_ **p_list_hd, LIST_ **p_list_tl, int N_val, int score_val) { LIST_ *new_node, *last_node; new_node = walloc(LIST_ ,1); last_node = *p_list_tl; new_node->N0 = N_val; new_node->score = score_val; new_node->next_item = NULL; if (*p_list_hd == NULL) *p_list_hd = new_node; else last_node->next_item = new_node; *p_list_tl = new_node; } /******************** * define functions * ********************/ /************* * LEVEL ONE * ************/ void error (error_flags err_type) { char prog[15]; /* program file name */ strcpy (prog, "srpd"); fprintf (stderr, "%s: ", prog); switch (err_type) { case CANT_WRITE: fprintf (stderr, "cannot write to output file"); break; case DECI_FCTR: fprintf (stderr, "decimation factor not set"); break; case INSUF_MEM: fprintf (stderr, "insufficient memory available"); break; case FILE_ERR: perror (""); break; case FILE_SEEK: fprintf (stderr, "improper fseek () to reposition a stream"); break; case LEN_OOR: fprintf (stderr, "artificial frame length set out of range"); break; case MAX_FREQ: fprintf (stderr, "maximum pitch frequency value (Hz) not set"); break; case MIN_FREQ: fprintf (stderr, "minimum pitch frequency value (Hz) not set"); break; case MISUSE: fprintf (stderr, "usage: %s -i lpf_sample_file ", prog); fprintf (stderr, "-o pitch_file [options]\n"); fprintf (stderr, "\nOptions {with default values}\n"); fprintf (stderr, "-a form pitch_file in ascii format\n"); fprintf (stderr, "-l 'lower pitch frequency limit' {%f (Hz)}\n", DEFAULT_MIN_PITCH); fprintf (stderr, "-u 'upper pitch frequency limit' {%f (Hz)}\n", DEFAULT_MAX_PITCH); fprintf (stderr, "-d 'decimation factor' {%d (samples)}\n", DEFAULT_DECIMATION); fprintf (stderr, "-n 'noise floor (abs. amplitude)' {%d}\n", DEFAULT_TSILENT); fprintf (stderr, "-h 'unvoiced to voiced coeff threshold' {%f}\n", DEFAULT_THIGH); fprintf (stderr, "-m 'min. voiced to unvoiced coeff threshold' {%f}\n", DEFAULT_TMIN); fprintf (stderr, "-r 'voiced to unvoiced coeff threshold ratio' {%f}\n", DEFAULT_TMAX_RATIO); fprintf (stderr, "-t 'anti pitch doubling/halving threshold' {%f}\n", DEFAULT_TDH); fprintf (stderr, "-p perform peak tracking\n"); fprintf (stderr, "-f 'sampling frequency' {%d (Hz)}\n", DEFAULT_SF); fprintf (stderr, "-s 'frame shift' {%f (ms)}\n", DEFAULT_SHIFT); fprintf (stderr, "-w 'artificial frame length' {%f (ms)}\n", DEFAULT_LENGTH); break; case NOISE_FLOOR: fprintf (stderr, "noise floor set below minimum amplitude"); break; case SAMPLE_FREQ: fprintf (stderr, "attempt to set sampling frequency negative"); break; case SFT_OOR: fprintf (stderr, "frame shift set out of range"); break; case THR_DH: fprintf (stderr, "anti pitch doubling/halving threshold not set"); break; case THR_HIGH: fprintf (stderr, "unvoiced to voiced coeff threshold not set"); break; case THR_MAX_RTO: fprintf (stderr, "voiced to unvoiced coeff threshold ratio not set"); break; case THR_MIN: fprintf (stderr, "minimum voiced to unvoiced coeff threshold not set"); break; default: fprintf (stderr, "undefined error, %u occurred", err_type); break; } fprintf (stderr, "\n"); exit (-1); } void initialise_parameters (struct Srpd_Op *p_par) { p_par->L = DEFAULT_DECIMATION; p_par->min_pitch = DEFAULT_MIN_PITCH; p_par->max_pitch = DEFAULT_MAX_PITCH; p_par->shift = DEFAULT_SHIFT; p_par->length = DEFAULT_LENGTH; p_par->Tsilent = DEFAULT_TSILENT; p_par->Tmin = DEFAULT_TMIN; p_par->Tmax_ratio = DEFAULT_TMAX_RATIO; p_par->Thigh = DEFAULT_THIGH; p_par->Tdh = DEFAULT_TDH; p_par->make_ascii = 0; p_par->peak_tracking = 0; p_par->sample_freq = DEFAULT_SF; /* p_par->Nmax and p_par->Nmin cannot be initialised */ return; } void initialise_structures (struct Srpd_Op *p_par, SEGMENT_ *p_seg, CROSS_CORR_ *p_cc) { p_par->Nmax = (int) ceil((float)p_par->sample_freq / p_par->min_pitch); p_par->Nmin = (int) floor((float)p_par->sample_freq / p_par->max_pitch); p_par->min_pitch = (float)p_par->sample_freq / (float)p_par->Nmax; p_par->max_pitch = (float)p_par->sample_freq / (float)p_par->Nmin; p_seg->size = 3 * p_par->Nmax; p_seg->shift = (int) rint( p_par->shift / 1000.0 * (float)p_par->sample_freq ); p_seg->length = (int) rint( p_par->length / 1000.0 * (float)p_par->sample_freq ); p_seg->data = walloc(short,p_seg->size); p_cc->size = p_par->Nmax - p_par->Nmin + 1; p_cc->coeff = walloc(double,p_cc->size); return; } void initialise_status (struct Srpd_Op *paras, STATUS_ *p_status) { p_status->pitch_freq = BREAK_NUMBER; p_status->v_uv = SILENT; p_status->s_h = SEND; /* SENT */ p_status->cc_max = 0.0; p_status->threshold = paras->Thigh; return; } void end_structure_use(SEGMENT_ *p_seg, CROSS_CORR_ *p_cc) { wfree (p_seg->data); wfree (p_cc->coeff); return; } #define BEGINNING 1 #define MIDDLE_ 2 #define END 3 int read_next_segment (FILE *voxfile, struct Srpd_Op *paras, SEGMENT_ *p_seg) { static int status = BEGINNING, padding= -1, tracklen = 0; int samples_read = 0; long init_file_position, offset; if (status == BEGINNING) { if (padding == -1) { if (fseek (voxfile, 0L, 2)) error (FILE_SEEK); tracklen = ((ftell (voxfile) / sizeof (short)) - p_seg->length) / p_seg->shift + 1; cout << "track len " << tracklen; rewind (voxfile); if (paras->Nmax < p_seg->length / 2) { offset = (long) (p_seg->length / 2 - paras->Nmax) * sizeof (short); if (fseek (voxfile, offset, 1)) error (FILE_SEEK); padding = 0; } else { if ((paras->Nmax - p_seg->length / 2) % p_seg->shift != 0) { offset = (long) (p_seg->shift - ((paras->Nmax - p_seg->length / 2) % p_seg->shift)) * sizeof (short); if (fseek (voxfile, offset, 1)) error (FILE_SEEK); } padding = (paras->Nmax - p_seg->length / 2) / p_seg->shift + ((paras->Nmax - p_seg->length / 2) % p_seg->shift == 0 ? 0 : 1); } } cout << "padding " << padding << endl; if (padding-- == 0) status = MIDDLE_; else if (tracklen-- <= 0) return (0); else return (2); } cout << "tl " << tracklen << endl; if (status == MIDDLE_) { if (tracklen > 0) { init_file_position = ftell (voxfile); offset = (long) (p_seg->shift * sizeof (short)); samples_read = fread ((short *) p_seg->data, sizeof (short), p_seg->size, voxfile); if (samples_read == p_seg->size) { if (fseek (voxfile, init_file_position + offset, 0)) error (FILE_SEEK); tracklen--; return (1); } else { status = END; } } else return (0); } if (status == END) { if (tracklen-- > 0) return (2); else return (0); } return (0); } int read_next_wave_segment(EST_Wave &sig, Srpd_Op *paras, SEGMENT_ *p_seg) { static int status = BEGINNING, padding = -1, tracklen = 0; int i; long offset; static int wave_pos; //printf("read: size %d shift %d length %d\n", p_seg->size, p_seg->shift, p_seg->length); if (status == BEGINNING) { if (padding == -1) { tracklen = (sig.num_samples() - p_seg->length) / p_seg->shift + 1; if (paras->Nmax < p_seg->length / 2) { offset = p_seg->length / 2 - paras->Nmax; wave_pos = offset; padding = 0; } else { if ((paras->Nmax - p_seg->length / 2) % p_seg->shift != 0) { offset = p_seg->shift - ((paras->Nmax - p_seg->length / 2)% p_seg->shift); wave_pos = offset; } padding = (paras->Nmax - p_seg->length / 2) / p_seg->shift + ((paras->Nmax - p_seg->length / 2) % p_seg->shift == 0 ? 0 : 1); } } if (padding-- == 0) status = MIDDLE_; else if (tracklen-- <= 0) { status = BEGINNING; padding = -1; tracklen = 0; return (0); } else return (2); } if (status == MIDDLE_) { if (tracklen > 0) { offset = p_seg->shift; for (i = 0; (i < p_seg->size) && (i+wave_pos)data[i] = sig.a(i + wave_pos,0); for ( ; i < p_seg->size; ++i) p_seg->data[i] = 0; if (wave_pos <= sig.num_samples()) { wave_pos += offset; tracklen--; return (1); } else status = END; } else { status = BEGINNING; padding = -1; tracklen = 0; return (0); } } if (status == END) { if (tracklen-- > 0) return (2); else { status = BEGINNING; padding = -1; tracklen = 0; return (0); } } status = BEGINNING; padding = -1; tracklen = 0; return (0); } void write_track(STATUS_ status, struct Srpd_Op paras, FILE *outfile) { if (paras.make_ascii) { if (fprintf(outfile,"%7g\n",status.pitch_freq) != 8) error(CANT_WRITE); } else if (!fwrite ((double *) &status.pitch_freq, sizeof (double), 1, outfile)) error (CANT_WRITE); return; } void free_list (LIST_ **p_list_hd) { LIST_ *next; while (*p_list_hd != NULL) { next = (*p_list_hd)->next_item; wfree (*p_list_hd); *p_list_hd = next; } } speech_tools/sigpr/pda/array_smoother.h0000644000076400007640000000727607262605664017011 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Bagshaw */ /* Date : 1993 */ /*************************************************************************/ /* */ /* The above copyright was given by Paul Bagshaw, he retains */ /* his original rights */ /* */ /*************************************************************************/ #ifndef array_smoother_INCLUDED #define array_smoother_INCLUDED #define DEFAULT_DOUBLE 0 #define DEFAULT_HANNING 1 #define DEFAULT_EXTRAPOLATE 1 #define DEFAULT_MED_1 3 #define DEFAULT_MED_2 3 #define DEFAULT_WLEN 3 #define DEFAULT_BREAKER -9999.0 /*typedef struct { short smooth_double, apply_hanning; short extrapolate; int first_median, second_median, window_length; float breaker; } SETTINGS_; */ struct Ms_Op { /* median smoother operations */ int smooth_double; int apply_hanning; int extrapolate; int first_median; int second_median; int window_length; int interp; float breaker; }; void array_smoother (float *p_array, int arraylen, struct Ms_Op *ms); #endif speech_tools/sigpr/pda/srpd.h0000644000076400007640000001235010044502523014666 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1994 */ /*************************************************************************/ #ifndef __SRPD_H__ #define __SRPD_H__ #include /******************** * define constants * ********************/ #define MINARG 5 #define BREAK_NUMBER 0.0 #define DEFAULT_DECIMATION 4 /* samples */ #define DEFAULT_MIN_PITCH 40.0 /* Hz */ #define DEFAULT_MAX_PITCH 400.0 /* Hz */ #define DEFAULT_SF 20000 /* Hz. Sampling Frequency */ #define DEFAULT_SHIFT 5.0 /* ms */ #define DEFAULT_LENGTH 10.0 /* ms */ #define DEFAULT_TSILENT 120 /* max. abs sample amplitude of noise */ #define DEFAULT_TMIN 0.75 #define DEFAULT_TMAX_RATIO 0.85 #define DEFAULT_THIGH 0.88 #define DEFAULT_TDH 0.77 #define UNVOICED 0 /* segment classifications */ #define VOICED 1 #define SILENT 2 #define HOLD 1 #define HELD 1 #define SEND 2 #define SENT 2 /****************************** * define abstract data types * ******************************/ typedef struct { int size; double *coeff; } CROSS_CORR_; typedef struct { /* segment of speech data */ int size, shift, length; /* in samples */ short *data; } SEGMENT_; struct Srpd_Op { int sample_freq; /* Hz */ int Nmax, Nmin; double shift, length; /* ms */ double min_pitch; /* Hz */ double max_pitch; /* Hz */ int L; /* Decimation factor (samples) */ double Tmin, Tmax_ratio, Thigh, Tdh; int Tsilent; int make_ascii; int peak_tracking; }; typedef struct status { double pitch_freq; char v_uv, s_h; double cc_max, threshold; } STATUS_; typedef struct list { int N0, score; struct list *next_item; } LIST_; typedef enum { CANT_WRITE, DECI_FCTR, INSUF_MEM, FILE_ERR, FILE_SEEK, LEN_OOR, MAX_FREQ, MIN_FREQ, MISUSE, NOISE_FLOOR, SAMPLE_FREQ, SFT_OOR, THR_DH, THR_HIGH, THR_MAX_RTO, THR_MIN } error_flags; void add_to_list (LIST_ **p_list_hd, LIST_ **p_list_tl, int N_val, int score_val); void super_resolution_pda (struct Srpd_Op *paras, SEGMENT_ seg, CROSS_CORR_ *p_cc, STATUS_ *p_status); void write_track(STATUS_ status, struct Srpd_Op paras, FILE *outfile); int read_next_segment (FILE *voxfile, struct Srpd_Op *paras, SEGMENT_ *p_seg); void end_structure_use(SEGMENT_ *p_seg, CROSS_CORR_ *p_cc); void initialise_status (struct Srpd_Op *p, STATUS_ *p_status); void initialise_structures (struct Srpd_Op *p, SEGMENT_ *p_seg, CROSS_CORR_ *p_cc); void initialise_parameters (struct Srpd_Op *p_par); void error (error_flags err_type); void free_list (LIST_ **p_list_hd); #endif // __SRPD_H__ speech_tools/sigpr/pda/Makefile0000644000076400007640000000560507262605664015234 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Pitch Detection Routines Makefile # # # #=========================================================================# TOP=../.. DIRNAME=sigpr/pda H = array_smoother.h srpd.h LOCAL_DEFAULT_LIBRARY = estbase CPPSRCS = pcb_smoother.cc smooth_pda.cc pda.cc srpd1.3.cc CSRCS = SRCS = $(CPPSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) $(H) Makefile ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/stats/EST_cluster.cc0000644000076400007640000003262711465017156015542 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Event RFC labelling */ /* */ /*=======================================================================*/ #include #include "EST_system.h" #include "EST_FMatrix.h" #include "EST_cluster.h" #include #include "EST_string_aux.h" #include int fn_cluster(EST_FMatrix &m, EST_CBK &cbk, float d); int nn_cluster(EST_FMatrix &m, EST_CBK &cbk, float d); int nn_cluster2(EST_FMatrix &m, EST_CBK &cbk, float d); float lval(EST_FMatrix &a, float floor, int &row, int &col); float nn_cluster3(EST_FMatrix &m, EST_CBK &cbk, EST_String method); void init_cluster(EST_CBK &cbk, int n) { int i; EST_TList tmp; for (i = 0; i < n; ++i) { tmp.clear(); tmp.append(i); cbk.append(tmp); } } int cluster(EST_FMatrix &m, EST_CBK &cbk, EST_TList &ans, EST_String method, EST_TList &names) { float dist; while (cbk.length() > 1) { dist = nn_cluster3(m, cbk, method); ans.append(print_codebook(cbk, dist, names)); } return 0; } // return true if list l contains integer n int contains(EST_TList &l, int n) { EST_Litem *p; for (p = l.head(); p != 0; p = p->next()) if (l(p) == n) return 1; return 0; } void remove_distances(EST_FMatrix &d , EST_TList &group) { EST_Litem *pi, *pj; int i, j; for (i = 0, pi = group.head(); pi != 0; pi = pi->next(), ++i) for (j = 0, pj = group.head(); pj != 0; pj = pj->next(), ++j) d(group(pi), group(pj)) = 0.0; } /*EST_FMatrix remove_line(Fmatrix a, int r) { int n; n = a.num_rows() - 1; Fmatrix b(n, n); int i, j; for (i = i2 = 0; i < n; ++i. ++i2) for (j = j2 = 0; j < n; ++j, ++j2) if (i == r) ; */ void collapse(EST_FMatrix &d, EST_CBK &cbk, int row, int col) { EST_Litem *pi, *pj; for (pi = cbk.head(); pi != 0; pi = pi->next()) if (contains(cbk(pi), row)) break; for (pj = cbk.head(); pj != 0; pj = pj->next()) if (contains(cbk(pj), col)) break; cbk(pi) += cbk(pj); remove_distances(d, cbk(pi)); cbk.remove(pj); } float min(float a, float b) { return (a < b) ? a: b; } float max(float a, float b) { return (a > b) ? a: b; } // combine codebook groups "row" and "col" into one group and calculate a // new distance matrix void collapse3(EST_FMatrix &d, EST_CBK &cbk, int row, int col, EST_String method) { int i; EST_Litem *pi; EST_TList v; float fm; cout << "Removing row/column " << col << endl; cout << "row " <next()) { if (method == "nearest") fm = min(d(row,v(pi)),d(col,v(pi))); else if (method == "furthest") fm = max(d(row,v(pi)),d(col,v(pi))); else fm = min(d(row,v(pi)),d(col,v(pi))); cout << "writing values to " << v(pi) << ", " << row << " min " << fm << endl; d(v(pi), row) = fm; d(row, v(pi)) = fm; } d = sub(d, col, col); cbk.remove_nth(col); } int nn_cluster2(EST_FMatrix &m, EST_CBK &cbk, float d) { static float smallest = 0.0; int row=0, col=0; (void)d; // Change so that all values aprt from lowest in codebook get set to // Nan (or whatever) smallest = lval(m, smallest, row, col); cout << "smallest = " << smallest << endl; cout << "row = " << row << " col " << col << endl; collapse(m, cbk, row, col); for (EST_Litem *p = cbk.head(); p != 0; p = p->next()) cout << cbk(p); cout << "New matrix\n" << m; // cout << cbk; return 1; } float nn_cluster3(EST_FMatrix &m, EST_CBK &cbk, EST_String method) { static float smallest = 0.0; int row=0, col=0; // Change so that all values aprt from lowest in codebook get set to // Nan (or whatever) cout << "analysing matrix\n" << m; smallest = lval(m, smallest, row, col); cout << "smallest = " << smallest << endl; cout << "row = " << row << " col " << col << endl; collapse3(m, cbk, row, col, method); for (EST_Litem *p = cbk.head(); p != 0; p = p->next()) cout << cbk(p); cout << "New matrix\n" << m << endl << endl; // cout << cbk; return smallest; } int nn_cluster(EST_FMatrix &m, EST_CBK &cbk, float d) { int i; EST_Litem *pi, *pj; float smallest; int c = 0; i = 0; for (pi = cbk.head(); pi != 0; pi = pi->next(), ++i) { for (pj = pi->next(); pj != 0; pj = pj->next()) { smallest = lowestval(m, cbk(pj), cbk(pi)); if (smallest < d) { cbk(pi) += cbk(pj); cbk(pj).clear(); } } } for (pi = cbk.head(); pi != 0; pi = pi->next()) { if (cbk(pi).empty()) { cout << "Empty entry\n"; pi = cbk.remove(pi); c = 1; } else cout << cbk(pi); } return c; } int fn_cluster(EST_FMatrix &m, EST_CBK &cbk, float d) { int i; EST_Litem *pi, *pj; float smallest; int c = 0; i = 0; for (pi = cbk.head(); pi != 0; pi = pi->next(), ++i) { for (pj = pi->next(); pj != 0; pj = pj->next()) { smallest = highestval(m, cbk(pj), cbk(pi)); if (smallest < d) { cbk(pi) += cbk(pj); cbk(pj).clear(); } } } for (pi = cbk.head(); pi != 0; pi = pi->next()) { if (cbk(pi).empty()) { cout << "Empty entry\n"; pi = cbk.remove(pi); c = 1; } else cout << cbk(pi); } return c; } static int sorttest(const void *a, const void *b) { // for use with qsort C library function. float *c = (float *)a; float *d = (float *)b; float res = (*c - *d); if (res == 0.0) return 0; return (res < 0.0) ? -1 : 1; } EST_FVector sort_matrix(EST_FMatrix &m) { int i, j, k; float *v; int n_vals; // determine size of triangular part of matrix, excluding diagonal int size = m.num_rows() - 1; n_vals = 0; for (i = 0; i < size; ++i) n_vals+=(i + 1); cout<<"number of values in EST_FMatrix:" << n_vals << " size " << size << endl; v = new float[n_vals]; for (i = k = 0; i < m.num_rows(); ++i) for (j = i + 1; j < m.num_columns(); ++j, ++k) { cout << i << " " << j << " " << k << " " << (i * size) + k << endl; v[k] = m(j, i); } for (i = 0; i < n_vals; ++i) cout << "v[" << i << "] = " << v[i] << endl; qsort(v, n_vals, sizeof(float), sorttest); EST_FVector vsort(n_vals); for (i = 0; i < n_vals; ++i) vsort[i] = v[i]; return vsort; } EST_String print_codebook(EST_CBK &cbk, float d, EST_TList &names) { EST_Litem *pi; EST_Litem *pj; EST_String s; s = ftoString(d) + " "; for (pi = cbk.head(); pi != 0; pi = pi->next()) { s += "("; for (pj = cbk(pi).head(); pj != 0; pj = pj->next()) { if (names.empty()) s += itoString(cbk.item(pi).item(pj)); else s += names.nth(cbk.item(pi).item(pj)); if (pj->next() != 0) s += " "; } s += ") "; } return s; } void cluster3(EST_FMatrix &m, float d) { int n = m.num_rows(); EST_TList oldcbk[12]; int i, j; float smallest; for (i = 0; i < n; ++i) oldcbk[i].append(i); for (i = 0; i < n; ++i) cout << "n: " << i << " " << oldcbk[i] << endl; for (i = 0; i < n; ++i) for (j = i + 1; j < n; ++j) { smallest = lowestval(m, oldcbk[j], oldcbk[i]); cout << "smallest = " << smallest << " d= " << d << endl << endl; if (smallest < d) { cout << "merging " << i << " " << j << endl << endl; merge(oldcbk, i, j); n--; } } for (i = 0; i < n; ++i) cout << "n: " << i << " " << oldcbk[i] << endl; } /* int cluster2(EST_FMatrix &dist, float d) { int n = dist.num_frames(); EST_TList oldcbk[12]; EST_TList newcbk[12]; float sortval = {2.0, 3.0, 4.0, 5.0, 6.0}; int i, j, n, m; EST_Litem *p; for (i = 0; i < n; ++i) oldcbk[i].append(i); i = 0; while (n > 2) { s = findval(dist, m, n, sortval[i++]); merge9u } } float findval(EST_FMatrix &dist, int &n, int &m, float val) { int i, j; for (i = 0; i < m.num_frames(); ++i) for (j = 0; j < m.order(); ++j) if ((m.x[i][j] < (val + 0.001)) && (m.x[i][j] > (val - 0.001))) return; cerr << "Couldn't find value " << val << endl; } */ float lowestval(EST_FMatrix &m, EST_TList &a, EST_TList &b) { EST_Litem *pa, *pb; float lowest = 100000.0; cout << "list a:" << a << "list b:" << b; for (pa = a.head(); pa != 0; pa = pa->next()) for (pb = b.head(); pb != 0; pb = pb->next()) { // cout << "m:" << a(pa) << " " << b(pb) << " " << m.x[a(pa)][b(pb)] << endl; if (m(a(pa), b(pb)) < lowest) lowest = m(a(pa), b(pb)); } // cout << "lowest " << lowest << endl; return lowest; } // find the lowest value in matrix a above floor, and return it. Also // set row and column to be the indices of it. float lval(EST_FMatrix &a, float floor, int &row, int &col) { int i, j; float lowest = FLT_MAX; for (i = 0; i < a.num_rows(); ++i) for (j = 0; j < a.num_rows(); ++j) if ((a(i, j) < lowest) && (a(i, j) > floor)) { lowest = a(i, j); row = i; col = j; } return lowest; } float highestval(EST_FMatrix &m, EST_TList &a, EST_TList &b) { EST_Litem *pa, *pb; float h = 0.0; cout << "list a:" << a << "list b:" << b; for (pa = a.head(); pa != 0; pa = pa->next()) for (pb = b.head(); pb != 0; pb = pb->next()) { if (m(a(pa), b(pb)) > h) h = m(a(pa), b(pb)); } // cout << "lowest " << lowest << endl; return h; } /* float nearest(EST_FMatrix &m, EST_TList &cbk) { EST_Litem *p; float lowest = 100000.0; for (p = cbk.head(); p != 0; p = p->next()) { cout << "cbk(p) " << cbk(p) << endl; if (cbk(p) < lowest) lowest = cbk(p); } cout << "lowest = " << lowest << endl; return lowest; } */ void merge(EST_TList cbk[], int i, int j) { EST_Litem *p; for (p = cbk[j].head(); p != 0; p = p->next()) cbk[i].append(cbk[j].item(p)); cbk[j].clear(); } int load_names(EST_String file, EST_TList &names) { char inbuf[1000]; EST_String tmpstr; ifstream inf(file); if (!inf) cerr << "Can't open names file " << file << endl; while(inf.getline(inbuf, 1000)) { tmpstr = inbuf; names.append(tmpstr); } return 0; } /*int merge(EST_TList &a, EST_TList &b) { EST_TList newgroup; EST_Litem *p; for (p = cbk[j].head(); p != 0; p = p->next()) cbk[i].append(cbk[j].item(p)); cbk[j].clear(); } */ speech_tools/stats/EST_multistats.cc0000644000076400007640000001631310127000721016244 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Basic Multivariate Statistical Functions */ /* */ /*=======================================================================*/ #include #include "EST_multistats.h" float mean(EST_FVector &v) { int i; float u = 0.0; for (i = 0; i < v.n(); ++i) u += v(i); return u / v.n(); } float sum(EST_FVector &v) { int i; float u = 0.0; for (i = 0; i < v.n(); ++i) u += v(i); return u; } EST_FVector mean(EST_FMatrix &m) { EST_FVector u(m.num_columns()); int i, j; for (i = 0; i < m.num_columns(); ++i) { u[i] = 0.0; for (j = 0; j < m.num_rows(); ++j) u[i] += m(j, i); u[i] /= m.num_rows(); } return u; } EST_FVector sample_variance(EST_FMatrix &m) { EST_FVector v(m.num_columns()); EST_FVector u(m.num_columns()); int i, j; u = mean(m); for (j = 0; j < m.num_columns(); ++j) { v[j] = 0.0; for (i = 0; i < m.num_rows(); ++i) v[j] += pow(m(i, j) - u(j), float(2.0)); v[j] /= m.num_rows() - 1; // sample variance } return v; } EST_FVector sample_stdev(EST_FMatrix &m) { EST_FVector v; v = sample_variance(m); int j; for (j = 0; j < v.n(); ++j) v[j] = sqrt(v(j)); return v; } EST_FMatrix sample_covariance(EST_FMatrix &m) { EST_FVector u(m.num_columns()); EST_FMatrix c(m.num_columns(), m.num_columns()); int i, j, k; u = mean(m); for (j = 0; j < m.num_columns(); ++j) for (k = 0; k < m.num_columns(); ++k) { c(j, k) = 0.0; for (i = 0; i < m.num_rows(); ++i) c(j, k) += (m(i, j) - u(j)) * (m(i, k) - u(k)); c(j, k) /= m.num_rows(); } return c; } EST_FMatrix sample_correlation(EST_FMatrix &m) { EST_FMatrix r(m.num_columns(), m.num_columns()); EST_FVector s = sample_stdev(m); EST_FMatrix c = sample_covariance(m); int j, k; for (j = 0; j < m.num_columns(); ++j) for (k = 0; k < m.num_columns(); ++k) r(j, k) = c(j, k)/(s(j) * s(k)); return r; } EST_FMatrix euclidean_distance(EST_FMatrix &m) { // nowt yet return m; } // normalise matrix m, by subtracting vector "sub" from each column and // then dividing each column by vector div; EST_FMatrix normalise(EST_FMatrix &m, EST_FVector &sub, EST_FVector &div) { int i, j; EST_FMatrix z(m.num_rows(), m.num_columns()); for (j = 0; j < m.num_columns(); ++j) for (i = 0; i < m.num_rows(); ++i) z(i, j) = (m(i, j) - sub(j)) / div(j); return z; } // calculate penrose distance for matrix of means gu of p variables // (columns) in g populations (columns), and variance gv. EST_FMatrix penrose_distance(EST_FMatrix &gu, EST_FVector &gv) { int i, j, k; int p = gu.num_columns(); int n = gu.num_rows(); EST_FMatrix P(n, n); cout << "pop mean " << gu; for (i = 0; i < n; ++i) for (j = 0; j < n; ++j) { P(i, j) = 0.0; for (k = 0; k < p; ++k) P(i, j) += pow(gu(i, k) - gu(j, k), float(2.0)) / gv(k); P(i, j) /= p; } return P; } float single_mahal(EST_FMatrix &ui, EST_FMatrix &uj, EST_FMatrix &invv) { float e; EST_FMatrix a, b,c,d; a = ui - uj; transpose(a,b); multiply(b,invv,c); multiply(c,a,d); e = d(0,0); return e; } EST_FMatrix mahalanobis_distance(EST_FMatrix &gu, EST_FMatrix &covar) { int i, j; int n = gu.num_rows(); EST_FMatrix P(n, n), invv, ui, uj; inverse(covar,invv); // should be inverse!! for (i = 0; i < n; ++i) for (j = 0; j < n; ++j) { transpose(row(gu, i),ui); transpose(row(gu, j),uj); P(i, j) = single_mahal(ui, uj, invv); } return P; } float simple_penrose(EST_FVector &ui, EST_FVector &uj, EST_FVector &v) { int k; int n = uj.n(); float P = 0.0; for (k = 0; k < n; ++k) P += pow(ui(k) - uj(k), float(2.0)) / v(k); P /= n; return P; } EST_FMatrix population_mean(EST_FMatrix *in, int num_pop) { int i, k; EST_FMatrix pmean(num_pop, in[0].num_columns()); EST_FVector u(in[0].num_columns()); for (i = 0; i < num_pop; ++i) { u = mean(in[i]); for (k =0; k < in[i].num_columns(); ++k) pmean(i, k) = u(k); } return pmean; } EST_FMatrix add_populations(EST_FMatrix *in, int num_pop) { int i, j, k, l, n; l = 0; for (i = 0; i < num_pop; ++i) l += in[i].num_rows(); n = in[0].num_columns(); EST_FMatrix msum(l, n); for (k = l = 0; k < num_pop; ++k) for (j =0; j < n; ++j, ++l) for (i = 0; i < in[i].num_rows(); ++i) msum(l, j) = in[k](i, j); return msum; } speech_tools/stats/confusion.cc0000644000076400007640000001265011465017156015343 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* Confusion Matrix Calculation */ /* */ /*=======================================================================*/ #include #include "EST_multistats.h" #include "EST_math.h" #include "EST_types.h" int nth(EST_String name, EST_TList &lex) { EST_Litem *p; int i; for (i = 0, p = lex.head(); p!=0; p = p->next(), ++i) if (name == lex(p)) return i; cerr << "Item " << name << " not found in word list\n"; return -1; } EST_FMatrix confusion(EST_StrStr_KVL &list, EST_StrList &lex) { EST_FMatrix a(lex.length(), lex.length()); EST_Litem *p; int n, m; a.fill(0.0); for (p = list.list.head(); p!=0; p = p->next()) { m = nth(list.key(p), lex); n = nth(list.val(p), lex); if ((n != -1) && (m != -1)) a(m, n) = a(m, n) + 1; } return a; } void print_confusion(const EST_FMatrix &a, EST_StrStr_KVL &list, EST_StrList &lex) { int i, j; EST_Litem *p; cout << " "; (void)list; int n = a.num_rows(); EST_FVector row_total(n); EST_FVector col_total(n); EST_FVector correct(n); for (i = 0; i < n; ++i) { row_total[i] = 0.0; for (j = 0; j < n; ++j) row_total[i] += a(i, j); } for (j = 0; j < n; ++j) { col_total[j] = 0.0; for (i = 0; i < n; ++i) col_total[j] += a(i, j); } for (i = 0; i < n; ++i) { float rt = row_total(i); if (rt == 0) correct[i] = 100; else correct[i] = 100.0 * a(i, i) / rt; } for (p = lex.head(); p != 0; p = p->next()) { // cout.width(4); // cout.setf(ios::right); cout << lex(p).before(3) << " "; } cout << endl; for (p = lex.head(), i = 0; i < n; ++i, p = p->next()) { cout.width(12); cout << lex(p); for (j = 0; j < n; ++j) { cout.width(4); cout.precision(3); cout.setf(ios::right); cout.setf(ios::fixed, ios::floatfield); cout << ( (int) a(i, j) ) << " "; } cout.width(4); cout << (int)row_total(i) << " "; cout.width(4); cout.setf(ios::right); cout << "[" << ((int)a(i, i)) << "/" << ((int)row_total(i)) << "]"; cout.width(12); cout.precision(3); cout.setf(ios::right); // cout.setf(ios::fixed, ios::floatfield); if (isnanf(correct(i))) cout << endl; else cout << correct(i) << endl; } cout << " "; for (j = 0; j < n; ++j) { cout.width(4); cout << ((int)col_total(j)) << " "; } cout << endl; // work out total correct EST_FMatrix b; float s, t, pp; t = sum(a); b = diagonalise(a); s = sum(b); if (s == 0) pp = 0; else if (t == 0) pp = 100.0; // probably can't happen else pp = 100.0 * s/t; cout << "total " << ((int)t) << " correct " << s << " " << pp << "%"<< endl; } speech_tools/stats/EST_Discrete.cc0000644000076400007640000001326711465017156015622 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* Discretes for mapping between alphabets and indexes */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_String.h" #include "EST_simplestats.h" static void Discrete_val_delete_funct(void *d) { delete (int *)d; } EST_Discrete::~EST_Discrete() { nametrie.clear(Discrete_val_delete_funct); } EST_Discrete::EST_Discrete(const EST_StrList &vocab) { if(!init(vocab)) { cerr << "WARNING from EST_Discrete ctor : invalid vocab list !"; nametrie.clear(Discrete_val_delete_funct); namevector.resize(0); } } void EST_Discrete::copy(const EST_Discrete &d) { int i; p_def_val = d.p_def_val; nametrie.clear(Discrete_val_delete_funct); namevector = d.namevector; for (i=0; inext()){ namevector[i] = vocab(w); tmp = new int; *tmp = i; // check for repeated items - just not allowed if(nametrie.lookup(vocab(w)) != NULL) { cerr << "EST_Discrete : found repeated item '"; cerr << vocab(w) << "' in vocab list !" << endl; return false; } nametrie.add(vocab(w),tmp); } return true; } bool EST_Discrete::operator ==(const EST_Discrete &d) { // assume, if name vectors are the same, the stringtries // are too return (bool)(namevector == d.namevector); } bool EST_Discrete::operator !=(const EST_Discrete &d) { return (bool)(namevector != d.namevector); } EST_String EST_Discrete::print_to_string(int quote) { EST_String s = ""; EST_String sep = ""; static EST_Regex needquotes(".*[()'\";., \t\n\r].*"); int i; for(i=0;i #include #include #include #include #include "EST_String.h" #include "EST_TKVL.h" #include "EST_simplestats.h" /* We share ints and pointers for two types of probability distributions */ /* The know discrete sets can be indexed by ints which is *much* faster */ /* the indices pass around a pointers but the lower part contain ints in */ /* the discrete case */ /* On 64bit architectures this is a issue so we need have some macros */ /* to help us here. */ const int est_64to32(void *c) { /* this returns the bottom end of the pointer as an unsigned int */ /* I believe this is a safe way to do it, we check the bits in the */ /* 64 bit int and multiply them out in the 32 bit one */ /* there might be better ways, but I think you'd need to think about */ /* byte order then */ long long l; int d; int i,x; l = (long long)c; for (i=0,d=0,x=1; i<24; i++) { if (l & 1) d += x; l = l >> 1; x += x; } return d; } /* #define tprob_int(X) ((sizeof(void *) != 8) ? est_64to32(X) : (int)X) */ #define tprob_int(X) (est_64to32(X)) EST_DiscreteProbDistribution::EST_DiscreteProbDistribution(const EST_Discrete *d, const double n_samples, const EST_DVector &counts) { type = tprob_discrete; discrete = d; num_samples = n_samples; icounts = counts; } EST_DiscreteProbDistribution::EST_DiscreteProbDistribution(const EST_DiscreteProbDistribution &b) { copy(b); } void EST_DiscreteProbDistribution::copy(const EST_DiscreteProbDistribution &b) { type = b.type; num_samples = b.num_samples; discrete = b.discrete; icounts = b.icounts; scounts = b.scounts; } void EST_DiscreteProbDistribution::clear(void) { icounts.resize(0); } void EST_DiscreteProbDistribution::init(void) { type = tprob_string; num_samples = 0; discrete = 0; } bool EST_DiscreteProbDistribution::init(const EST_StrList &vocab) { int i; clear(); type = tprob_discrete; num_samples = 0; discrete = new EST_Discrete(vocab); icounts.resize(vocab.length()); for (i=0; ilength()); for (i=0; iindex(s); icounts[idx] += count; } else // its a (slow) string type { for (p=scounts.list.head(); p != 0; p=p->next()) { if (scounts.list(p).k == s) { scounts.list(p).v += count; break; } } if (p == 0) // first occurrence scounts.add_item(s,count,1); // add without search } num_samples += count; } const EST_String &EST_DiscreteProbDistribution::most_probable(double *prob) const { EST_Litem *p,*t; double max = 0; if (type == tprob_discrete) { int i,pt=-1; for (i=0; i < icounts.length(); i++) if (icounts.a_no_check(i) > max) { pt = i; max = icounts.a_no_check(i); } if (max == 0) { if(prob != NULL) *prob = 0.0; return EST_String::Empty; } else { if(prob != NULL) *prob = probability(pt); return discrete->name(pt); } } else { t = 0; for (p=scounts.list.head(); p != 0; p=p->next()) if (scounts.list(p).v > max) { t = p; max = scounts.list(p).v; } if (max == 0) { if(prob != NULL) *prob = 0.0; return EST_String::Empty; } else { if(prob != NULL) *prob = (double)max/num_samples; return scounts.list(t).k; } } } double EST_DiscreteProbDistribution::probability(const EST_String &s) const { if (frequency(s) == 0.0) return 0.0; else return (double)frequency(s)/num_samples; } double EST_DiscreteProbDistribution::probability(const int i) const { if (frequency(i) == 0.0) return 0.0; else return (double)frequency(i)/num_samples; } double EST_DiscreteProbDistribution::frequency(const EST_String &s) const { if (type == tprob_discrete) return icounts.a_no_check(discrete->index(s)); else return scounts.val_def(s,0); } double EST_DiscreteProbDistribution::frequency(const int i) const { if (type == tprob_discrete) return icounts(i); else { cerr << "ProbDistribution: can't access string type pd with int\n"; return 0; } } void EST_DiscreteProbDistribution::set_frequency(const EST_String &s,double c) { if (type == tprob_discrete) { num_samples -= icounts.a_no_check(discrete->index(s)); num_samples += c; icounts.a_no_check(discrete->index(s)) = c; } else { num_samples -= scounts.val_def(s,0); num_samples += c; scounts.add_item(s,c); } } void EST_DiscreteProbDistribution::set_frequency(int i,double c) { if (type == tprob_discrete) { num_samples -= icounts[i]; num_samples += c; icounts[i] = c; } else { cerr << "ProbDistribution: can't access string type pd with int\n"; } } void EST_DiscreteProbDistribution::set_frequency(EST_Litem *i,double c) { if (type == tprob_discrete) { num_samples -= icounts[tprob_int(i)]; num_samples += c; icounts[tprob_int(i)] = c; } else { cerr << "ProbDistribution: can't access string type pd with int\n"; } } void EST_DiscreteProbDistribution::override_frequency(const EST_String &s,double c) { if (type == tprob_discrete) icounts.a_no_check(discrete->index(s)) = c; else scounts.add_item(s,c); } void EST_DiscreteProbDistribution::override_frequency(int i,double c) { if (type == tprob_discrete) icounts[i] = c; else cerr << "ProbDistribution: can't access string type pd with int\n"; } void EST_DiscreteProbDistribution::override_frequency(EST_Litem *i,double c) { if (type == tprob_discrete) icounts[tprob_int(i)] = c; else cerr << "ProbDistribution: can't access string type pd with int\n"; } double EST_DiscreteProbDistribution::entropy() const { // Returns the entropy of the current distribution double e=0.0; EST_Litem *p; int i; if (type == tprob_discrete) { for (i=0; i < icounts.length(); i++) { double prob = icounts.a_no_check(i)/num_samples; if (prob != 0.0) e += prob * log(prob); /* log10(prob)/log10(2) */ } } else { for (p=scounts.list.head(); p != 0; p=p->next()) { double prob = scounts.list(p).v/num_samples; if (prob != 0.0) e += prob * log(prob); /* log10(prob)/log10(2) */ } } return -e; } // For iterating through members of a probability distribution EST_Litem *EST_DiscreteProbDistribution::item_start(void) const { if (type == tprob_discrete) return NULL; else return scounts.list.head(); } int EST_DiscreteProbDistribution::item_end(EST_Litem *idx) const { if (type == tprob_discrete) return (tprob_int(idx) >= icounts.length()); else return (idx == 0); } EST_Litem *EST_DiscreteProbDistribution::item_next(EST_Litem *idx) const { if (type == tprob_discrete) return (EST_Litem *)(((unsigned char *)idx)+1); else return idx->next(); } const EST_String &EST_DiscreteProbDistribution::item_name(EST_Litem *idx) const { if (type == tprob_discrete) return discrete->name(tprob_int(idx)); else return scounts.list(idx).k; } void EST_DiscreteProbDistribution::item_freq(EST_Litem *idx,EST_String &s,double &freq) const { if (type == tprob_discrete) { s = discrete->name(tprob_int(idx)); freq = icounts(tprob_int(idx)); } else { s = scounts.list(idx).k; freq = scounts.list(idx).v; } } void EST_DiscreteProbDistribution::item_prob(EST_Litem *idx,EST_String &s,double &prob) const { if (type == tprob_discrete) { prob = probability(tprob_int(idx)); s = discrete->name(tprob_int(idx)); } else { s = scounts.list(idx).k; prob = (double)scounts.list(idx).v/num_samples; } } ostream & operator<<(ostream &s, const EST_DiscreteProbDistribution &pd) { // Output best with probabilities EST_Litem *i; double prob; double sum=0; EST_String name; s << "("; for (i=pd.item_start(); !pd.item_end(i); i=pd.item_next(i)) { pd.item_prob(i,name,prob); s << "(" << name << "=" << prob << ") "; sum+=prob; } s << "best=" << pd.most_probable(&prob) << " samples=" << pd.samples() << " sum=" << sum << ")"; return s; } EST_DiscreteProbDistribution &EST_DiscreteProbDistribution::operator=(const EST_DiscreteProbDistribution &a) { // I'd much rather this was never called copy(a); return *this; } speech_tools/stats/EST_ols.cc0000644000076400007640000002365711142003617014646 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black (and lots of books) */ /* Date : January 1998 */ /*-----------------------------------------------------------------------*/ /* Ordinary Least Squares/Linear regression */ /* */ /*=======================================================================*/ #include #include "EST_multistats.h" #include "EST_simplestats.h" static void ols_load_selected_feats(const EST_FMatrix &X, const EST_IVector &included, EST_FMatrix &Xl); static int ols_stepwise_find_best(const EST_FMatrix &X, const EST_FMatrix &Y, EST_IVector &included, EST_FMatrix &coeffs, float &bscore, int &best_feat, const EST_FMatrix &Xtest, const EST_FMatrix &Ytest, const EST_StrList &feat_names ); int ols(const EST_FMatrix &X,const EST_FMatrix &Y, EST_FMatrix &coeffs) { // Ordinary least squares, X contains the samples with 1 (for intercept) // in column 0, Y contains the single values. EST_FMatrix Xplus; if (!pseudo_inverse(X,Xplus)) return FALSE; multiply(Xplus,Y,coeffs); return TRUE; } int robust_ols(const EST_FMatrix &X, const EST_FMatrix &Y, EST_FMatrix &coeffs) { EST_IVector included; int i; included.resize(X.num_columns()); for (i=0; i bscore) { bscore = fabs(cor); coeffs = coeffsl; best_feat = i; } included.a_no_check(i) = FALSE; } } return TRUE; } int ols_test(const EST_FMatrix &real, const EST_FMatrix &predicted, float &correlation, float &rmse) { // Others probably want this function too // return correlation and RMSE for col 0 in real and predicted int i; float p,r; EST_SuffStats x,y,xx,yy,xy,se,e; double error; double v1,v2,v3; if (real.num_rows() != predicted.num_rows()) return FALSE; // can't do this for (i=0; i < real.num_rows(); i++) { r = real(i,0); p = predicted(i,0); x += p; y += r; error = p-r; se += error*error; e += fabs(error); xx += p*p; yy += r*r; xy += p*r; } rmse = sqrt(se.mean()); v1 = xx.mean()-(x.mean()*x.mean()); v2 = yy.mean()-(y.mean()*y.mean()); v3 = v1*v2; if (v3 <= 0) { // happens when there's very little variation in x correlation = 0; rmse = se.mean(); return FALSE; } // Pearson's product moment correlation coefficient correlation = (xy.mean() - (x.mean()*y.mean()))/ sqrt(v3); // I hate to have to do this but it is necessary. // When the the variation of X is very small v1*v2 approaches // 0 (the negative and equals case is caught above) but that // may not be enough when v1 or v2 are very small but positive. // So I catch it here. If I knew more math I'd be able to describe // this better but the code would remain the same. if ((correlation <= 1.0) && (correlation >= -1.0)) return TRUE; else { correlation = 0; return FALSE; } } speech_tools/stats/EST_viterbi.cc0000644000076400007640000004217311465017156015522 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Alan W Black */ /* Date : July 1996 */ /*-----------------------------------------------------------------------*/ /* A viterbi decoder */ /* */ /* User provides the candidates, target and combine score function */ /* and it searches for the best path through the candidates */ /* */ /*=======================================================================*/ #include #include "EST_viterbi.h" static void init_paths_array(EST_VTPoint *n,int num_states); static void debug_output_1(EST_VTPoint *p,EST_VTCandidate *c, EST_VTPath *np, int i); EST_VTPoint::~EST_VTPoint() { int i; if (paths != 0) delete paths; if (num_states != 0) { for (i=0; ihead(); i != 0; i=i->next()) { n = new EST_VTPoint; n->s = i; if (num_states > 0) init_paths_array(n,num_states); if (t == 0) timeline = n; else t->next = n; t=n; } // Extra one at the end for final paths n = new EST_VTPoint; if (num_states > 0) init_paths_array(n,num_states); // Need init path on first point so a search can start if (num_states == 0) // general search case timeline->paths = new EST_VTPath; if (num_states == -1) init_paths_array(timeline,1); // a start point if (t == 0) timeline = n; // its an empty stream else t->next = n; } static void init_paths_array(EST_VTPoint *n,int num_states) { // Create the states array and initialize it int j; n->num_states = num_states; n->st_paths = new EST_VTPath*[num_states]; for (j=0;jst_paths[j] = 0; } const int EST_Viterbi_Decoder::betterthan(const float a,const float b) const { // Some thing big is better, others want it to be as small as possible // this just tells you if a is better than b by checking the variable // in the decoder itself. // For probabilities big_is_good == TRUE (or log probabilities) if (big_is_good) return (a > b); else return (a < b); } static int init_dynamic_states(EST_VTPoint *p, EST_VTCandidate *cands) { // In a special (hmm maybe not so special), the number of "states" // is the number of candidates EST_VTCandidate *c; int i; for (i=0, c=cands; c != 0; c=c->next,i++) c->pos = i; init_paths_array(p,i); return i; } void EST_Viterbi_Decoder::set_pruning_parameters(float beam, float ob_beam) { do_pruning = TRUE; overall_path_pruning_envelope_width = beam; candidate_pruning_envelope_width = ob_beam; } void EST_Viterbi_Decoder::turn_on_debug() { debug = TRUE; } void EST_Viterbi_Decoder::turn_on_trace() { trace = TRUE; } void EST_Viterbi_Decoder::search(void) { // Searches for the best path EST_VTPoint *p; EST_VTPath *t,*np; EST_VTCandidate *c; int i=0; double best_score=0.0,score_cutoff=0.0; double best_candidate_score=0.0,candidate_cutoff=0; int dcount,pcount; int cand_count=0, cands_considered=0; for (p=timeline; p->next != 0; p=p->next) { // For each point in time // Find the candidates p->cands = (*user_clist)(p->s,f); // P(S|B) if (do_pruning) prune_initialize(p,best_score,best_candidate_score, score_cutoff,candidate_cutoff, cand_count); if (num_states != 0) // true viterbi -- optimized for states { if (num_states == -1) // special case, dynamic state size init_dynamic_states(p->next,p->cands); cands_considered=0; // moved by simonk for (i=0; inum_states; i++) { // for each path up to here //cands_considered=0; if (((p == timeline) && i==0) || (p->st_paths[i] != 0)) for (c=p->cands; c != 0; c=c->next) { // for each new candidate // candidate pruning (a.k.a. observation pruning) if(!do_pruning || betterthan(c->score,candidate_cutoff)) { cands_considered++; // Find path extension costs np = (*user_npath)(p->st_paths[i],c,f); if (debug) debug_output_1(p,c,np,i); if (do_pruning && betterthan(np->score,best_score)) { best_score = np->score; if(big_is_good) score_cutoff = best_score - overall_path_pruning_envelope_width; else score_cutoff = best_score + overall_path_pruning_envelope_width; } // can prune here, although score_cutoff will // be generally too generous at this point. // It's unclear whether this pruning takes more // time than it saves ! if(!do_pruning||betterthan(np->score,score_cutoff)) vit_add_paths(p->next,np); else delete np; } } } if (do_pruning) { if(big_is_good) score_cutoff = best_score - overall_path_pruning_envelope_width; else score_cutoff = best_score + overall_path_pruning_envelope_width; if(trace) { cerr << "Considered " << cands_considered << " of "; cerr << cand_count*p->num_states << " candidate paths" << endl; cerr << "FRAME: best score " << best_score; cerr << " score cutoff " << score_cutoff << endl; cerr << " best candidate score " << best_candidate_score; cerr << " candidate cutoff " << candidate_cutoff << endl; } dcount=0; pcount=0; for (i=0; inext->num_states; i++) if(p->next->st_paths[i] != 0) { pcount++; if(!betterthan(p->next->st_paths[i]->score, score_cutoff)) { delete p->next->st_paths[i]; p->next->st_paths[i] = 0; dcount++; } } if(trace) { cerr << "Pruned " << dcount << " of " << pcount; cerr << " paths" << endl << endl; } } } else // general beam search for (t=p->paths; t != 0; t=t->next) { // for each path up to here for (c=p->cands; c != 0; c=c->next) { // for each new candidate np = (*user_npath)(t,c,f); add_path(p->next,np); // be a little cleverer } } if (debug) fprintf(stdout,"\n"); } } void EST_Viterbi_Decoder:: prune_initialize(EST_VTPoint *p, double &best_score, double &best_candidate_score, double &score_cutoff, double &candidate_cutoff, int &cand_count) { // Find best candidate, count them and set some vars. EST_VTCandidate *c; if (big_is_good) { best_score = -vit_a_big_number; best_candidate_score = -vit_a_big_number; score_cutoff = -vit_a_big_number; candidate_cutoff = - candidate_pruning_envelope_width; } else { best_candidate_score = vit_a_big_number; best_score = vit_a_big_number; score_cutoff = vit_a_big_number; candidate_cutoff = candidate_pruning_envelope_width; } for (cand_count=0,c=p->cands; c; c=c->next,cand_count++) if (betterthan(c->score,best_candidate_score)) best_candidate_score = c->score; candidate_cutoff += best_candidate_score; } static void debug_output_1(EST_VTPoint *p,EST_VTCandidate *c, EST_VTPath *np,int i) { printf("%s: ",(const char *)p->s->name()); cout << c->name; printf(" %1.3f B %1.3f (%1.3f) st %d s %1.3f ", np->c->score, (np->c->score==0 ? 0 : ((float)np->f("lscore"))/np->c->score), (float)np->f("lscore"),np->state, np->score); if (p->st_paths[i] == 0) cout << "(I)" << endl; else cout << p->st_paths[i]->c->name << endl; } void EST_Viterbi_Decoder::vit_add_paths(EST_VTPoint *pt, EST_VTPath *np) { // Add set of paths EST_VTPath *p,*next_p; for (p=np; p != 0; p=next_p) { next_p = p->next; // need to save this as p could be deleted vit_add_path(pt,p); } } void EST_Viterbi_Decoder::vit_add_path(EST_VTPoint *p, EST_VTPath *np) { // We are doing true viterbi so we need only keep the best // path for each state. This means we can index into the // array of paths ending at P and only keep np if its score // is better than any other path of that state if ((np->state < 0) || (np->state > p->num_states)) { cerr << "EST_Viterbi: state too big (" << np->state << ")" << endl; } else if ((p->st_paths[np->state] == 0) || (betterthan(np->score,p->st_paths[np->state]->score))) { // This new one is better so replace it if (p->st_paths[np->state] != 0) delete p->st_paths[np->state]; p->st_paths[np->state] = np; } else delete np; } bool EST_Viterbi_Decoder::vit_prune_path(double path_score, double score_cutoff) { // a bit of a simple function !! // if it falls below cutoff, then prune point // typically will only be one path at this point anyway (Viterbi) if(!betterthan(path_score,score_cutoff)) return TRUE; return FALSE; } void EST_Viterbi_Decoder::add_path(EST_VTPoint *p, EST_VTPath *np) { // Add new path to point, Prunes as appropriate to strategy EST_VTPath *pp; if (p == 0) cerr << "Viterbi: tried to add path to NULL point\n"; else { if ((beam_width == 0) || // Add if no beam restrictions or (p->num_paths < beam_width) || // beam not filled or (betterthan(np->score,p->paths->score)))//this is better than best // (np->score > p->paths->score)) // this is better than best { EST_VTPath **l = &p->paths; EST_VTPath *a; for (a=p->paths; /* scary */ ; a=a->next) { if ((a == 0) || (betterthan(a->score,np->score))) { // Add new path here np->next = a; *l = np; p->num_paths++; break; } l = &a->next; } // Prune the first one of the list if ((beam_width > 0) && (p->num_paths > beam_width)) { pp = p->paths; p->paths = pp->next; pp->next = 0; p->num_paths--; delete pp; } } else { delete np; // failed to make it } } } EST_VTCandidate *EST_Viterbi_Decoder::add_cand_prune(EST_VTCandidate *newcand, EST_VTCandidate *allcands) { // Add newcand to allcand, in score order and prune it to // cand_width, delete newcand if its not good enough EST_VTCandidate *newlist = allcands; EST_VTCandidate *pp; int numcands; if (allcands == 0) numcands = 0; else numcands = allcands->pos; if ((cand_width == 0) || // Add if no candbeam restrictions or (numcands < cand_width) || // candbeam not filled or (betterthan(newcand->score,allcands->score))) //this better than best { EST_VTCandidate **l = &newlist; EST_VTCandidate *a; for (a=newlist; /* scary */ ; a=a->next) { if ((a == 0) || (betterthan(a->score,newcand->score))) { // Add new path here newcand->next = a; *l = newcand; numcands++; break; } l = &a->next; } // Prune the first one off the list if ((cand_width > 0) && (numcands > cand_width)) { pp = newlist; newlist = pp->next; pp->next = 0; numcands--; delete pp; } } else delete newcand; // failed to make it newlist->pos = numcands; return newlist; } bool EST_Viterbi_Decoder::result(const EST_String &n) { // Finds best path through the search space (previously searched) // Adds field to the EST_Items, named n, with chosen value EST_VTPath *p; if ((timeline == 0) || (timeline->next == 0)) return TRUE; // it's an empty list so it has succeeded p = find_best_end(); if (p == 0) return FALSE; // there isn't any answer for (; p != 0; p=p->from) { // Hmm need the original EST_Item if (p->c != 0) { p->c->s->set_val(n,p->c->name); p->c->s->set(n+"_score",p->f.F("lscore",0.0)); } } return TRUE; } bool EST_Viterbi_Decoder::result( EST_VTPath **bestPathEnd ) { // Finds best path through the search space (previously searched) *bestPathEnd = 0; if ((timeline == 0) || (timeline->next == 0)) return TRUE; // it's an empty list so it has succeeded *bestPathEnd = find_best_end(); if (*bestPathEnd == 0) return FALSE; // there isn't any answer return TRUE; } void EST_Viterbi_Decoder::copy_feature(const EST_String &n) { // Copy feature from path to related stream EST_VTPath *p; p = find_best_end(); if(p == 0) return; for (; p != 0; p=p->from) { // Hmm need the original EST_Item if ((p->c != 0) && (p->f.present(n))) p->c->s->set_val(n,p->f(n)); } } EST_VTPath *EST_Viterbi_Decoder::find_best_end() const { EST_VTPoint *t; double best,worst; EST_VTPath *p, *best_p=0; int i; // I'd like to use HUGE_VAL or FLT_MAX for this but its not portable // (on alphas) if (big_is_good) worst = -vit_a_big_number; // worst possible; else worst = vit_a_big_number; // worst possible; best = worst; // hopefully we can find something better; for (i=0,t=timeline; t->next != 0; t=t->next,i++) { if ((t->num_states == 0) && (t->num_paths == 0)) { cerr << "No paths at frame " << i << " " << t->s->name() << endl; return 0; } } if (num_states != 0) for (i=0; inum_states; i++) { if ((t->st_paths[i] != 0) && (betterthan(t->st_paths[i]->score,best))) { best = t->st_paths[i]->score; best_p = t->st_paths[i]; } } else for (p=t->paths; p!=0; p=p->next) { if (betterthan(p->score,best)) { best = p->score; best_p = p; } } if (debug) { if (best == worst) cerr << "Failed to find path" << endl; cout << "Best score is " << best << endl; } return best_p; } speech_tools/stats/dynamic_program.cc0000644000076400007640000002470711465017156016521 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : June 1998 */ /*************************************************************************/ #include #include #include #include #include "EST_math.h" #include "ling_class/EST_Utterance.h" typedef EST_TVector EST_Item_ptr_Vector; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" template class EST_TVector; #endif static EST_Item *const def_val_item_ptr = NULL; template <> EST_Item* const *EST_Item_ptr_Vector::def_val = &def_val_item_ptr; static EST_Item* error_return_item_ptr = NULL; template <> EST_Item* *EST_Item_ptr_Vector::error_return = &error_return_item_ptr; typedef float (*local_cost_function)(const EST_Item *item1, const EST_Item *item2); typedef bool (*local_pruning_function)(const int i, const int j, const int max_i, const int max_j); bool dp_sub(int i, int j, const EST_Item_ptr_Vector &vr1, const EST_Item_ptr_Vector &vr2, EST_IMatrix &DP_path_i, EST_IMatrix &DP_path_j, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym, EST_FMatrix &cost); void trace_back_and_link(int i, int j, EST_Item *p1, EST_Item *p2, const EST_IMatrix &DP_path_i, const EST_IMatrix &DP_path_j, EST_Item *null_sym); inline bool null_lpf(const int,const int,const int,const int) { return FALSE; } bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym); bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, EST_Item *null_sym) { // dp without pruning return dp_match(lexical,surface,match,lcf,null_lpf,null_sym); } static float fixed_ins; static float fixed_del; static float fixed_sub; float fixed_local_cost(const EST_Item *s1, const EST_Item *s2) { EST_String null_sym = "nil"; // otherwise cost is either insertion cost, or cost_matrix value if (s1->name() == s2->name()) return 0; else { if (s1->name() == null_sym) return fixed_ins; else if (s2->name() == null_sym) return fixed_del; else return fixed_sub; } } bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, float ins, float del, float sub) { fixed_ins = ins; fixed_del = del; fixed_sub = sub; EST_Item null_sym; return dp_match(lexical, surface, match, fixed_local_cost, null_lpf, &null_sym); } bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym) { // aligns lexical and surface forms using dynamic programming // i.e. the lexical form is transformed into the surface form // by substitutions, insertions and deletions // makes links between associated (matching or substituted) items // insertions and deletions are 'left dangling' // links are stored in a new relation called "Match" // assumes that local cost computation is cheap (no caching) EST_IMatrix DP_path_i,DP_path_j; EST_Item_ptr_Vector vr1,vr2; EST_Item *p; int l1,l2,i,j; l1 = lexical.length() + 1; l2 = surface.length() + 1; vr1.resize(l1); vr2.resize(l2); // prepend null_syms vr1[0] = null_sym; vr2[0] = null_sym; for (p=lexical.head(),i=1; p != 0; p = p->next(),i++) vr1[i] = p; for (p=surface.head(),i=1; p != 0; p = p->next(),i++) vr2[i] = p; DP_path_i.resize(l1,l2); DP_path_j.resize(l1,l2); /* cerr << "Pruning" << endl; for(i=0;inext()) match.append(p); /* for(i=0;i= 0) return TRUE; //cerr << "sub " << i << " " << j << endl; int best_i=-1,best_j=-1; float sub,ins,del; float best_c=MAXFLOAT; // prune ? if(lpf(i,j,vr1.length()-1,vr2.length()-1)) return FALSE; // consider all paths into this point // and select the best one (lowest cost) if(i==0) { if(j==0) { best_i = i; best_j = j; best_c = lcf(null_sym,null_sym); } else { // insert j'th item from vr2 if(dp_sub(i,j-1,vr1,vr2, DP_path_i,DP_path_j, lcf,lpf, null_sym,cost)) { best_i = i; best_j = j-1; best_c = lcf(null_sym,vr2(j)) + cost.a(i,j-1); } else return FALSE; } } else if(j==0) { // delete i'th item from vr1 if(dp_sub(i-1,j,vr1,vr2, DP_path_i,DP_path_j, lcf,lpf, null_sym,cost)) { best_i = i-1; best_j = j; best_c = lcf(vr1(i),null_sym) + cost.a(i-1,j); } } // this is the simplest local constraint (i.e. no constraints !) // which allows unlimited consecutive insertions or deletions else { if(dp_sub(i-1,j-1,vr1,vr2, DP_path_i,DP_path_j, lcf,lpf, null_sym,cost)) { sub = 2 * lcf(vr1(i),vr2(j)) + cost(i-1,j-1); if(sub < best_c) { best_i=i-1; best_j=j-1; best_c = sub; } } if(dp_sub(i,j-1,vr1,vr2, DP_path_i,DP_path_j, lcf,lpf, null_sym,cost)) { ins=lcf(null_sym,vr2(j)) + cost(i,j-1); if(ins < best_c) { best_i=i; best_j=j-1; best_c = ins; } } if(dp_sub(i-1,j,vr1,vr2, DP_path_i,DP_path_j, lcf,lpf, null_sym,cost)) { del=lcf(vr1(i),null_sym) + cost(i-1,j); if(del < best_c) { best_i=i-1; best_j=j; best_c = del; } } } cost.a(i,j) = best_c; DP_path_i.a_no_check(i,j) = best_i; DP_path_j.a_no_check(i,j) = best_j; //cerr << "best " << i << "," << j << " = " << best_c << endl; if(best_c == MAXFLOAT) // didn't find a better path return FALSE; else return TRUE; } void trace_back_and_link(int i, int j, EST_Item *p1, EST_Item *p2, const EST_IMatrix &DP_path_i, const EST_IMatrix &DP_path_j, EST_Item *null_sym) { //cerr << "trace " << i << " " << j << endl; //int i,j; //i=utt.relation("Lexical")->index(p1); //j=utt.relation("Surface")->index(p2); if((p1==0)&&(p2==0)) // reached start return; if(DP_path_i(i,j) == i-1) { if(DP_path_j(i,j) == j-1) { // match, or substitution //cerr << "sub " << p1->name() << " with " << p2->name() << endl; p1->append_daughter(p2); p1=p1->prev(); p2=p2->prev(); } else // deletion p1=p1->prev(); } else { // insertion // p1->append_daughter(p2); // decorative p2=p2->prev(); } trace_back_and_link(DP_path_i(i,j), DP_path_j(i,j), p1,p2, DP_path_i,DP_path_j, null_sym); } speech_tools/stats/Makefile0000644000076400007640000000626507262605664014505 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Statistical Routines Makefile # # # #=========================================================================# TOP=.. DIRNAME=stats LIB_BUILD_DIRS= kalman_filter ALL_DIRS = $(BUILD_DIRS) wagon BUILD_DIRS = $(LIB_BUILD_DIRS) LOCAL_DEFAULT_LIBRARY = estbase H = TSRCS = dynamic_program.cc CPPSRCS = EST_cluster.cc EST_multistats.cc confusion.cc \ EST_Discrete.cc EST_DProbDist.cc EST_ols.cc \ EST_viterbi.cc $(TSRCS) SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) FILES = $(SRCS) $(H) Makefile ols.mak ALL = .buildlib .sub_directories include $(TOP)/config/common_make_rules test: : $(BUILD_DIRS) + $(EXTRA_BUILD_DIRS) + $(EXTRA_LIB_BUILD_DIRS) : $(SUBDIRECTORIES) speech_tools/stats/ols.mak0000644000076400007640000000645507262605664014335 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Ordinary Least Squares support. ## ## ## ########################################################################### INCLUDE_OLS=1 MOD_DESC_OLS=Ordinary Least Squares support. ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) ols_main.cc ols_test_main.cc endif ifndef INCLUDE_SIOD .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include SIOD to use ols" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/stats/kalman_filter/EST_kalman.cc0000644000076400007640000001717610127000721020116 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : June 1998 */ /*-----------------------------------------------------------------------*/ /* Kalman filtering, i.e. linear model fitting */ /* */ /*=======================================================================*/ #include #include #include #include "EST.h" #include "EST_kalman.h" static bool kalman_filter_param_check(EST_FVector &x, EST_FMatrix &P, EST_FMatrix &Q, EST_FMatrix &R, EST_FMatrix &A, EST_FMatrix &H, EST_FVector &z); bool kalman_filter(EST_FVector &x, EST_FMatrix &P, EST_FMatrix &Q, EST_FMatrix &R, EST_FMatrix &A, EST_FMatrix &H, EST_FVector &z) { // see kalman.h for meaning of args if(!kalman_filter_param_check(x,P,Q,R,A,H,z)) { cerr << "Kalman filter parameters inconsistent !" << endl; return FALSE; } EST_FMatrix K,I,At,Ht,PHt,HPHt_R,HPHt_R_inv; int state_dim=x.length(); int singularity; eye(I,state_dim); transpose(A,At); cerr << "predict" << endl; // predict // ======= // if A is the identity matrix we could speed this up a LOT x = A * x; P = A * P * At + Q; cerr << "correct" << endl; // correct // ======= // T T -1 // K = P H ( H P H + R ) transpose(H,Ht); PHt = P * Ht; HPHt_R=(H * PHt) + R; if(!inverse( HPHt_R , HPHt_R_inv, singularity)) { if(singularity != -1) { cerr << " H * P * Ht + R is singular !" << endl; return FALSE; } cerr << "Matrix inversion failed for an unknown reason !" << endl; return FALSE; } K = PHt * HPHt_R_inv; x = add(x, K * subtract(z,H * x)); P = (I - K * H) * P; // try and remedy numerical errors symmetrize(P); //cerr << "done" << endl; return TRUE; } bool kalman_filter_Pinv(EST_FVector &x, EST_FMatrix &Pinv, EST_FMatrix &Q, EST_FMatrix &Rinv, EST_FMatrix &A, EST_FMatrix &H, EST_FVector &z) { // a different formulation, using the inverse // covariance matrix, and a more stable update // equation // from: // Intro. to Random Signals and Kalman Applied Filtering // Brown & Hwang (Wiley,1997) // p. 248 if(!kalman_filter_param_check(x,Pinv,Q,Rinv,A,H,z)) { cerr << "Kalman filter parameters inconsistent !" << endl; return FALSE; } EST_FMatrix K,I,At,Ht,P; int singularity; int state_dim=x.length(); eye(I,state_dim); transpose(A,At); transpose(H,Ht); cerr << "Compute P" << endl; // update error covariance // ======================= Pinv = Pinv + (Ht * Rinv * H); if(!inverse(Pinv,P,singularity)) { if(singularity != -1) { cerr << "P is singular !" << endl; return FALSE; } cerr << "Matrix inversion failed for an unknown reason !" << endl; return FALSE; } // compute gain // ============ K = P * Ht * Rinv; // update state // ============ x = add(x, K * subtract(z,H*x)); // project ahead // ============= x = A * x; P = A * P * At + Q; if(!inverse(P,Pinv,singularity)) { if(singularity != -1) { cerr << "Pinv is singular !" << endl; return FALSE; } cerr << "Matrix inversion failed for an unknown reason !" << endl; return FALSE; } // try and remedy numerical errors //symmetrize(P); //cerr << "done" << endl; return TRUE; } bool kalman_filter_param_check(EST_FVector &x, EST_FMatrix &P, EST_FMatrix &Q, EST_FMatrix &R, EST_FMatrix &A, EST_FMatrix &H, EST_FVector &z) { int state_dim=x.length(); int measurement_dim=z.length(); // sanity checks if((state_dim <= 0) || (measurement_dim <= 0)) { cerr << "No state or measurements !!" << endl; return FALSE; } // dimensionality // P is error covariance if((P.num_rows() != state_dim) || (P.num_columns() != state_dim) ) { cerr << "P, or Pinv, must be a symmetrical square matrix of the same dimension" << endl; cerr << "as the state vector, x" << endl; return FALSE; } // Q is process noise covariance if((Q.num_rows() != state_dim) || (Q.num_columns() != state_dim) ) { cerr << "Q must be a symmetrical square matrix of the same dimension" << endl; cerr << "as the state vector, x" << endl; return FALSE; } // R is measurement noise covariance if((R.num_rows() != measurement_dim) || (R.num_columns() != measurement_dim) ) { cerr << "R, or Rinv, must be a symmetrical square matrix of the same dimension" << endl; cerr << "as the measurement vector, z" << endl; return FALSE; } if((A.num_rows() != state_dim) || (A.num_columns() != state_dim) ) { cerr << "A must be a square matrix of the same dimension" << endl; cerr << "as the state vector, x" << endl; return FALSE; } if((H.num_rows() != measurement_dim) || (H.num_columns() != state_dim) ) { cerr << "H must have dimensions to fit z = Hx" << endl; return FALSE; } return TRUE; } speech_tools/stats/kalman_filter/Makefile0000644000076400007640000000547507262605664017317 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for weighted finite state transducer classes # #=========================================================================# TOP=../.. DIRNAME=stats/kalman_filter H = CSRCS = TSRCS = CPPSRCS = $(TSRCS) EST_kalman.cc MAINLINES = SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) FILES = $(SRCS) $(H) Makefile kalman_filter.mak $(MAINLINES) ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/stats/kalman_filter/kalman_filter.mak0000644000076400007640000000636407262605664021157 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Definitions for including kalman filtering ## ## ## ########################################################################### INCLUDE_KALMAN_FILTER=1 # add sub directory to stats directory ifeq ($(DIRNAME),stats) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) kalman_filter endif # add extra programs to main ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) \ fit_linear_model_main.cc match_linear_models_main.cc endif speech_tools/stats/wagon/Makefile0000644000076400007640000000520007262605664015604 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## Wagon a CART builder ## TOP=../.. DIRNAME=stats/wagon H = TSRCS= wagon.cc SRCS = dlist.cc wagon_aux.cc wagonint.cc $(TSRCS) OBJS = $(SRCS:.cc=.o) FILES = Makefile wagon.mak $(SRCS) $(H) ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/stats/wagon/wagon.mak0000644000076400007640000000661207262605664015761 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Wagon module definitions. ## ## ## ########################################################################### INCLUDE_WAGON=1 MOD_DESC_WAGON=Wagon CART tree system ifeq ($(DIRNAME),stats) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) wagon endif ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) wagon_main.cc wagon_test_main.cc endif ifndef INCLUDE_SIOD .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include SIOD to use wagon" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/stats/wagon/dlist.cc0000644000076400007640000001712611465017156015575 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* Decision lists */ /* These are like a right branching decision tree, yes answers are not */ /* partitioned any further. These are used for the Yarowsky-style */ /* homograph disambiguators */ /* */ /* Yarowsky, D. "Homograph Disambiguation in Text-to_Speech Synthesis" */ /* in "Progress in Speech Synthesis" eds van Santen, J. et al. Springer */ /* pp 157-172, 1996 */ /* Rivest, R.L. "Learning decision lists", Machine Learning 2:229-246 */ /* 1987 */ /* */ /*=======================================================================*/ #include #include #include "EST_Wagon.h" #include "EST_FMatrix.h" #include "EST_multistats.h" static WDlist *wagon_decision_list(); static void do_dlist_summary(WDlist *dlist, WDataSet &dataset); static WDlist *dlist_score_question(WQuestion &q, WVectorList &ds); WNode *wgn_build_dlist(float &score,ostream *output) { WDlist *dlist; dlist = wagon_decision_list(); *output << *dlist; if (wgn_test_dataset.width() > 0) // load in test data do_dlist_summary(dlist,wgn_test_dataset); else do_dlist_summary(dlist,wgn_dataset); score = 0; return 0; } static void do_dlist_summary(WDlist *dlist, WDataSet &dataset) { // Test dlist against data to get summary of results EST_StrStr_KVL pairs; EST_StrList lex; EST_Litem *p; EST_String predict,real; int i,type; for (p=dataset.head(); p != 0; p=p->next()) { predict = (EST_String)dlist->predict(*dataset(p)); type = dataset.ftype(0); real = wgn_discretes[type].name(dataset(p)->get_int_val(0)); pairs.add_item(real,predict,1); } for (i=0; i= wndt_class) { ques.set_fp(i); ques.set_oper(wnop_is); for (cl=0; cl < wgn_discretes[wgn_dataset.ftype(i)].length(); cl++) { ques.set_operand1(EST_Val(cl)); d = dlist_score_question(ques,wgn_dataset); if (d != 0) dlist = add_to_dlist(dlist,d); } } } return dlist; } static WDlist *dlist_score_question(WQuestion &q, WVectorList &ds) { // score this question for decision lists // the sum of the impurities when ds is split with this question WImpurity y; EST_Litem *d; WVector *wv; int i; for (i=0,d=ds.head(); d != 0; d=d->next(),i++) { wv = ds(d); if (q.ask(*wv) == TRUE) y.cumulate((*wv)[0]); } if (y.samples() > wgn_min_cluster_size) { q.set_yes((int)y.samples()); EST_DiscreteProbDistribution &pd = y.pd(); // Generalizing the formula in Yarowsky (pp157-172) we modify it // to take absolute log-likelihood ration of the most probability // of the most probable over the rest EST_String t; double p; double f; WDlist *n = new WDlist; n->set_question(q); t = pd.most_probable(&p); f = pd.frequency(t); n->set_score(fabs(log((f+0.0001)/(pd.samples()-f+0.0001)))); n->set_best(t,(int)f,(int)pd.samples()); #if 0 // original two-case code int freqa, freqb; pd.item_freq(0,s,freqa); pd.item_freq(1,s,freqb); n->set_score(fabs(log((0.0001+freqa)/(0.0001+freqb)))); n->set_freqs(freqa,freqb); #endif return n; } return 0; } EST_Val WDlist::predict(const WVector &d) { if (p_question.ask(d)) return p_token; else if (next == 0) return "guess"; // should be a priori most probable as dlist can't help else return next->predict(d); } WDlist *add_to_dlist(WDlist *l, WDlist *a) { // Add a to l at appropriate place in score order WDlist *p,*lp; if (l == 0) return a; else { for (lp=0,p=l; p != 0; lp=p,p=p->next) { if (a->score() > p->score()) { a->next = p; if (lp == 0) return a; else { lp->next = a; return l; } } } // add to end lp->next = a; } return l; } ostream &operator <<(ostream &s, WDlist &dlist) { s << endl; s << "("; s << dlist.p_question; s << " (("; s << dlist.p_score; s << " " << dlist.p_freq << " " << dlist.p_samples << " " << dlist.p_token << "))"; if (dlist.next != 0) s << *dlist.next; else s << endl; s << ")"; return s; } speech_tools/stats/wagon/wagon_aux.cc0000644000076400007640000006663311465017156016455 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* Various method functions */ /*=======================================================================*/ #include #include #include #include "EST_unix.h" #include "EST_cutils.h" #include "EST_Token.h" #include "EST_Wagon.h" #include "EST_math.h" EST_Val WNode::predict(const WVector &d) { if (leaf()) return impurity.value(); else if (question.ask(d)) return left->predict(d); else return right->predict(d); } WNode *WNode::predict_node(const WVector &d) { if (leaf()) return this; else if (question.ask(d)) return left->predict_node(d); else return right->predict_node(d); } int WNode::pure(void) { // A node is pure if it has no sub-nodes or its not of type class if ((left == 0) && (right == 0)) return TRUE; else if (get_impurity().type() != wnim_class) return TRUE; else return FALSE; } void WNode::prune(void) { // Check all sub-nodes and if they are all of the same class // delete their sub nodes. Returns pureness of this node if (pure() == FALSE) { // Ok lets try and make it pure if (left != 0) left->prune(); if (right != 0) right->prune(); // Have to check purity as well as values to ensure left and right // don't further split if ((left->pure() == TRUE) && ((right->pure() == TRUE)) && (left->get_impurity().value() == right->get_impurity().value())) { delete left; left = 0; delete right; right = 0; } } } void WNode::held_out_prune() { // prune tree with held out data // Check if node's questions differentiates for the held out data // if not, prune all sub_nodes // Rescore with prune data set_impurity(WImpurity(get_data())); // for this new data if (left != 0) { wgn_score_question(question,get_data()); if (question.get_score() < get_impurity().measure()) { // its worth goint ot the next level wgn_find_split(question,get_data(), left->get_data(), right->get_data()); left->held_out_prune(); right->held_out_prune(); } else { // not worth the split so prune both sub_nodes delete left; left = 0; delete right; right = 0; } } } void WNode::print_out(ostream &s, int margin) { int i; s << endl; for (i=0;iprint_out(s,margin+1); right->print_out(s,margin+1); } s << ")"; } ostream & operator <<(ostream &s, WNode &n) { // Output this node and its sub-node n.print_out(s,0); s << endl; return s; } void WDataSet::ignore_non_numbers() { /* For ols we want to ignore anything that is categorial */ int i; for (i=0; i 2) { LISP rest = cdr(car(d)); EST_StrList sl; siod_list_to_strlist(rest,sl); p_type[i] = wgn_discretes.def(sl); if (streq(get_c_string(car(rest)),"_other_")) wgn_discretes[p_type[i]].def_val("_other_"); } else if (tname == "binary") p_type[i] = wndt_binary; else if (tname == "cluster") p_type[i] = wndt_cluster; else if (tname == "vector") p_type[i] = wndt_vector; else if (tname == "trajectory") p_type[i] = wndt_trajectory; else if (tname == "matrix") p_type[i] = wndt_matrix; else if (tname == "float") p_type[i] = wndt_float; else { wagon_error(EST_String("Unknown type \"")+tname+ "\" for field number "+itoString(i)+ "/"+p_name[i]+" in description file \""+fname+"\""); } } if (wgn_predictee == -1) { wagon_error(EST_String("predictee field \"")+wgn_predictee_name+ "\" not found in description "); } } const int WQuestion::ask(const WVector &w) const { // Ask this question of the given vector switch (op) { case wnop_equal: // for numbers if (w.get_flt_val(feature_pos) == operand1.Float()) return TRUE; else return FALSE; case wnop_binary: // for numbers if (w.get_int_val(feature_pos) == 1) return TRUE; else return FALSE; case wnop_greaterthan: if (w.get_flt_val(feature_pos) > operand1.Float()) return TRUE; else return FALSE; case wnop_lessthan: if (w.get_flt_val(feature_pos) < operand1.Float()) return TRUE; else return FALSE; case wnop_is: // for classes if (w.get_int_val(feature_pos) == operand1.Int()) return TRUE; else return FALSE; case wnop_in: // for subsets -- note operand is list of ints if (ilist_member(operandl,w.get_int_val(feature_pos))) return TRUE; else return FALSE; default: wagon_error("Unknown test operator"); } return FALSE; } ostream& operator<<(ostream& s, const WQuestion &q) { EST_String name; static EST_Regex needquotes(".*[()'\";., \t\n\r].*"); s << "(" << wgn_dataset.feat_name(q.get_fp()); switch (q.get_op()) { case wnop_equal: s << " = " << q.get_operand1().string(); break; case wnop_binary: break; case wnop_greaterthan: s << " > " << q.get_operand1().Float(); break; case wnop_lessthan: s << " < " << q.get_operand1().Float(); break; case wnop_is: name = wgn_discretes[wgn_dataset.ftype(q.get_fp())]. name(q.get_operand1().Int()); s << " is "; if (name.matches(needquotes)) s << quote_string(name,"\"","\\",1); else s << name; break; case wnop_matches: name = wgn_discretes[wgn_dataset.ftype(q.get_fp())]. name(q.get_operand1().Int()); s << " matches " << quote_string(name,"\"","\\",1); break; case wnop_in: s << " in ("; for (int l=0; l < q.get_operandl().length(); l++) { name = wgn_discretes[wgn_dataset.ftype(q.get_fp())]. name(q.get_operandl().nth(l)); if (name.matches(needquotes)) s << quote_string(name,"\"","\\",1); else s << name; s << " "; } s << ")"; break; // SunCC wont let me add this // default: // s << " unknown operation "; } s << ")"; return s; } EST_Val WImpurity::value(void) { // Returns the recommended value for this EST_String s; double prob; if (t==wnim_unset) { cerr << "WImpurity: no value currently set\n"; return EST_Val(0.0); } else if (t==wnim_class) return EST_Val(p.most_probable(&prob)); else if (t==wnim_cluster) return EST_Val(a.mean()); else if (t==wnim_vector) return EST_Val(a.mean()); /* wnim_vector */ else if (t==wnim_trajectory) return EST_Val(a.mean()); /* NOT YET WRITTEN */ else return EST_Val(a.mean()); } double WImpurity::samples(void) { if (t==wnim_float) return a.samples(); else if (t==wnim_class) return (int)p.samples(); else if (t==wnim_cluster) return members.length(); else if (t==wnim_vector) return members.length(); else if (t==wnim_trajectory) return members.length(); else return 0; } WImpurity::WImpurity(const WVectorVector &ds) { int i; t=wnim_unset; a.reset(); trajectory=0; l=0; width=0; for (i=0; i < ds.n(); i++) { if (wgn_count_field == -1) cumulate((*(ds(i)))[wgn_predictee],1); else cumulate((*(ds(i)))[wgn_predictee], (*(ds(i)))[wgn_count_field]); } } float WImpurity::measure(void) { if (t == wnim_float) return a.variance()*a.samples(); else if (t == wnim_vector) return vector_impurity(); else if (t == wnim_trajectory) return trajectory_impurity(); else if (t == wnim_matrix) return a.variance()*a.samples(); else if (t == wnim_class) return p.entropy()*p.samples(); else if (t == wnim_cluster) return cluster_impurity(); else { cerr << "WImpurity: can't measure unset object" << endl; return 0.0; } } float WImpurity::vector_impurity() { // Find the mean/stddev for all values in all vectors // sum the variances and multiply them by the number of members EST_Litem *pp; int i,j; EST_SuffStats b; double count = 1; a.reset(); #if 1 /* simple distance */ for (j=0; j 0.0) { b.reset(); for (pp=members.head(); pp != 0; pp=pp->next()) { i = members.item(pp); b += wgn_VertexTrack.a(i,j); } a += b.stddev(); count = b.samples(); } } #endif #if 0 /* full covariance */ /* worse in listening experiments */ EST_SuffStats **cs; int mmm; cs = new EST_SuffStats *[wgn_VertexTrack.num_channels()+1]; for (j=0; j<=wgn_VertexTrack.num_channels(); j++) cs[j] = new EST_SuffStats[wgn_VertexTrack.num_channels()+1]; /* Find means for diagonal */ for (j=0; j 0.0) { for (pp=members.head(); pp != 0; pp=pp->next()) cs[j][j] += wgn_VertexTrack.a(members.item(pp),j); } } for (j=0; j 0.0) { for (pp=members.head(); pp != 0; pp=pp->next()) { mmm = members.item(pp); cs[i][j] += (wgn_VertexTrack.a(mmm,i)-cs[j][j].mean())* (wgn_VertexTrack.a(mmm,j)-cs[j][j].mean()); } } } for (j=0; j 0.0) a += cs[i][j].stddev(); } count = cs[0][0].samples(); #endif #if 0 // look at mean euclidean distance between vectors EST_Litem *qq; int x,y; double d,q; count = 0; for (pp=members.head(); pp != 0; pp=pp->next()) { x = members.item(pp); count++; for (qq=pp->next(); qq != 0; qq=qq->next()) { y = members.item(qq); for (q=0.0,j=0; j 0.0) { d = wgn_VertexTrack(x,j)-wgn_VertexTrack(y,j); q += d*d; } a += sqrt(q); } } #endif // This is sum of stddev*samples return a.mean() * count; } WImpurity::~WImpurity() { int j; if (trajectory != 0) { for (j=0; jnext()) { i = members.item(pp); for (q=0; q l) l = (int)wgn_UnitTrack.a(i,1); } if (ola==0) /* no -1's so its not an ola type cluster */ { l = ((int)lss.mean() < 7) ? 7 : (int)lss.mean(); /* a list of SuffStats on for each point in the trajectory */ trajectory = new EST_SuffStats *[l]; width = wgn_VertexTrack.num_channels()+1; for (j=0; jnext()) { /* for each unit */ i = members.item(pp); m = (float)wgn_UnitTrack.a(i,1)/(float)l; /* find interpolation */ s = (int)wgn_UnitTrack.a(i,0); /* start point */ for (ti=0,n=0.0; ti 0.0) trajectory[ti][j] += wgn_VertexTrack.a(s+ni,j); } } } /* find sum of sum of stddev for all coefs of all traj points */ stdss.reset(); for (ti=0; ti 0.0) stdss += trajectory[ti][j].stddev(); } // This is sum of all stddev * samples score = stdss.mean() * members.length(); } else { /* OLA model */ l1 = (l1ss.mean() < 10.0) ? 10 : (int)l1ss.mean(); l2 = (l2ss.mean() < 10.0) ? 10 : (int)l2ss.mean(); l = l1 + l2 + 1 + 1; /* a list of SuffStats on for each point in the trajectory */ trajectory = new EST_SuffStats *[l]; for (j=0; jnext()) { /* for each unit */ i = members.item(pp); s1l = 0; s = (int)wgn_UnitTrack.a(i,0); /* start point */ for (q=0; q 0 && ti 0.0) trajectory[ti][j] += wgn_VertexTrack.a(ni,j); } ti = l1; /* do it explicitly in case s1l < 1 */ for (j=0; j 0.0) trajectory[ti][j] += -1; /* Second half */ s += s1l+1; for (ti++,n=0.0; s2l > 0 && ti 0.0) trajectory[ti][j] += wgn_VertexTrack.a(ni,j); } for (j=0; j 0.0) trajectory[ti][j] += -2; } /* find sum of sum of stddev for all coefs of all traj points */ /* windowing the sums with a triangular weight window */ stdss.reset(); m = 1.0/(float)l1; for (w=0.0,ti=0; ti 0.0) stdss += trajectory[ti][j].stddev() * w; m = 1.0/(float)l2; for (w=1.0,ti++; ti 0.0) stdss += trajectory[ti][j].stddev() * w; // This is sum of all stddev * samples score = stdss.mean() * members.length(); } return score; } float WImpurity::cluster_impurity() { // Find the mean distance between all members of the dataset // Uses the global DistMatrix for distances between members of // the cluster set. Distances are assumed to be symmetric thus only // the bottom half of the distance matrix is filled EST_Litem *pp, *q; int i,j; double dist; a.reset(); for (pp=members.head(); pp != 0; pp=pp->next()) { i = members.item(pp); for (q=pp->next(); q != 0; q=q->next()) { j = members.item(q); dist = (j < i ? wgn_DistMatrix.a_no_check(i,j) : wgn_DistMatrix.a_no_check(j,i)); a+=dist; // cumulate for whole cluster } } // This is sum distance between cross product of members // return a.sum(); if (a.samples() > 1) return a.stddev() * a.samples(); else return 0.0; } float WImpurity::cluster_distance(int i) { // Distance this unit is from all others in this cluster // in absolute standard deviations from the the mean. float dist = cluster_member_mean(i); float mdist = dist-a.mean(); if (mdist == 0.0) return 0.0; else return fabs((dist-a.mean())/a.stddev()); } int WImpurity::in_cluster(int i) { // Would this be a member of this cluster?. Returns 1 if // its distance is less than at least one other float dist = cluster_member_mean(i); EST_Litem *pp; for (pp=members.head(); pp != 0; pp=pp->next()) { if (dist < cluster_member_mean(members.item(pp))) return 1; } return 0; } float WImpurity::cluster_ranking(int i) { // Position in ranking closest to centre float dist = cluster_distance(i); EST_Litem *pp; int ranking = 1; for (pp=members.head(); pp != 0; pp=pp->next()) { if (dist >= cluster_distance(members.item(pp))) ranking++; } return ranking; } float WImpurity::cluster_member_mean(int i) { // Returns the mean difference between this member and all others // in cluster EST_Litem *q; int j,n; double dist,sum; for (sum=0.0,n=0,q=members.head(); q != 0; q=q->next()) { j = members.item(q); if (i != j) { dist = (j < i ? wgn_DistMatrix(i,j) : wgn_DistMatrix(j,i)); sum += dist; n++; } } return ( n == 0 ? 0.0 : sum/n ); } void WImpurity::cumulate(const float pv,double count) { // Cumulate data for impurity calculation if (wgn_dataset.ftype(wgn_predictee) == wndt_cluster) { t = wnim_cluster; members.append((int)pv); } else if (wgn_dataset.ftype(wgn_predictee) == wndt_vector) { t = wnim_vector; members.append((int)pv); } else if (wgn_dataset.ftype(wgn_predictee) == wndt_trajectory) { t = wnim_trajectory; members.append((int)pv); } else if (wgn_dataset.ftype(wgn_predictee) >= wndt_class) { if (t == wnim_unset) p.init(&wgn_discretes[wgn_dataset.ftype(wgn_predictee)]); t = wnim_class; p.cumulate((int)pv,count); } else if (wgn_dataset.ftype(wgn_predictee) == wndt_binary) { t = wnim_float; a.cumulate((int)pv,count); } else if (wgn_dataset.ftype(wgn_predictee) == wndt_float) { t = wnim_float; a.cumulate(pv,count); } else { wagon_error("WImpurity: cannot cumulate EST_Val type"); } } ostream & operator <<(ostream &s, WImpurity &imp) { int j,i; EST_SuffStats b; if (imp.t == wnim_float) s << "(" << imp.a.stddev() << " " << imp.a.mean() << ")"; else if (imp.t == wnim_vector) { EST_Litem *p; s << "(("; imp.vector_impurity(); if (wgn_vertex_output == "mean") //output means { for (j=0; jnext()) { b += wgn_VertexTrack.a(imp.members.item(p),j); } s << "(" << b.mean() << " " << b.stddev() << ")"; if (j+1 0.0) { cs[j].reset(); for (p=imp.members.head(); p != 0; p=p->next()) { cs[j] += wgn_VertexTrack.a(imp.members.item(p),j); } } for (p=imp.members.head(); p != 0; p=p->next()) { for (x=0.0,j=0; j 0.0) { d = (wgn_VertexTrack.a(imp.members.item(p),j)-cs[j].mean()) /* / cs[j].stddev() */ ; /* seems worse 061218 */ x += d*d; } if (x < best) { bestp = imp.members.item(p); best = x; } } for (j=0; jnext()) { // Ouput cluster member and its mean distance to others s << "(" << imp.members.item(p) << " " << imp.cluster_member_mean(imp.members.item(p)) << ")"; if (p->next() != 0) s << " "; } s << ") "; // Mean of cross product of distances (cluster score) s << imp.a.mean() << ")"; } else if (imp.t == wnim_class) { EST_Litem *i; EST_String name; double prob; s << "("; for (i=imp.p.item_start(); !imp.p.item_end(i); i=imp.p.item_next(i)) { imp.p.item_prob(i,name,prob); s << "(" << name << " " << prob << ") "; } s << imp.p.most_probable(&prob) << ")"; } else s << "([WImpurity unset])"; return s; } speech_tools/stats/wagon/wagonint.cc0000644000076400007640000001027510127000721016262 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* Some high level functions used to interpret CART trees */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_cutils.h" #include "EST_Token.h" #include "EST_Wagon.h" int wagon_ask_question(LISP question, LISP value) { const char *str_oper = wgn_ques_oper_str(question); if (streq("is",str_oper)) { if (streq(get_c_string(value), get_c_string(wgn_ques_operand(question)))) return TRUE; else return FALSE; } else if (streq("=",str_oper)) if (get_c_float(value) == get_c_float(wgn_ques_operand(question))) return TRUE; else return FALSE; else if (streq("<",str_oper)) if (get_c_float(value) < get_c_float(wgn_ques_operand(question))) return TRUE; else return FALSE; else if (streq(">",str_oper)) if (get_c_float(value) > get_c_float(wgn_ques_operand(question))) return TRUE; else return FALSE; else if (streq("matches",str_oper)) { EST_Regex rgx(get_c_string(wgn_ques_operand(question))); if (EST_String(get_c_string(value)).matches(rgx)) return TRUE; else return FALSE; } else if (streq("in",str_oper)) if (siod_member_str(get_c_string(value), wgn_ques_operand(question)) != NIL) return TRUE; else return FALSE; else { cerr << "WAGON: unknown question operator: \"" << str_oper << "\"\n"; siod_error(); } // not reached, just for the compiler return FALSE; } speech_tools/stats/wagon/wagon.cc0000644000076400007640000007740011465017156015572 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* A Classification and Regression Tree (CART) Program */ /* A basic implementation of many of the techniques in */ /* Briemen et al. 1984 */ /* */ /* Added decision list support, Feb 1997 */ /* Added stepwise use of features, Oct 1997 */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_Token.h" #include "EST_FMatrix.h" #include "EST_multistats.h" #include "EST_Wagon.h" #include "EST_math.h" Discretes wgn_discretes; WDataSet wgn_dataset; WDataSet wgn_test_dataset; EST_FMatrix wgn_DistMatrix; EST_Track wgn_VertexTrack; EST_Track wgn_VertexFeats; EST_Track wgn_UnitTrack; int wgn_min_cluster_size = 50; int wgn_held_out = 0; int wgn_prune = TRUE; int wgn_quiet = FALSE; int wgn_verbose = FALSE; int wgn_count_field = -1; EST_String wgn_count_field_name = ""; int wgn_predictee = 0; EST_String wgn_predictee_name = ""; float wgn_float_range_split = 10; float wgn_balance = 0; EST_String wgn_opt_param = ""; EST_String wgn_vertex_output = "mean"; EST_String wgn_vertex_otype = "mean"; static float do_summary(WNode &tree,WDataSet &ds,ostream *output); static float test_tree_float(WNode &tree,WDataSet &ds,ostream *output); static float test_tree_class(WNode &tree,WDataSet &ds,ostream *output); static float test_tree_cluster(WNode &tree,WDataSet &dataset, ostream *output); static float test_tree_vector(WNode &tree,WDataSet &dataset,ostream *output); static float test_tree_trajectory(WNode &tree,WDataSet &dataset,ostream *output); static int wagon_split(int margin,WNode &node); static WQuestion find_best_question(WVectorVector &dset); static void construct_binary_ques(int feat,WQuestion &test_ques); static float construct_float_ques(int feat,WQuestion &ques,WVectorVector &ds); static float construct_class_ques(int feat,WQuestion &ques,WVectorVector &ds); static void wgn_set_up_data(WVectorVector &data,const WVectorList &ds,int held_out,int in); static WNode *wagon_stepwise_find_next_best(float &bscore,int &best_feat); Declare_TList_T(WVector *, WVectorP) Declare_TVector_Base_T(WVector *,NULL,NULL,WVectorP) #if defined(INSTANTIATE_TEMPLATES) // Instantiate class #include "../base_class/EST_TList.cc" #include "../base_class/EST_TVector.cc" Instantiate_TList_T(WVector *, WVectorP) Instantiate_TVector(WVector *) #endif void wgn_load_datadescription(EST_String fname,LISP ignores) { // Load field description for a file wgn_dataset.load_description(fname,ignores); wgn_test_dataset.load_description(fname,ignores); } void wgn_load_dataset(WDataSet &dataset,EST_String fname) { // Read the data set from a filename. One vector per line // Assume all numbers are numbers and non-nums are categorical EST_TokenStream ts; WVector *v; int nvec=0,i; if (ts.open(fname) == -1) wagon_error(EST_String("unable to open data file \"")+ fname+"\""); ts.set_PunctuationSymbols(""); ts.set_PrePunctuationSymbols(""); ts.set_SingleCharSymbols(""); for ( ;!ts.eof(); ) { v = new WVector(dataset.width()); i = 0; do { int type = dataset.ftype(i); if ((type == wndt_float) || (wgn_count_field == i)) { // need to ensure this is not NaN or Infinity float f = atof(ts.get().string()); if (finite(f)) v->set_flt_val(i,f); else { cout << fname << ": bad float " << f << " in field " << dataset.feat_name(i) << " vector " << dataset.samples() << endl; v->set_flt_val(i,0.0); } } else if (type == wndt_binary) v->set_int_val(i,atoi(ts.get().string())); else if (type == wndt_cluster) /* index into distmatrix */ v->set_int_val(i,atoi(ts.get().string())); else if (type == wndt_vector) /* index into VertexTrack */ v->set_int_val(i,atoi(ts.get().string())); else if (type == wndt_trajectory) /* index to index and length */ { /* a number pointing to a vector in UnitTrack that */ /* has an idex into VertexTrack and a number of Vertices */ /* Thus if its 15, UnitTrack.a(15,0) is the start frame in */ /* VertexTrack and UnitTrack.a(15,1) is the number of */ /* frames in the unit */ v->set_int_val(i,atoi(ts.get().string())); } else if (type == wndt_ignore) { ts.get(); // skip it v->set_int_val(i,0); } else // should check the different classes { EST_String s = ts.get().string(); int n = wgn_discretes.discrete(type).name(s); if (n == -1) { cout << fname << ": bad value " << s << " in field " << dataset.feat_name(i) << " vector " << dataset.samples() << endl; n = 0; } v->set_int_val(i,n); } i++; } while (!ts.eoln() && i= wndt_class) return test_tree_class(tree,ds,output); else return test_tree_float(tree,ds,output); } WNode *wgn_build_tree(float &score) { // Build init node and split it while reducing the impurity WNode *top = new WNode(); int margin = 0; wgn_set_up_data(top->get_data(),wgn_dataset,wgn_held_out,TRUE); margin = 0; wagon_split(margin,*top); // recursively split data; if (wgn_held_out > 0) { wgn_set_up_data(top->get_data(),wgn_dataset,wgn_held_out,FALSE); top->held_out_prune(); } if (wgn_prune) top->prune(); score = summary_results(*top,0); return top; } static void wgn_set_up_data(WVectorVector &data,const WVectorList &ds,int held_out,int in) { // Set data ommitting held_out percent if in is true // or only including 100-held_out percent if in is false int i,j; EST_Litem *d; // Make it definitely big enough data.resize(ds.length()); for (j=i=0,d=ds.head(); d != 0; d=d->next(),j++) { if ((in) && ((j%100) >= held_out)) data[i++] = ds(d); // else if ((!in) && ((j%100 < held_out))) // data[i++] = ds(d); else if (!in) data[i++] = ds(d); // if ((in) && (j < held_out)) // data[i++] = ds(d); // else if ((!in) && (j >=held_out)) // data[i++] = ds(d); } // make it the actual size, but don't reset values data.resize(i,1); } static float test_tree_class(WNode &tree,WDataSet &dataset,ostream *output) { // Test tree against data to get summary of results EST_StrStr_KVL pairs; EST_StrList lex; EST_Litem *p; EST_String predict,real; WNode *pnode; double H=0,prob; int i,type; float correct=0,total=0, count=0; for (p=dataset.head(); p != 0; p=p->next()) { pnode = tree.predict_node((*dataset(p))); predict = (EST_String)pnode->get_impurity().value(); if (wgn_count_field == -1) count = 1.0; else count = dataset(p)->get_flt_val(wgn_count_field); prob = pnode->get_impurity().pd().probability(predict); H += (log(prob))*count; type = dataset.ftype(wgn_predictee); real = wgn_discretes[type].name(dataset(p)->get_int_val(wgn_predictee)); if (real == predict) correct += count; total += count; pairs.add_item(real,predict,1); } for (i=0; inext()) { leaf = tree.predict_node((*dataset(p))); pos = dataset(p)->get_int_val(wgn_predictee); for (j=0; j 0.0) { b.reset(); for (pp=leaf->get_impurity().members.head(); pp != 0; pp=pp->next()) { i = leaf->get_impurity().members.item(pp); b += wgn_VertexTrack.a(i,j); } predict = b.mean(); actual = wgn_VertexTrack.a(pos,j); if (wgn_count_field == -1) count = 1.0; else count = dataset(p)->get_flt_val(wgn_count_field); x.cumulate(predict,count); y.cumulate(actual,count); /* Normalized the error by the standard deviation */ if (b.stddev() == 0) error = predict-actual; else error = (predict-actual)/b.stddev(); error = predict-actual; /* awb_debug */ se.cumulate((error*error),count); e.cumulate(fabs(error),count); xx.cumulate(predict*predict,count); yy.cumulate(actual*actual,count); xy.cumulate(predict*actual,count); } } // Pearson's product moment correlation coefficient // cor = (xy.mean() - (x.mean()*y.mean()))/ // (sqrt(xx.mean()-(x.mean()*x.mean())) * // sqrt(yy.mean()-(y.mean()*y.mean()))); // Because when the variation is X is very small we can // go negative, thus cause the sqrt's to give FPE double v1 = xx.mean()-(x.mean()*x.mean()); double v2 = yy.mean()-(y.mean()*y.mean()); double v3 = v1*v2; if (v3 <= 0) // happens when there's very little variation in x cor = 0; else cor = (xy.mean() - (x.mean()*y.mean()))/ sqrt(v3); if (output != NULL) { if (output != &cout) // save in output file *output << ";; RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; cout << "RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; } if (wgn_opt_param == "rmse") return -sqrt(se.mean()); // * -1 so bigger is better else return cor; // should really be % variance, I think } static float test_tree_trajectory(WNode &tree,WDataSet &dataset,ostream *output) { // Test tree against data to get summary of results TRAJECTORY // distance is calculated in zscores (as the values in vector may // have quite different ranges) // NOT WRITTEN YET WNode *leaf; EST_Litem *p; float predict, actual; EST_SuffStats x,y,xx,yy,xy,se,e; EST_SuffStats b; int i,j,pos; double cor,error; double count; EST_Litem *pp; for (p=dataset.head(); p != 0; p=p->next()) { leaf = tree.predict_node((*dataset(p))); pos = dataset(p)->get_int_val(wgn_predictee); for (j=0; j 0.0) { b.reset(); for (pp=leaf->get_impurity().members.head(); pp != 0; pp=pp->next()) { i = leaf->get_impurity().members.item(pp); b += wgn_VertexTrack.a(i,j); } predict = b.mean(); actual = wgn_VertexTrack.a(pos,j); if (wgn_count_field == -1) count = 1.0; else count = dataset(p)->get_flt_val(wgn_count_field); x.cumulate(predict,count); y.cumulate(actual,count); /* Normalized the error by the standard deviation */ if (b.stddev() == 0) error = predict-actual; else error = (predict-actual)/b.stddev(); error = predict-actual; /* awb_debug */ se.cumulate((error*error),count); e.cumulate(fabs(error),count); xx.cumulate(predict*predict,count); yy.cumulate(actual*actual,count); xy.cumulate(predict*actual,count); } } // Pearson's product moment correlation coefficient // cor = (xy.mean() - (x.mean()*y.mean()))/ // (sqrt(xx.mean()-(x.mean()*x.mean())) * // sqrt(yy.mean()-(y.mean()*y.mean()))); // Because when the variation is X is very small we can // go negative, thus cause the sqrt's to give FPE double v1 = xx.mean()-(x.mean()*x.mean()); double v2 = yy.mean()-(y.mean()*y.mean()); double v3 = v1*v2; if (v3 <= 0) // happens when there's very little variation in x cor = 0; else cor = (xy.mean() - (x.mean()*y.mean()))/ sqrt(v3); if (output != NULL) { if (output != &cout) // save in output file *output << ";; RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; cout << "RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; } if (wgn_opt_param == "rmse") return -sqrt(se.mean()); // * -1 so bigger is better else return cor; // should really be % variance, I think } static float test_tree_cluster(WNode &tree,WDataSet &dataset,ostream *output) { // Test tree against data to get summary of results for cluster trees WNode *leaf; int real; int right_cluster=0; EST_SuffStats ranking, meandist; EST_Litem *p; for (p=dataset.head(); p != 0; p=p->next()) { leaf = tree.predict_node((*dataset(p))); real = dataset(p)->get_int_val(wgn_predictee); meandist += leaf->get_impurity().cluster_distance(real); right_cluster += leaf->get_impurity().in_cluster(real); ranking += leaf->get_impurity().cluster_ranking(real); } if (output != NULL) { // Want number in right class, mean distance in sds, mean ranking if (output != &cout) // save in output file *output << ";; Right cluster " << right_cluster << " (" << (int)(100.0*(float)right_cluster/(float)dataset.length()) << "%) mean ranking " << ranking.mean() << " mean distance " << meandist.mean() << endl; cout << "Right cluster " << right_cluster << " (" << (int)(100.0*(float)right_cluster/(float)dataset.length()) << "%) mean ranking " << ranking.mean() << " mean distance " << meandist.mean() << endl; } return 10000-meandist.mean(); // this doesn't work but I tested it } static float test_tree_float(WNode &tree,WDataSet &dataset,ostream *output) { // Test tree against data to get summary of results FLOAT EST_Litem *p; float predict,real; EST_SuffStats x,y,xx,yy,xy,se,e; double cor,error; double count; for (p=dataset.head(); p != 0; p=p->next()) { predict = tree.predict((*dataset(p))); real = dataset(p)->get_flt_val(wgn_predictee); if (wgn_count_field == -1) count = 1.0; else count = dataset(p)->get_flt_val(wgn_count_field); x.cumulate(predict,count); y.cumulate(real,count); error = predict-real; se.cumulate((error*error),count); e.cumulate(fabs(error),count); xx.cumulate(predict*predict,count); yy.cumulate(real*real,count); xy.cumulate(predict*real,count); } // Pearson's product moment correlation coefficient // cor = (xy.mean() - (x.mean()*y.mean()))/ // (sqrt(xx.mean()-(x.mean()*x.mean())) * // sqrt(yy.mean()-(y.mean()*y.mean()))); // Because when the variation is X is very small we can // go negative, thus cause the sqrt's to give FPE double v1 = xx.mean()-(x.mean()*x.mean()); double v2 = yy.mean()-(y.mean()*y.mean()); double v3 = v1*v2; if (v3 <= 0) // happens when there's very little variation in x cor = 0; else cor = (xy.mean() - (x.mean()*y.mean()))/ sqrt(v3); if (output != NULL) { if (output != &cout) // save in output file *output << ";; RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; cout << "RMSE " << ftoString(sqrt(se.mean()),4,1) << " Correlation is " << ftoString(cor,4,1) << " Mean (abs) Error " << ftoString(e.mean(),4,1) << " (" << ftoString(e.stddev(),4,1) << ")" << endl; } if (wgn_opt_param == "rmse") return -sqrt(se.mean()); // * -1 so bigger is better else return cor; // should really be % variance, I think } static int wagon_split(int margin, WNode &node) { // Split given node (if possible) WQuestion q; WNode *l,*r; node.set_impurity(WImpurity(node.get_data())); q = find_best_question(node.get_data()); /* printf("q.score() %f impurity %f\n", q.get_score(), node.get_impurity().measure()); */ double impurity_measure = node.get_impurity().measure(); double question_score = q.get_score(); if ((question_score < WGN_HUGE_VAL) && (question_score < impurity_measure)) { // Ok its worth a split l = new WNode(); r = new WNode(); wgn_find_split(q,node.get_data(),l->get_data(),r->get_data()); node.set_subnodes(l,r); node.set_question(q); if (wgn_verbose) { int i; for (i=0; i < margin; i++) cout << " "; cout << q << endl; } margin++; wagon_split(margin,*l); margin++; wagon_split(margin,*r); margin--; return TRUE; } else { if (wgn_verbose) { int i; for (i=0; i < margin; i++) cout << " "; cout << "stopped samples: " << node.samples() << " impurity: " << node.get_impurity() << endl; } margin--; return FALSE; } } void wgn_find_split(WQuestion &q,WVectorVector &ds, WVectorVector &y,WVectorVector &n) { int i, iy, in; y.resize(q.get_yes()); n.resize(q.get_no()); for (iy=in=i=0; i < ds.n(); i++) if (q.ask(*ds(i)) == TRUE) y[iy++] = ds(i); else n[in++] = ds(i); } static WQuestion find_best_question(WVectorVector &dset) { // Ask all possible questions and find the best one int i; float bscore,tscore; WQuestion test_ques, best_ques; bscore = tscore = WGN_HUGE_VAL; best_ques.set_score(bscore); // test each feature with each possible question for (i=0;i < wgn_dataset.width(); i++) { if ((wgn_dataset.ignore(i) == TRUE) || (i == wgn_predictee)) tscore = WGN_HUGE_VAL; // ignore this feature this time else if (wgn_dataset.ftype(i) == wndt_binary) { construct_binary_ques(i,test_ques); tscore = wgn_score_question(test_ques,dset); } else if (wgn_dataset.ftype(i) == wndt_float) { tscore = construct_float_ques(i,test_ques,dset); } else if (wgn_dataset.ftype(i) == wndt_ignore) tscore = WGN_HUGE_VAL; // always ignore this feature #if 0 // This doesn't work reasonably else if (wgn_csubset && (wgn_dataset.ftype(i) >= wndt_class)) { wagon_error("subset selection temporarily deleted"); tscore = construct_class_ques_subset(i,test_ques,dset); } #endif else if (wgn_dataset.ftype(i) >= wndt_class) tscore = construct_class_ques(i,test_ques,dset); if (tscore < bscore) { best_ques = test_ques; best_ques.set_score(tscore); bscore = tscore; } } return best_ques; } static float construct_class_ques(int feat,WQuestion &ques,WVectorVector &ds) { // Find out which member of a class gives the best split float tscore,bscore = WGN_HUGE_VAL; int cl; WQuestion test_q; test_q.set_fp(feat); test_q.set_oper(wnop_is); ques = test_q; for (cl=0; cl < wgn_discretes[wgn_dataset.ftype(feat)].length(); cl++) { test_q.set_operand1(EST_Val(cl)); tscore = wgn_score_question(test_q,ds); if (tscore < bscore) { ques = test_q; bscore = tscore; } } return bscore; } #if 0 static float construct_class_ques_subset(int feat,WQuestion &ques, WVectorVector &ds) { // Find out which subset of a class gives the best split. // We first measure the subset of the data for each member of // of the class. Then order those splits. Then go through finding // where the best split of that ordered list is. This is described // on page 247 of Breiman et al. float tscore,bscore = WGN_HUGE_VAL; LISP l; int cl; ques.set_fp(feat); ques.set_oper(wnop_is); float *scores = new float[wgn_discretes[wgn_dataset.ftype(feat)].length()]; // Only do it for exists values for (cl=0; cl < wgn_discretes[wgn_dataset.ftype(feat)].length(); cl++) { ques.set_operand(flocons(cl)); scores[cl] = wgn_score_question(ques,ds); } LISP order = sort_class_scores(feat,scores); if (order == NIL) return WGN_HUGE_VAL; if (siod_llength(order) == 1) { // Only one so we know the best "split" ques.set_oper(wnop_is); ques.set_operand(car(order)); return scores[get_c_int(car(order))]; } ques.set_oper(wnop_in); LISP best_l = NIL; for (l=cdr(order); CDR(l) != NIL; l = cdr(l)) { ques.set_operand(l); tscore = wgn_score_question(ques,ds); if (tscore < bscore) { best_l = l; bscore = tscore; } } if (best_l != NIL) { if (siod_llength(best_l) == 1) { ques.set_oper(wnop_is); ques.set_operand(car(best_l)); } else if (equal(cdr(order),best_l) != NIL) { ques.set_oper(wnop_is); ques.set_operand(car(order)); } else { cout << "Found a good subset" << endl; ques.set_operand(best_l); } } return bscore; } static LISP sort_class_scores(int feat,float *scores) { // returns sorted list of (non WGN_HUGE_VAL) items int i; LISP items = NIL; LISP l; for (i=0; i < wgn_discretes[wgn_dataset.ftype(feat)].length(); i++) { if (scores[i] != WGN_HUGE_VAL) { if (items == NIL) items = cons(flocons(i),NIL); else { for (l=items; l != NIL; l=cdr(l)) { if (scores[i] < scores[get_c_int(car(l))]) { CDR(l) = cons(car(l),cdr(l)); CAR(l) = flocons(i); break; } } if (l == NIL) items = l_append(items,cons(flocons(i),NIL)); } } } return items; } #endif static float construct_float_ques(int feat,WQuestion &ques,WVectorVector &ds) { // Find out a split of the range that gives the best score // Naively does this by partitioning the range into float_range_split slots float tscore,bscore = WGN_HUGE_VAL; int d, i; float p; WQuestion test_q; float max,min,val,incr; test_q.set_fp(feat); test_q.set_oper(wnop_lessthan); ques = test_q; min = max = ds(0)->get_flt_val(feat); /* set up some value */ for (d=0; d < ds.n(); d++) { val = ds(d)->get_flt_val(feat); if (val < min) min = val; else if (val > max) max = val; } if (max == min) // we're pure return WGN_HUGE_VAL; incr = (max-min)/wgn_float_range_split; // so do float_range-1 splits /* We calculate this based on the number splits, not the increments, */ /* becuase incr can be so small it doesn't increment p */ for (i=0,p=min+incr; i < wgn_float_range_split; i++,p += incr ) { test_q.set_operand1(EST_Val(p)); tscore = wgn_score_question(test_q,ds); if (tscore < bscore) { ques = test_q; bscore = tscore; } } return bscore; } static void construct_binary_ques(int feat,WQuestion &test_ques) { // construct a question. Not sure about this in general // of course continuous/categorical features will require different // rule and non-binary ones will require some test point test_ques.set_fp(feat); test_ques.set_oper(wnop_binary); test_ques.set_operand1(EST_Val("")); } static float score_question_set(WQuestion &q, WVectorVector &ds, int ignorenth) { // score this question as a possible split by finding // the sum of the impurities when ds is split with this question WImpurity y,n; int d, num_yes, num_no; float count; WVector *wv; num_yes = num_no = 0; for (d=0; d < ds.n(); d++) { if ((ignorenth < 2) || (d%ignorenth != ignorenth-1)) { wv = ds(d); if (wgn_count_field == -1) count = 1.0; else count = (*wv)[wgn_count_field]; if (q.ask(*wv) == TRUE) { num_yes++; y.cumulate((*wv)[wgn_predictee],count); } else { num_no++; n.cumulate((*wv)[wgn_predictee],count); } } } q.set_yes(num_yes); q.set_no(num_no); int min_cluster; if ((wgn_balance == 0.0) || (ds.n()/wgn_balance < wgn_min_cluster_size)) min_cluster = wgn_min_cluster_size; else min_cluster = (int)(ds.n()/wgn_balance); if ((y.samples() < min_cluster) || (n.samples() < min_cluster)) return WGN_HUGE_VAL; float ym,nm,bm; ym = y.measure(); nm = n.measure(); bm = ym + nm; /* cout << q << endl; printf("test question y %f n %f b %f\n", ym, nm, bm); */ return bm/2.0; } float wgn_score_question(WQuestion &q, WVectorVector &ds) { // This level of indirection was introduced for later expansion return score_question_set(q,ds,1); } WNode *wagon_stepwise(float limit) { // Find the best single features and incrementally add features // that best improve result until it doesn't improve. // This is basically to automate what Kurt was doing in building // trees, he then automated it in PERL and as it seemed to work // I put it into wagon itself. // This can be pretty computationally intensive. WNode *best = 0,*new_best = 0; float bscore,best_score = -WGN_HUGE_VAL; int best_feat,i; int nf = 1; // Set all features to ignore for (i=0; i < wgn_dataset.width(); i++) wgn_dataset.set_ignore(i,TRUE); for (i=0; i < wgn_dataset.width(); i++) { if ((wgn_dataset.ftype(i) == wndt_ignore) || (i == wgn_predictee)) { // This skips the round not because this has anything to // do with this feature being (user specified) ignored // but because it indicates there is one less cycle that is // necessary continue; } new_best = wagon_stepwise_find_next_best(bscore,best_feat); if ((bscore - fabs(bscore * (limit/100))) <= best_score) { // gone as far as we can delete new_best; break; } else { best_score = bscore; delete best; best = new_best; wgn_dataset.set_ignore(best_feat,FALSE); if (!wgn_quiet) { fprintf(stdout,"FEATURE %d %s: %2.4f\n", nf, (const char *)wgn_dataset.feat_name(best_feat), best_score); fflush(stdout); nf++; } } } return best; } static WNode *wagon_stepwise_find_next_best(float &bscore,int &best_feat) { // Find which of the currently ignored features will best improve // the result WNode *best = 0; float best_score = -WGN_HUGE_VAL; int best_new_feat = -1; int i; for (i=0; i < wgn_dataset.width(); i++) { if (wgn_dataset.ftype(i) == wndt_ignore) continue; // user wants me to ignore this completely else if (i == wgn_predictee) // can't use the answer continue; else if (wgn_dataset.ignore(i) == TRUE) { WNode *current; float score; // Allow this feature to participate wgn_dataset.set_ignore(i,FALSE); current = wgn_build_tree(score); if (score > best_score) { best_score = score; delete best; best = current; best_new_feat = i; // fprintf(stdout,"BETTER FEATURE %d %s: %2.4f\n", // i, // (const char *)wgn_dataset.feat_name(i), // best_score); // fflush(stdout); } else delete current; // switch it off again wgn_dataset.set_ignore(i,TRUE); } } bscore = best_score; best_feat = best_new_feat; return best; } speech_tools/grammar/Makefile0000644000076400007640000000533607262605664014773 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for grammar classes # #=========================================================================# TOP=.. DIRNAME=grammar LIB_BUILD_DIRS = ngram ALL_DIRS = $(BUILD_DIRS) scfg wfst BUILD_DIRS = $(LIB_BUILD_DIRS) FILES = Makefile ALL = .sub_directories include $(TOP)/config/common_make_rules speech_tools/grammar/ngram/lattice_t.cc0000644000076400007640000000764607262605664016724 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Thu Sep 25 1997 */ /* -------------------------------------------------------------------- */ /* Template instantiation for lattice class. */ /* */ /*************************************************************************/ #include "EST_TList.h" #include "EST_TSortable.h" #include "EST_lattice.h" Declare_TList_T(Lattice::Arc *, Lattice_Arc_P) Declare_TSortable_T(Lattice::Arc *, Lattice_Arc_P) Declare_TList_T(Lattice::Node *, Lattice_Node_P) Declare_TSortable_T(Lattice::Node *, Lattice_Node_P) Declare_TList_T(Lattice::symbol_t, Lattice_symbol_t_P) Declare_TSortable_T(Lattice::symbol_t, Lattice_symbol_t_P) Declare_TVector_Base_T(Lattice::symbol_t, {0}, {0}, Lattice_symbol_t_P) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" #include "../base_class/EST_TVector.cc" Instantiate_TList_T(Lattice::Arc *, Lattice_Arc_P) Instantiate_TSortable_T(Lattice::Arc *, Lattice_Arc_P) Instantiate_TList_T(Lattice::Node *, Lattice_Node_P) Instantiate_TSortable_T(Lattice::Node *, Lattice_Node_P) Instantiate_TList_T(Lattice::symbol_t, Lattice_symbol_t_P) Instantiate_TSortable_T(Lattice::symbol_t, Lattice_symbol_t_P) Instantiate_TVector_T(Lattice::symbol_t, Lattice_symbol_t_P) #endif speech_tools/grammar/ngram/EST_Ngrammar.cc0000644000076400007640000017700711465017154017221 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King & Alan W Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* An EST_Ngram class for building and manipulating bigrams trigrams etc */ /* */ /*=======================================================================*/ #include #include #include #include #include #include using namespace std; #include "EST_Ngrammar.h" #include "EST_Pathname.h" #include "EST_Token.h" #include "EST_io_aux.h" const EST_DiscreteProbDistribution PSTnullProbDistribution; static EST_String NOVOCAB("NOVOCAB"); // ********************************************************************** EST_NgrammarState::EST_NgrammarState(const EST_NgrammarState &s) { clear(); init(s.id(),s.pdf_const()); } EST_NgrammarState::EST_NgrammarState(const EST_NgrammarState *const s) { clear(); init(s->id(),s->pdf_const()); // copy } EST_NgrammarState::~EST_NgrammarState() { clear(); } void EST_NgrammarState::clear() { p_id = -1; p_pdf.clear(); } void EST_NgrammarState::init() { p_id=-1; p_pdf.init(); } void EST_NgrammarState::init(int id,EST_Discrete *d) { p_id = id; p_pdf.init(d); } void EST_NgrammarState::init(int id, const EST_DiscreteProbDistribution &pdf) { p_id = id; p_pdf = pdf; // copy it } ostream& operator<<(ostream& s, const EST_NgrammarState &a) { s << "(" << a.id() << ": " << a.pdf_const() << " )"; return s; } // ********************************************************************** EST_BackoffNgrammarState::~EST_BackoffNgrammarState() { p_pdf.clear(); children.clear(); } void EST_BackoffNgrammarState::clear() { backoff_weight=0; p_pdf.clear(); } void EST_BackoffNgrammarState::init() { backoff_weight=0; p_pdf.init(); } void EST_BackoffNgrammarState::init(const EST_Discrete *d,int level) { backoff_weight=0; p_level = level; p_pdf.init(d); } void EST_BackoffNgrammarState::init(const EST_DiscreteProbDistribution &pdf, int level) { backoff_weight=0; p_level = level; p_pdf = pdf; // copy it } bool EST_BackoffNgrammarState::accumulate(const EST_StrVector &words, const double count) { // int i; // cerr << "accumulate "; // for(i=0;i 0) // not at bottom of tree { EST_BackoffNgrammarState *s; // have we got the child s = get_child(words(words.n()-1-p_level)); if (s==NULL) // have to extend the tree s = add_child(p_pdf.get_discrete(),words); return s->accumulate(words,count); } else { return true; } } bool EST_BackoffNgrammarState::accumulate(const EST_IVector &words, const double count) { // int i; // cerr << "accumulate level " << p_level << " : "; // for(i=0;i 0) // not at bottom of tree { EST_BackoffNgrammarState *s; // have we got the child s = get_child(words(words.n()-1-p_level)); if (s==NULL) // have to extend the tree s = add_child(p_pdf.get_discrete(),words); // get pointer again in case we built more than one level s = get_child(words(words.n()-1-p_level)); if (s==NULL) { cerr << "Failed to extend tree - unknown reason !" << endl; return false; } return s->accumulate(words,count); } else { return true; } } EST_BackoffNgrammarState* EST_BackoffNgrammarState::add_child(const EST_Discrete *d, const EST_StrVector &words) { EST_BackoffNgrammarState *s; if (words.n()-1-p_level > 0) // more history still to go { // see if we can go down the tree s = get_child(words(words.n()-1-p_level)); if (s != NULL) return s->add_child(d,words); else { // construct tree as we go EST_BackoffNgrammarState *new_child = new EST_BackoffNgrammarState; new_child->init(d,p_level+1); children.add(words(words.n()-1-p_level), (void*)new_child); return new_child->add_child(d,words); } } else { // this is the node we are trying to add ! return this; } } EST_BackoffNgrammarState* EST_BackoffNgrammarState::add_child(const EST_Discrete *d, const EST_IVector &words) { EST_BackoffNgrammarState *s; if (words.n()-1-p_level > 0) // more history still to go { // see if we can go down the tree s = get_child(words(words.n()-1-p_level)); if (s != NULL) return s->add_child(d,words); else { // construct tree as we go EST_BackoffNgrammarState *new_child = new EST_BackoffNgrammarState; new_child->init(d,p_level+1); children.add(p_pdf.get_discrete()->name(words(words.n()-1-p_level)), (void*)new_child); return new_child->add_child(d,words); } } else { // this is the node we are trying to add ! return this; } } void EST_BackoffNgrammarState::remove_child(EST_BackoffNgrammarState *child, const EST_String &name) { child->zap(); // can't remove from StringTrie, but can set pointer to NULL children.add(name,NULL); delete child; } void EST_BackoffNgrammarState::print_freqs(ostream &os, const int order, EST_String followers) { // not right - just print out, then recurse through children // change to use 'backoff_traverse' EST_Litem *k; double freq; EST_String name; for (k=p_pdf.item_start(); !p_pdf.item_end(k); k = p_pdf.item_next(k)) { p_pdf.item_freq(k,name,freq); EST_BackoffNgrammarState *s = ((EST_BackoffNgrammarState*)(children.lookup(name))); if (p_level==order-1) { if(freq>0) os << name << " " << followers << ": " << freq << endl; } else if (s!=NULL) s->print_freqs(os,order,name+" "+followers); } } bool EST_BackoffNgrammarState::ngram_exists(const EST_StrVector &words, const double threshold) const { const EST_BackoffNgrammarState *s; s = get_state(words); if (s != NULL) { // return true for unigrams (state level 0) // even if freq < threshold return (bool)((s->level()==0) || ( s->frequency(words(0)) > threshold )); } else return false; } const EST_BackoffNgrammarState *const EST_BackoffNgrammarState::get_state(const EST_StrVector &words) const { EST_BackoffNgrammarState *s; if (words.n()-1-p_level > 0) // more history still to go { s = get_child(words(words.n()-1-p_level)); if (s != NULL) { //cerr << "traversing from " << *this << endl; //cerr << " to " << *s << endl << endl; return s->get_state(words); } else { //cerr << "got NULL" << endl; return NULL; } } else { //cerr << "got " << *this << endl; return this; } } void EST_BackoffNgrammarState::zap() { // recursively delete this state and all its children EST_Litem *k; double freq; EST_String name; for (k=p_pdf.item_start(); !p_pdf.item_end(k); k = p_pdf.item_next(k)) { p_pdf.item_freq(k,name,freq); EST_BackoffNgrammarState *child = get_child(name); if (child!=NULL) remove_child(child,name); } children.clear(); p_pdf.clear(); } const double EST_BackoffNgrammarState::get_backoff_weight(const EST_StrVector &words) const { EST_BackoffNgrammarState *s; if (words.n()-1-p_level >= 0) { s = get_child(words(words.n()-1-p_level)); if (s != NULL) return s->get_backoff_weight(words); else { // if there is no node, the weight would have been 1 anyway //cerr << "Couldn't get weight for " << words << endl; return 1; // default } } else { // reached node /* cerr << "got bw for "; for(int i=0;i 0" << endl; return false; } p_order = o; p_representation = r; p_number_of_sentences = 0; switch(p_representation) { case EST_Ngrammar::sparse: sparse_representation.init(p_order); return true; break; case EST_Ngrammar::dense: return init_dense_representation(); break; case EST_Ngrammar::backoff: return init_backoff_representation(); break; default: cerr << "Unknown internal representation requested for EST_Ngrammar" << endl; return false; break; } } bool EST_Ngrammar::init_dense_representation() { // allocate a flattened N-dimensional matrix of states int i; if (vocab->length() <= 0) { cerr << "EST_Ngrammar: dense_representation requires explicit vocab" << endl; return false; } p_num_states = (int)pow(float(vocab->length()),float(p_order-1)); p_states = new EST_NgrammarState[p_num_states]; for (i=0; i < p_num_states; i++) p_states[i].init(i,pred_vocab); return true; } bool EST_Ngrammar::init_sparse_representation() { if (vocab->length() <= 0) { cerr << "EST_Ngrammar: dense_representation requires explicit vocab" << endl; return false; } p_num_states = (int)pow(float(vocab->length()),float(p_order-1)); p_states = new EST_NgrammarState[p_num_states]; return (bool)(p_states != NULL); } bool EST_Ngrammar::init_backoff_representation() { // nothing much to do backoff_representation = new EST_BackoffNgrammarState; backoff_representation->init(vocab,0); return true; } const EST_StrVector &EST_Ngrammar::make_ngram_from_index(const int index) const { int i,ind=index; EST_StrVector *ngram = new EST_StrVector; ngram->resize(p_order-1); // exclude last word // matches 'find_dense_state_index' so first word is most significant // also, cannot fill in last word for(i=p_order-2;i>=0;i--) { #if defined(sun) && ! defined(__svr4__) /* SunOS */ int rem = ind%vocab->length(); int quot = ind/vocab->length(); (*ngram)[i] = wordlist_index(rem); ind = quot; #else div_t d = div(ind,vocab->length()); (*ngram)[i] = wordlist_index(d.rem); ind = d.quot; #endif } return *ngram; } bool EST_Ngrammar::init_vocab(const EST_StrList &word_list) { vocab = new EST_Discrete(); if(!vocab->init(word_list)) return false; pred_vocab = vocab; // same thing in this case vocab_pdf.init(pred_vocab); return (bool)(vocab != NULL); } bool EST_Ngrammar::init_vocab(const EST_StrList &word_list, const EST_StrList &pred_list) { vocab = new EST_Discrete(); if(!vocab->init(word_list)) return false; pred_vocab = new EST_Discrete(); if(!pred_vocab->init(pred_list)) return false; vocab_pdf.init(pred_vocab); return (bool)(vocab != NULL); } bool EST_Ngrammar::check_vocab(const EST_StrList &word_list) { EST_Discrete *comp_vocab = new EST_Discrete(); if(!comp_vocab->init(word_list)) { delete comp_vocab; return false; } if(*vocab != *comp_vocab) { delete comp_vocab; return false; } delete comp_vocab; return true; } const EST_String & EST_Ngrammar::wordlist_index(int i) const { return vocab->name(i); } int EST_Ngrammar::predlist_index(const EST_String &word) const { if (word=="") // can't lookup return -1; int i; i = pred_vocab->index(word); if(i >= 0 ) return i; cerr << "Word \"" << word << "\" is not in the predictee word list" << endl; if (allow_oov) { i = pred_vocab->index(OOV_MARKER); if(i >= 0) return i; cerr << "Even " << OOV_MARKER << " is not in the predictee word list !" << endl; } return -1; } const EST_String & EST_Ngrammar::predlist_index(int i) const { return pred_vocab->name(i); } int EST_Ngrammar::wordlist_index(const EST_String &word, const bool report) const { if (word=="") // can't lookup return -1; int i; i = vocab->index(word); if(i >= 0 ) return i; if(report) cerr << "Word \"" << word << "\" is not in the word list" << endl; if (allow_oov) { i = vocab->index(OOV_MARKER); if(i >= 0) return i; if(report) cerr << "Even " << OOV_MARKER << " is not in the word list !" << endl; } return -1; } bool EST_Ngrammar::build(const EST_StrList &filenames, const EST_String &prev, const EST_String &prev_prev, const EST_String &last, const EST_String &input_format, const EST_String &oov_mode, const int mincount, const int maxcount) { p_sentence_start_marker = prev; p_sentence_end_marker = last; // when backing off, safest modes ... if( (p_representation == EST_Ngrammar::backoff) && (oov_mode != "skip_file") && (oov_mode != "skip_sentence")) cerr << "Warning : building a backoff grammar" << endl << " with oov_mode '" << oov_mode << "' is not recommended !" << endl; if( (oov_mode != "skip_ngram") && (oov_mode != "skip_sentence") && (oov_mode != "skip_file") && (oov_mode != "use_oov_marker") ) { cerr << "Unknown oov_mode '" << oov_mode << "'" << endl; return false; } if( (oov_mode == "skip_sentence") && (input_format == "ngram_per_line")) { cerr << "Sorry, with input format 'ngram_per_line' you cannot " << endl << " select oov_mode 'skip_sentence'" << endl; return false; } if(oov_mode == "use_oov_marker") allow_oov = true; else allow_oov = false; bool skip_this; EST_String new_filename; EST_Litem *p; for (p = filenames.head(); p; p = p->next()) { cerr << "Building from " << filenames(p) << endl; skip_this=false; if( ((oov_mode == "skip_sentence") && (input_format == "sentence_per_file")) || (oov_mode == "skip_file") ) skip_this = oov_preprocess(filenames(p),new_filename, "skip if found"); else if( ((oov_mode == "skip_sentence") && (input_format == "sentence_per_line")) || ((oov_mode == "skip_ngram") && (input_format == "ngram_per_line")) ) oov_preprocess(filenames(p),new_filename,"eliminate lines"); else new_filename = filenames(p); if(skip_this) { cerr << "Skipping " << filenames(p) << " (out of vocabulary words found)" << endl; } else { switch(p_representation) { case EST_Ngrammar::sparse: { if (input_format != "") { cerr << "Can't build sparse ngram from '" << input_format; cerr << "' data" << endl; return false; } else if (!build_sparse(new_filename,prev,prev_prev,last)) return false; } break; case EST_Ngrammar::dense: if (!build_ngram(new_filename,prev,prev_prev,last,input_format)) return false; break; case EST_Ngrammar::backoff: if (!build_ngram(new_filename,prev,prev_prev,last,input_format)) return false; break; default: cerr << "Unknown internal representation set for EST_Ngrammar" << endl; return false; break; } } if((new_filename != filenames(p)) && (new_filename != "") && !delete_file(new_filename) ) { cerr << "Warning : couldn't remove temporary file : " << new_filename << endl; } } // loop round files if (p_representation == EST_Ngrammar::backoff) return compute_backoff_weights(mincount,maxcount); return true; } void EST_Ngrammar::accumulate(const EST_StrVector &words, const double count) { if (words.n() < p_order) cerr << "EST_Ngrammar::accumulate - window is too small" << endl; else { p_num_samples++; const EST_String &w = lastword(words); vocab_pdf.cumulate(w,count); switch(p_representation) { case EST_Ngrammar::dense: case EST_Ngrammar::sparse: find_state(words).cumulate(w,count); break; case EST_Ngrammar::backoff: backoff_representation->accumulate(words,count); break; default: cerr << "EST_Ngrammar::accumulate : invalid representation !" << endl; break; } } // switch } void EST_Ngrammar::accumulate(const EST_IVector &words, const double count) { /* int i; for(i=0;iaccumulate(words,count); break; default: cerr << "EST_Ngrammar::accumulate : invalid representation !" << endl; break; } // switch } } bool EST_Ngrammar::ngram_exists(const EST_StrVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: return false; break; case EST_Ngrammar::dense: return true; // always exists ! break; case EST_Ngrammar::backoff: { if(words.n()==1) return backoff_representation->ngram_exists(words,0); else return backoff_representation->ngram_exists(words,backoff_threshold); } break; default: cerr << "ngram_exists: unknown ngrammar representation" << endl; break; } return false; } bool EST_Ngrammar::ngram_exists(const EST_StrVector &words, const double threshold) const { if (p_representation != EST_Ngrammar::backoff) { cerr << "Not a backoff grammar !" << endl; return false; } return backoff_representation->ngram_exists(words,threshold); } const double EST_Ngrammar::get_backoff_weight(const EST_StrVector &words) const { if(p_representation == EST_Ngrammar::backoff) return backoff_representation->get_backoff_weight(words); else { cerr << "Can't get backoff weight - not a backed off ngrammar !" << endl; return 0; } } bool EST_Ngrammar::set_backoff_weight(const EST_StrVector &words, const double w) { if(p_representation == EST_Ngrammar::backoff) return backoff_representation->set_backoff_weight(words,w); else { cerr << "Can't set backoff weight - not a backed off ngrammar !" << endl; return false; } } bool EST_Ngrammar::build_sparse(const EST_String &filename, const EST_String &prev, const EST_String &prev_prev, const EST_String &last) { sparse_representation.build(filename,prev,prev_prev,last); return true; } void EST_Ngrammar::fill_window_start(EST_IVector &window, const EST_String &prev, const EST_String &prev_prev) const { int i; for (i=0; i1) && (window(p_order-2) == -1)) bad_word = p_order-1; else bad_word=0; if(bad_word > 0) cerr << "at start : bad word at " << bad_word << endl; } while (!ts.eof()) { s=ts.get().string(); if (s != "") { if(sliding_window) { slide(window,-1); if (bad_word > 0) bad_word--; window[p_order-1] = wordlist_index(s); if (window(p_order-1) < 0) { cerr << "EST_Ngrammar::build_ngram " << " word \"" << s << "\" is not in vocabulary, skipping" << endl; bad_word = p_order; } if (bad_word == 0) accumulate(window); else { cerr << "not accumulating : bad word at " << bad_word; cerr << " window=" << window; // l<< endl; bad_word--; } } else { // not a sliding window - wait for end of line and accumulate if(count < p_order) { if(count == p_order-1) // last thing in window (predictee) window[count++] = predlist_index(s); else // not last thing (predictor) window[count++] = wordlist_index(s); if (window(count-1) < 0) { cerr << "EST_Ngrammar::build_ngram " << " word \"" << s << "\" is not in vocabulary, skipping" << endl; bad_word = 1; } } else cerr << "Too many items on line - ignoring trailing ones !" << endl; } } // end of sentence ? if(ts.eoln()) { if(!sliding_window) { if((count == p_order) && bad_word == 0) accumulate(window); count = 0; bad_word = 0; } else if (eoln_is_eos) { // have there been any accumulates since the last increment if (window(p_order-1) != wordlist_index(last)) p_number_of_sentences += 1; slide(window,-1); window[p_order-1] = wordlist_index(last); if(window(p_order-1) == -1) { //cerr << "WARNING : skipping over bad word '" //<< last << "'" << endl; bad_word = p_order; } if (bad_word == 0) accumulate(window); fill_window_start(window,prev,prev_prev); // check for bad tags if (window(p_order-1) == -1) bad_word = p_order; else if( (p_order>1) && (window(p_order-2) == -1) ) bad_word = p_order-1; else bad_word=0; } } } // if last accumulate was at end of sentence // we don't need to do the extra accumulate if ( sliding_window && (window(p_order-1) != wordlist_index(prev))) { // and finish with the ngram [.....last few words,last] slide(window,-1); window[p_order-1] = wordlist_index(last); if (window(p_order-1) == -1) bad_word=p_order; if (bad_word == 0) { accumulate(window); p_number_of_sentences += 1; } } ts.close(); cerr << "Accumulated " << p_number_of_sentences << " sentences." << endl; return true; } void compute_backoff_weight(EST_Ngrammar *n, EST_StrVector &ngram, void*) { int i,j; double sum1=0,sum2=0; EST_StrVector new_ngram; new_ngram.resize(ngram.n()-1); for(i=0;ingram_exists(new_ngram)) { cerr << " NONE"; // if ngram really exists, but was below threshold // set backoff weight to 1 (always back off) if (n->ngram_exists(new_ngram,0)) { if(!n->set_backoff_weight(new_ngram,1)) cerr << "WARNING : couldn't set weight !" << endl; cerr << " = 1"; } cerr << endl; return; } // save EST_String tmp = ngram(ngram.n()-1); // for each possible word in the last position for(j=0;jget_pred_vocab_length();j++) { ngram[ngram.n()-1] = n->get_pred_vocab_word(j); for(i=0;ingram_exists(ngram)) { cerr << n->probability(ngram) << " exists " << endl; // if we have the complete ngram, add it to sum1 sum1 += n->probability(ngram); } else { // make this faster - take out of loop // or add the n-1 gram, excluding the first word to sum2 EST_StrVector tmp_ngram; tmp_ngram.resize(ngram.n()-1); for(i=0;iprobability(tmp_ngram); } } // and fill in the backoff weight if (sum2 == 0) // no unseen ngrams, no backing off { if(!n->set_backoff_weight(new_ngram,1)) cerr << "WARNING : couldn't set weight !" << endl; cerr << 0 << endl; } else { if (sum1 > 1) { cerr << "NEGATIVE WEIGHT for "; for(i=0;iget_pred_vocab_length();j++) { ngram[ngram.n()-1] = n->get_pred_vocab_word(j); if (n->ngram_exists(ngram)) { for(i=0;iaccumulate(words,0); } } void EST_Ngrammar::prune_backoff_representation(EST_BackoffNgrammarState *start_state) { if (start_state == NULL) start_state = backoff_representation; //cerr << "pruning state " << start_state << endl << *start_state << endl; // remove any branches with zero frequency count // find children of this state with zero freq and zap them EST_Litem *k; double freq; EST_String name; for (k=start_state->pdf_const().item_start(); !start_state->pdf_const().item_end(k); k = start_state->pdf_const().item_next(k)) { start_state->pdf_const().item_freq(k,name,freq); if (freq < TINY_FREQ) { EST_BackoffNgrammarState *child = start_state->get_child(name); if (child!=NULL) { //cerr << "Zapping " << name << " : " << child->level() //<< " " << child<< endl; start_state->remove_child(child,name); } } } // then recurse through remaining children for (k=start_state->pdf_const().item_start(); !start_state->pdf_const().item_end(k); k = start_state->pdf_const().item_next(k)) { start_state->pdf_const().item_freq(k,name,freq); EST_BackoffNgrammarState *child = start_state->get_child(name); if (child!=NULL) { //cerr << "recursing to " << name << " : " << child->level() << endl; //if((child!=NULL) && (child->level() == 3)) //cerr << *child << endl; prune_backoff_representation(child); } } } ostream& operator<<(ostream& s, EST_Ngrammar &n) { switch(n.p_representation) { case EST_Ngrammar::sparse: n.sparse_representation.print_freqs(s); break; case EST_Ngrammar::dense: s << "Dense" << endl; // s << n.dense_representation << endl; break; case EST_Ngrammar::backoff: s << "Backoff" << endl; s << *(n.backoff_representation) << endl; break; default: cerr << "Unknown internal representation of EST_Ngrammar : can't print" << endl; break; } return s; } bool EST_Ngrammar::set_entry_type(EST_Ngrammar::entry_t new_type) { if (new_type == p_entry_type) return true; // entry type conversion --- hmmmmm cerr << "Couldn't do entry type conversion !" << endl; return false; } bool EST_Ngrammar::sparse_to_dense() { cerr << "EST_Ngrammar::sparse_to_dense() " <<" not implemented" << endl; return false; } bool EST_Ngrammar::dense_to_sparse() { cerr << "EST_Ngrammar::dense_to_sparse()" <<" not implemented" << endl; return false; } int EST_Ngrammar::find_dense_state_index(const EST_IVector &words, int index) const { int i,ind=0; for(i=0;ilength() + words.a_no_check(i+index); return ind; } int EST_Ngrammar::find_next_state_id(int state, int word) const { // Find a new state index from the current after moving with word int i,f; if (p_order == 1) return 0; for (f=1,i=0; ilength(); return ((state%f)*vocab->length())+word; } EST_NgrammarState &EST_Ngrammar::find_state(const EST_StrVector &words) { switch(p_representation) { case EST_Ngrammar::sparse: // return p_states[sparse_representation.find_state(words)]; return p_states[0]; break; case EST_Ngrammar::dense: { EST_IVector tmp(words.n()); int i; for(i=0;iindex(words(i)); if (tmp(i) == -1) break; return p_states[find_dense_state_index(tmp)]; } break; case EST_Ngrammar::backoff: cerr << "find_state: not valid in backoff mode !" << endl; break; default: cerr << "find_state: unknown ngrammar representation" << endl; break; } return p_states[0]; } const EST_NgrammarState & EST_Ngrammar::find_state_const(const EST_StrVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: // return p_states[sparse_representation.find_state(words)]; return p_states[0]; break; case EST_Ngrammar::dense: { EST_IVector tmp(words.n()); int i; for(i=0;iindex(words(i)); if (tmp(i) == -1) break; return p_states[find_dense_state_index(tmp)]; } break; case EST_Ngrammar::backoff: cerr << "find_state_const: not valid in backoff mode !" << endl; break; default: cerr << "find_state: unknown ngrammar representation" << endl; break; } return p_states[0]; } EST_NgrammarState &EST_Ngrammar::find_state(const EST_IVector &words) { switch(p_representation) { case EST_Ngrammar::sparse: // return p_states[sparse_representation.find_state(words)]; return p_states[0]; break; case EST_Ngrammar::dense: return p_states[find_dense_state_index(words)]; break; case EST_Ngrammar::backoff: cerr << "find_state: not valid in backoff mode !" << endl; break; default: cerr << "find_state: unknown ngrammar representation" << endl; break; } return p_states[0]; } const EST_NgrammarState & EST_Ngrammar::find_state_const(const EST_IVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: // return p_states[sparse_representation.find_state(words)]; return p_states[0]; break; case EST_Ngrammar::dense: return p_states[find_dense_state_index(words)]; break; case EST_Ngrammar::backoff: cerr << "find_state_const: not valid in backoff mode !" << endl; break; default: cerr << "find_state: unknown ngrammar representation" << endl; break; } return p_states[0]; } bool EST_Ngrammar::set_representation(EST_Ngrammar::representation_t new_representation) { if (new_representation == p_representation) return true; if (new_representation == EST_Ngrammar::sparse) return sparse_to_dense(); else if (new_representation == EST_Ngrammar::dense) return dense_to_sparse(); else { cerr << "set_representation: unknown ngrammar representation" << endl; return FALSE; } } double EST_Ngrammar::probability(const EST_StrVector &words, bool force, const bool trace) const { // Probability of this ngram (void)force; switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: return find_state_const(words).probability(lastword(words)); break; case EST_Ngrammar::backoff: return backoff_probability(words,trace); break; default: cerr << "probability: unknown ngrammar representation" << endl; return -1; break; } } double EST_Ngrammar::frequency(const EST_StrVector &words, bool force, const bool trace) const { // Frequency of this ngram (void)force; switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: return find_state_const(words).frequency(lastword(words)); break; case EST_Ngrammar::backoff: return backoff_probability(words,trace); // can't do freqs break; default: cerr << "probability: unknown ngrammar representation" << endl; return -1; break; } } const EST_String &EST_Ngrammar::predict(const EST_StrVector &words, double *prob,int *state) const { // What's the most probable word given this list of words switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); *state = s.id(); return s.most_probable(prob); } break; case EST_Ngrammar::backoff: state=NULL; // there are no states per se return backoff_most_probable(words,prob); break; default: cerr << "probability: unknown ngrammar representation" << endl; return EST_String::Empty; break; } } const EST_String &EST_Ngrammar::predict(const EST_IVector &words, double *prob,int *state) const { // What's the most probable word given this list of words switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); *state = s.id(); return s.most_probable(prob); } break; case EST_Ngrammar::backoff: cerr << "probability: IVector access to backoff not supported" << endl; return EST_String::Empty; break; default: cerr << "probability: unknown ngrammar representation" << endl; return EST_String::Empty; break; } } int EST_Ngrammar::find_state_id(const EST_StrVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); return s.id(); } default: cerr << "Ngrammar: representation doesn't support states" << endl; return 0; break; } } int EST_Ngrammar::find_state_id(const EST_IVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); return s.id(); } default: cerr << "Ngrammar: representation doesn't support states" << endl; return 0; break; } } EST_String EST_Ngrammar::get_vocab_word(int i) const { if (vocab) return vocab->name(i); else return NOVOCAB; } int EST_Ngrammar::get_vocab_word(const EST_String &s) const { int index = vocab->name(s); return index; } double EST_Ngrammar::reverse_probability(const EST_StrVector &words, bool force) const { // Whats the probability of this ngram-1 given last word in ngram (void)force; switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); // need number of occurrences of words[p_order-1] return s.frequency(lastword(words))/ vocab_pdf.frequency(lastword(words)); } break; case EST_Ngrammar::backoff: return backoff_reverse_probability(words); break; default: cerr << "probability: unknown ngrammar representation" << endl; return -1; break; } } double EST_Ngrammar::reverse_probability(const EST_IVector &words, bool force) const { // Whats the probability of this ngram-1 given last word in ngram (void)force; switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); // need number of occurrences of words[p_order-1] return s.frequency(lastword(words))/ vocab_pdf.frequency(lastword(words)); } break; case EST_Ngrammar::backoff: cerr << "probability: reverse prob unavailable for backoff ngram" << endl; return -1; break; default: cerr << "probability: unknown ngrammar representation" << endl; return -1; break; } } const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist(int state) const { return p_states[state].pdf_const(); } const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist(const EST_StrVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); return s.pdf_const(); } break; case EST_Ngrammar::backoff: return backoff_prob_dist(words); break; default: cerr << "probability: unknown ngrammar representation" << endl; return PSTnullProbDistribution; break; } } const EST_DiscreteProbDistribution & EST_Ngrammar::prob_dist(const EST_IVector &words) const { switch(p_representation) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { const EST_NgrammarState &s = find_state_const(words); return s.pdf_const(); } break; case EST_Ngrammar::backoff: cerr << "probability: unsupport IVector access of backoff ngram" << endl; return PSTnullProbDistribution; break; default: cerr << "probability: unknown ngrammar representation" << endl; return PSTnullProbDistribution; break; } } EST_read_status EST_Ngrammar::load(const EST_String &filename) { EST_read_status r_val; //if ((r_val = load_ngram_htk_ascii(filename, *this)) != wrong_format) //return r_val; //if ((r_val = load_ngram_htk_binary(filename, *this)) != wrong_format) //return r_val; if ((r_val = load_ngram_cstr_ascii(filename, *this)) != wrong_format) return r_val; if ((r_val = load_ngram_cstr_bin(filename, *this)) != wrong_format) return r_val; // maybe the file is compressed ? EST_Pathname fname(filename); EST_String tmp_fname(""); // crude but effective if (fname.extension() == GZIP_FILENAME_EXTENSION) tmp_fname = uncompress_file_to_temporary(filename, "gzip --decompress --stdout"); else if (fname.extension() == COMPRESS_FILENAME_EXTENSION) tmp_fname = uncompress_file_to_temporary(filename,"uncompress -c"); if(tmp_fname != "") { r_val = load(tmp_fname); delete_file(tmp_fname); return r_val; } else return misc_read_error; cerr << "EST_Ngrammar::load can't determine ngrammar file type for input file " << filename << endl; return wrong_format; } EST_read_status EST_Ngrammar::load(const EST_String &filename, const EST_StrList &wordlist) { // for backed off grammars // need a wordlist to load ARPA format EST_read_status r_val; if ((r_val = load_ngram_arpa(filename, *this, wordlist)) != wrong_format) return r_val; // try other types, then check wordlist fits //if ((r_val = load_ngram_htk_ascii(filename, *this)) != wrong_format) //return r_val; //if ((r_val = load_ngram_htk_binary(filename, *this)) != wrong_format) //return r_val; if ((r_val = load_ngram_cstr_ascii(filename, *this)) != wrong_format) { if ((r_val == format_ok) && check_vocab(wordlist)) return r_val; else { cerr << "Wordlist file does not match grammar wordlist !" << endl; return misc_read_error; } } if ((r_val = load_ngram_cstr_bin(filename, *this)) != wrong_format) { if ((r_val == format_ok) && check_vocab(wordlist)) return r_val; else { cerr << "Wordlist does not match grammar !" << endl; return misc_read_error; } } cerr << "EST_Ngrammar::load can't determine ngrammar file type for input file " << filename << endl; return wrong_format; } void EST_Ngrammar::make_htk_compatible() { cerr << "EST_Ngrammar::make_htk_compatible() not written yet." << endl; return; } EST_write_status EST_Ngrammar::save(const EST_String &filename, const EST_String type, const bool trace,double floor) { if (type == "") return save(filename,"cstr_ascii",false,floor); // choose default type if (type == "htk_ascii") return save_ngram_htk_ascii(filename, *this, floor); //if (type == "htk_binary") //return save_htk_binary(filename, *this); if (type == "arpa") return save_ngram_arpa(filename, *this); if (type == "cstr_ascii") return save_ngram_cstr_ascii(filename, *this,trace,floor); if (type == "cstr_bin") return save_ngram_cstr_bin(filename, *this, trace,floor); if (type == "wfst") return save_ngram_wfst(filename, *this); cerr << "EST_Ngrammar::save unknown output file type " << type << endl; return write_fail; } void EST_Ngrammar::iterate(EST_StrVector &words, void (*function)(EST_Ngrammar *n, EST_StrVector &words, void *params), void *params) { int i,j=-1; EST_String tmp; // find next item in ngram to fill in for(i=0;ilength();i++){ words[j] = pred_vocab->name(i); iterate(words,function,params); } } else { for(i=0;ilength();i++){ words[j] = vocab->name(i); iterate(words,function,params); } } words[j] = tmp; } } void EST_Ngrammar::const_iterate(EST_StrVector &words, void (*function)(const EST_Ngrammar *const n, EST_StrVector &words, void *params), void *params) const { int i,j=-1; EST_String tmp; // find next item in ngram to fill in for(i=0;ilength();i++){ words[j] = pred_vocab->name(i); const_iterate(words,function,params); } } else { for(i=0;ilength();i++){ words[j] = vocab->name(i); const_iterate(words,function,params); } } words[j] = tmp; } } void EST_Ngrammar::print_freqs(ostream &os,double floor) { if (p_representation == EST_Ngrammar::backoff) backoff_representation->print_freqs(os,p_order); else { int i,j; EST_Litem *k; EST_IVector window(p_order-1); for (i=0; i < p_num_states; i++) { // print out each ngram : freq for (k=p_states[i].pdf().item_start(); !p_states[i].pdf().item_end(k); k = p_states[i].pdf().item_next(k)) { double freq; EST_String name; int ind = i; p_states[i].pdf().item_freq(k,name,freq); if (freq == 0) freq = floor; if (freq > 0) { for (j = p_order-2; j >= 0; j--) { window[j] = ind%vocab->length(); ind /= vocab->length(); } for (j = 0; j < p_order-1; j++) os << wordlist_index(window(j)) << " "; os << name << " : " << freq << endl; } } } } } const EST_DiscreteProbDistribution & EST_Ngrammar::backoff_prob_dist(const EST_StrVector &words) const { // need to make this on the fly // by looking at all possible words in the final // position int i,j; EST_StrVector ngram; ngram.resize(words.n()+1); for(i=0;iset_frequency(j,tmp); // actually probability } p->set_num_samples(1.0); // we can't do it in frequencies return *p; } const double EST_Ngrammar::get_backoff_discount(const int order, const double freq) const { if(order > p_order) { cerr << "order too great in EST_Ngrammar::get_backoff_discount" << endl; return 0; } else if( (int)freq < backoff_discount[order-1].n()) return backoff_discount[order-1]((int)freq); else return 0; } const double EST_Ngrammar::backoff_probability(const EST_StrVector &words, const bool trace) const { const EST_BackoffNgrammarState *state; int i; EST_StrVector new_ngram; double f=0,f2=0; if (trace) { cerr << "backoff_probability( "; for(i=0;iprobability(words(0)) << endl; f=backoff_representation->frequency(words(0)); // it seems outrageous, but use a floor because unigram // probs of zero mess up backing off if(f>0) return f / backoff_representation->pdf_const().samples(); else return backoff_unigram_floor_freq / backoff_representation->pdf_const().samples(); } // the first n-1 words in the ngram -- deeply inefficient at the moment ! // should pass separately new_ngram.resize(words.n()-1); for(i=0;iget_state(words); if( (state != NULL) && ((f=state->frequency(words(0))) > backoff_threshold) ) { //if (trace) //cerr << "in state " << state << " = " << *state << endl << endl; // because f>0, the freq of new_ngram must be non-zero too // special case - we don't have a freq for !ENTER (or whatever it's called) // so use the no. of sentences used to build this grammar if((new_ngram(0) == p_sentence_start_marker) || (new_ngram(0) == p_sentence_end_marker) ) { f2 = p_number_of_sentences; if (trace) cerr << "special freq used : " << f2 << endl; } else { state=backoff_representation->get_state(new_ngram); if (state == NULL) { cerr << "Something went horribly wrong !" << endl; return -1; } // state->frequency(new_ngram(0)) is the number of times // we saw new_ngram f2=state->frequency(new_ngram(0)); if (trace) { //cerr << "n-1 state is " << *state << endl; cerr << " using freq for " << new_ngram(0) << " of " << f2 << endl; } } if (trace) { cerr << " ..... got (" << f << " - " << get_backoff_discount(state->level()+1,f) << ")/" << f2 << " = " << (f - get_backoff_discount(state->level()+1,f) ) / f2 << endl; } return (f - get_backoff_discount(state->level()+1,f) ) / f2; } else // back off { double bo_wt = get_backoff_weight(new_ngram); for(i=0;iprobability(words(0)) //<< endl; return root->probability(words(0)); } // the first n-1 words in the ngram -- deeply inefficient at the moment ! // should pass separately new_ngram.resize(words.n()-1); for(i=0;iget_state(words); if( (state != NULL) && ((f=state->frequency(words(0))) > 0) ) { // because f>0, the freq of new_ngram must be non-zero too state=root->get_state(new_ngram); if (state == NULL) { cerr << "Something went horribly wrong !" << endl; return -1; } // state->frequency(new_ngram(0)) is the number of times // we saw new_ngram //cerr << "got " << f << "/" << state->frequency(new_ngram(0)) << endl; return f / state->frequency(new_ngram(0)); } else // back off { double bo_wt = root->get_backoff_weight(new_ngram); //double bo_wt = root->get_backoff_weight(words); for(i=0;iget_child(words(words.n()-1)); if(state == NULL) { // predictee isn't there so ......... ??? return 0; } // now find backoff probability of words 0...n-2 // starting from this state return backoff_reverse_probability_sub(words,state); } const EST_String & EST_Ngrammar::backoff_most_probable(const EST_StrVector &words, double *prob) const { return backoff_prob_dist(words).most_probable(prob); } void slide(EST_IVector &v, const int l) { int i; // slide elements by 'l' without wraparound if (l==0) return; else if (l<0) { // slide left for(i=0;i=l;i--) v[i] = v(i-l); for(;i>=0;i--) v[i] = 0; } } void EST_Ngrammar::backoff_traverse(EST_BackoffNgrammarState *start_state, void (*function)(EST_BackoffNgrammarState *s, void *params), void *params) { // apply the function to this node function(start_state,params); // and recurse down the tree EST_Litem *k; double freq; EST_String name; for (k=start_state->pdf_const().item_start(); !start_state->pdf_const().item_end(k); k = start_state->pdf_const().item_next(k)) { start_state->pdf_const().item_freq(k,name,freq); EST_BackoffNgrammarState *child = start_state->get_child(name); if (child!=NULL) backoff_traverse(child,function,params); } } void EST_Ngrammar::backoff_traverse(EST_BackoffNgrammarState *start_state, void (*function)(EST_BackoffNgrammarState *s, void *params), void *params, const int level) { // apply the function to this node, if level is correct if (start_state->level() == level) { function(start_state,params); } else if (start_state->level() < level) { // and recurse down the tree if we haven't // reached the level yet EST_Litem *k; double freq; EST_String name; for (k=start_state->pdf_const().item_start(); !start_state->pdf_const().item_end(k); k = start_state->pdf_const().item_next(k)) { start_state->pdf_const().item_freq(k,name,freq); EST_BackoffNgrammarState *child = start_state->get_child(name); if (child!=NULL) backoff_traverse(child,function,params,level); } } } void merge_other_grammar(EST_Ngrammar *n, EST_StrVector &ngram, void *params) { EST_Ngrammar *other_n = (EST_Ngrammar*)((void**)params)[0]; float *weight = (float*)((void**)params)[1]; if(other_n->ngram_exists(ngram)) n->accumulate(ngram,*weight * other_n->frequency(ngram)); } bool EST_Ngrammar::merge(EST_Ngrammar &n,float weight) { EST_StrVector words; words.resize(p_order); void **params = new void*[2]; params[0] = (void*)&n; params[1] = (void*)&weight; iterate(words,&merge_other_grammar,(void*)params); delete [] params; return true; } void slide(EST_StrVector &v, const int l) { // slide elements by 'l' without wraparound int i; if (l==0) return; else if (l<0) { // slide left for(i=0;i=l;i--) v[i] = v(i-l); for(;i>=0;i--) v[i] = ""; } } speech_tools/grammar/ngram/ngrammar_io.cc0000644000076400007640000005476510722562414017241 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King & Alan W Black */ /* Date : February 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* IO functions for EST_Ngram class */ /* */ /*=======================================================================*/ #include #include #include #include "EST_unix.h" #include #include #include #include "EST_String.h" #include "EST_Ngrammar.h" #include "EST_Token.h" #include "EST_cutils.h" EST_read_status load_ngram_htk_ascii(const EST_String filename, EST_Ngrammar &n) { (void)filename; (void)n; return wrong_format; } EST_read_status load_ngram_htk_binary(const EST_String filename, EST_Ngrammar &n) { (void)filename; (void)n; return wrong_format; } EST_read_status load_ngram_arpa(const EST_String filename, EST_Ngrammar &n, const EST_StrList &vocab) { EST_TokenStream ts; EST_String s; int i,j,k, order=0; double occur,weight; int this_num,this_order; if (ts.open(filename) == -1) return misc_read_error; // find backslash data backslash while ((!ts.eof()) && !ts.get().string().contains("\\data\\")); if (ts.eof()) { ts.close(); return wrong_format; } // find order and numbers of ngrams // somewhere to keep numbers EST_IVector nums(100); // not going to have anything bigger than a 100-gram ! while (!ts.eof()) { // have we got to next section if (ts.peek().string().contains("-grams:")) break; s=ts.get_upto_eoln().string(); if(s.contains("ngram ") && s.contains("=")) { s=s.after("ngram "); this_order=atoi(s.before("=")); this_num=atoi(s.after("=")); //cerr << "There are " << this_num << " " << this_order //<< "-grams" << endl; nums[this_order] = this_num; if(this_order > order) order = this_order; } } if(order==0) { //cerr << "No ngram ?=? in header !" << endl; ts.close(); return wrong_format; } //cerr << "Initialising " << order << "-grammar" << endl; if(!n.init(order,EST_Ngrammar::backoff,vocab)) return misc_read_error; // read data for(i=1;i<=order;i++) { EST_StrVector window(i); // find start of data for this order "-grams:" EST_String tmp = "\\" + itoString(i) + "-grams:"; while (!ts.eof()) { s=ts.get().string(); if (s.contains(tmp)) break; } if(ts.eof()) { cerr << "Unexpected end of grammar file whilst looking for '" << tmp << "'" << endl; return misc_read_error; } //cerr << "Found order " << i << " : " << tmp << endl; //cerr << "Looking for " << nums(i) << " ngrams" << endl; // look for nums(i) ngrams for(j=0;j= num_entries) { cerr << "EST_Ngrammar::load_ngram_cstr_bin unexpected end of frequency data" << endl; ts.close(); fclose(ifd); return misc_read_error; } for (k=n.p_states[i].pdf().item_start(); (!n.p_states[i].pdf().item_end(k)) && (j < num_entries) ; k = n.p_states[i].pdf().item_next(k)) { n.p_states[i].pdf().set_frequency(k,dd[j]); // Update global info too approx_num_samples += dd[j]; // probably not right n.vocab_pdf.cumulate(k,dd[j]); // Number of consecutive occurrences of this frequency as in // dd[j+1] if its a negative number if (j+1 >= num_entries) j++; else if (dd[j+1] < -1) dd[j+1]++; else if (dd[j+1] == -1) j +=2; else j++; } } // With smoothing num_samples might not be as exact as you like n.p_num_samples = (int)approx_num_samples; delete [] dd; ts.close(); fclose(ifd); return format_ok; } // ==================================================================== EST_write_status save_ngram_htk_ascii_sub(const EST_String &word, ostream *ost, EST_Ngrammar &n, double floor) { EST_Litem *k; EST_String name; double freq; EST_StrVector this_ngram(2); // assumes bigram this_ngram[0] = word; EST_DiscreteProbDistribution this_pdf; this_pdf = n.prob_dist(this_ngram); double lfreq=-1; int lcount=0; double total_freq=0; double floor_prob_total = floor * (n.pred_vocab->length()-1); if (word == n.p_sentence_end_marker) { *ost << word; *ost << " 0*" << n.pred_vocab->length()-1 << " " << 1 << endl; return write_ok; } if(floor_prob_total > 1) { cerr << "ERROR : floor is impossibly large, scaling it !" << endl; floor = 1.0 / (double)(n.pred_vocab->length()-1); floor_prob_total = 1; } // not efficient but who cares ? for (k=this_pdf.item_start(); !this_pdf.item_end(k); k = this_pdf.item_next(k)) { this_pdf.item_freq(k,name,freq); if(name != n.p_sentence_start_marker) { total_freq += freq; } } // 0 for prob(word,start marker) *ost << word << " 0 "; if (total_freq <= 0) { *ost << 1.0 / (double)(n.pred_vocab->length()-1) << "*"; *ost << n.pred_vocab->length()-1 << " " << endl; } else { lfreq=-1; for (k=this_pdf.item_start(); !this_pdf.item_end(k); k = this_pdf.item_next(k)) { this_pdf.item_freq(k,name,freq); if ( (name == n.p_sentence_start_marker) || (name == n.p_sentence_end_marker) || (name == OOV_MARKER) ) continue; if (freq == lfreq) lcount++; else { if (lcount > 1) *ost << "*" << lcount << " "; else *ost << " "; lcount=1; lfreq = freq; if(freq > 0) { double base_prob = freq / total_freq; // and floor/scale it *ost << floor + ( base_prob * (1-floor_prob_total) ); } else *ost << floor; } } } // total_freq > 0 if(!n.closed_vocab()) { // not fully tested !!!!!!!! *ost << 0 << " ERROR !!!!!!!! "; } if (total_freq > 0) { freq = this_pdf.frequency(n.p_sentence_end_marker); if(freq == lfreq) { lcount++; *ost << "*" << lcount << " " << endl; } else { if (lcount > 1) *ost << "*" << lcount << " "; else *ost << " "; if(freq > 0) { double base_prob = freq / total_freq; // and floor/scale it *ost << floor + ( base_prob * (1-floor_prob_total) ) << endl; } else *ost << floor << endl; } } return write_ok; } EST_write_status save_ngram_htk_ascii(const EST_String filename, EST_Ngrammar &n, double floor) { ostream *ost; // only for bigram if(n.order() != 2) { cerr << "Can only save bigrams in htk_ascii format" << endl; return misc_write_error; } if (floor < 0) { cerr << "Negative floor probability does not make sense !" << endl; return misc_write_error; } if (filename == "-") ost = &cout; else ost = new ofstream(filename); if(!(*ost)) return write_fail; if(floor * (n.pred_vocab->length()-1) > 1) { floor = 1.0 / (double)(n.pred_vocab->length()-1); cerr << "ERROR : floor is impossibly large, scaling it to "; cerr << floor << endl; } int i; if(n.p_sentence_start_marker == "") { cerr << "Can't save in HTK format as no sentence start/end tags" << " were given !" << endl; return misc_write_error; } // need '!ENTER' (or whatever) as first word- that's HTK for you save_ngram_htk_ascii_sub(n.p_sentence_start_marker,ost,n,floor); // the real words for(i=0;ilength();i++) { if ( (n.vocab->name(i) != n.p_sentence_start_marker) && (n.vocab->name(i) != n.p_sentence_end_marker) && (n.vocab->name(i) != OOV_MARKER) ) save_ngram_htk_ascii_sub(n.vocab->name(i),ost,n,floor); } if(!n.closed_vocab()) save_ngram_htk_ascii_sub(OOV_MARKER,ost,n,floor); save_ngram_htk_ascii_sub(n.p_sentence_end_marker,ost,n,floor); if(ost != &cout) delete ost; return write_ok; } /* EST_write_status save_ngram_htk_binary(const EST_String filename, EST_Ngrammar &n) { return write_ok; } */ void count_ngram_arpa_sub(EST_Ngrammar *n, EST_StrVector &ngram, void *count) { if(n->ngram_exists(ngram)) *((double*)count) += 1; } void save_ngram_arpa_sub(EST_Ngrammar *n, EST_StrVector &ngram, void *ost) { int i; if(n->ngram_exists(ngram)) { *((ostream*)(ost)) << safe_log10(n->probability(ngram)) << " "; for(i=0;irepresentation() == EST_Ngrammar::backoff) && (n->order() > ngram.n()) ) *((ostream*)(ost)) << safe_log10(n->get_backoff_weight(ngram)); //<< " = " //<< n->get_backoff_weight(ngram) << " "; *((ostream*)(ost)) << endl; } } EST_write_status save_ngram_arpa(const EST_String filename, EST_Ngrammar &n) { // ARPA MIT-LL format - see HTK manual !! ostream *ost; int i,num_n,o; if (filename == "-") ost = &cout; else ost = new ofstream(filename); if (!(*ost)) return write_fail; //n.set_entry_type(EST_Ngrammar::probabilities); //n.make_htk_compatible(); // fix enter/exit probs //*ost << *(n.vocab) << endl; // count number of ngrams num_n = (int)n.samples(); *ost << "\\data\\" << endl; double *count = new double; if (n.representation() == EST_Ngrammar::backoff) { for(o=1;o<=n.order();o++) { EST_StrVector ngram(o); for(i=0;ilength(); i++) *ost << n.vocab->name(i) << " "; *ost << endl; for (i=0; i < n.pred_vocab->length(); i++) *ost << n.pred_vocab->name(i) << " "; *ost << endl; if (n.representation() == EST_Ngrammar::dense) n.print_freqs(*ost,floor); else if (n.representation() == EST_Ngrammar::backoff) { int total_ngrams = (int)pow(float(n.get_vocab_length()),float(n.order()-1)); for(i=0;ilength(); i++) fprintf(ost," %s\n",(const char *)n.vocab->name(i)); fprintf(ost," )\"\n"); fprintf(ost,"out \"("); for (i=0; i < n.vocab->length(); i++) fprintf(ost," %s\n",(const char *)n.vocab->name(i)); fprintf(ost," )\"\n"); fprintf(ost,"NumStates %d\n",n.num_states()); fprintf(ost,"EST_Header_End\n"); for (i=0; ilength(); i++) fprintf(ofd,"%s ",(const char *)n.vocab->name(i)); fprintf(ofd,"\n"); for (i=0; i < n.pred_vocab->length(); i++) fprintf(ofd,"%s ",(const char *)n.pred_vocab->name(i)); fprintf(ofd,"\n"); // We use a simple form of run-length encoding, if consecutive // values are equal only a length is printed. lengths are // negative as frequencies (even smoothed ones) can never be -ve if ( trace ) cerr << "Saving ..." << endl; if (n.representation() == EST_Ngrammar::dense) { for(i=0;i #include #include "EST_String.h" #include "EST_Ngrammar.h" static bool ExponentialFit(EST_DVector &N, double &a, double &b, int first, int last) { // fit the function N(r) = e^a * r^b where a,b are constants // to the points N(first)...N(last) inclusive // i.e. a straight line fit in the (natural) log domain // minimising the mean squared error (in log domain), is : // limitation : r must be an integer (it is the index of v) // default if (last == -1) last = N.n()-1; if (first < 0) { cerr << "ExponentialFit : first must be >= 0" << endl; return false; } if (last >= N.n()-1) { cerr << "ExponentialFit : last must be < N.n()-1 = " << N.n()-1 << endl; } if (first == last) { a=log(N(first)); b=0; return true; } double ElnNr=0.0,ElnNrlnr=0.0, Elnr=0.0,Elnr2=0.0, R=0.0; for(int r=first;r<=last;r++) { R += 1; if ( N(r) > 0) { ElnNr += log( N(r) ); ElnNrlnr += log( N(r) ) * log( (double)r ); } Elnr += log( (double)r ); Elnr2 += log( (double)r ) * log( (double)r ); } // and the answer is : b = ( (ElnNr*Elnr/R) - ElnNrlnr ) / ( (Elnr*Elnr/R) - Elnr2); a = (ElnNr - (b*Elnr) ) / R; return true; } static bool smooth_ExponentialFit(EST_DVector &N, int first, int last) { double a=0.0,b=0.0; if (!ExponentialFit(N,a,b,first,last)) { cerr << "smooth_ExponentialFit : ExponentialFit failed !" << endl; return false; } for(int r=first;r<=last;r++) N[r] = exp(a)* pow((double)r, b); return true; } void make_f_of_f(EST_BackoffNgrammarState *s,void *params) { EST_Litem *k; double freq; EST_String name; EST_DVector *ff = (EST_DVector*)params; int max = ff->n(); for (k=s->pdf_const().item_start(); !s->pdf_const().item_end(k); k = s->pdf_const().item_next(k)) { s->pdf_const().item_freq(k,name,freq); if(freq+0.5 < max) (*ff)[(int)(freq+0.5)] += 1; } } void get_max_f(EST_BackoffNgrammarState *s,void *params) { EST_Litem *k; double freq; EST_String name; double *max = (double*)params; for (k=s->pdf_const().item_start(); !s->pdf_const().item_end(k); k = s->pdf_const().item_next(k)) { s->pdf_const().item_freq(k,name,freq); if(freq > *max) *max = freq; } } void map_f_of_f(EST_BackoffNgrammarState *s,void *params) { EST_Litem *k; double freq; EST_String name; //cerr << "map_f_of_f : visited " << *s << endl; EST_DVector *map = (EST_DVector*)params; int max = map->n(); for (k=s->pdf_const().item_start(); !s->pdf_const().item_end(k); k = s->pdf_const().item_next(k)) { s->pdf_const().item_freq(k,name,freq); if (freq+0.5 < max) { double nfreq = (*map)((int)(freq+0.5)); s->pdf().set_frequency(name,nfreq); } } } void zero_small_f(EST_BackoffNgrammarState *s,void *params) { EST_Litem *k; double freq; EST_String name; double *min = (double*)params; for (k=s->pdf_const().item_start(); !s->pdf_const().item_end(k); k = s->pdf_const().item_next(k)) { s->pdf_const().item_freq(k,name,freq); if (freq < *min) { //cerr << "zeroing " << freq << " < " << *min << endl; s->pdf().override_frequency(k,0.0); } } } void frequency_of_frequencies(EST_DVector &ff, EST_Ngrammar &n,int this_order) { int i,size; EST_Litem *k; double max=0.0; // if ff has zero size, do complete frequency of frequencies // otherwise just fill in frequencies from 1 to ff.n()-1 bool complete = (bool)(ff.n() == 0); switch(n.representation()) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { size = n.num_states(); if (complete) { // find highest frequency in EST_Ngram for(i=0;i max) max = n.p_states[i].pdf().samples(); ff.resize((int)(max+1.5)); ff.fill(0.0); } // Sum the frequencies for(i=0;i N.n()-2) { maxcount = N.n()-2; cerr << "adjusted_frequencies_BasicGoodTuring :"; cerr << " maxcount is too big, reducing it to " << maxcount << endl; } M.resize(N.n()); int r; for(r=0; r<=maxcount;r++) { // don't like this bit, but what can you do ? if( (N(r+1) == 0) || (N(r) == 0) ) M[r] = r; else M[r] = (r + 1) * N(r+1) / N(r); } // and do not map higher counts for(;r N.n()-2) { maxcount = N.n()-2; cerr << "smoothed_frequency_distribution_ExponentialFit :" << " maxcount too big, reducing it to " << maxcount << endl; } // the idea to fit this particular fn was by Steve Isard // we ignore r=0 in doing the fit if (!smooth_ExponentialFit(N,1,maxcount+1)) cerr << "smooth_ExponentialFit failed !" << endl; return; } bool Good_Turing_smooth(EST_Ngrammar &ngrammar, int maxcount, int mincount) { // works for any N // since it just remaps frequencies // frequencies above maxcount are not changed // for discounting -- see discount routine ! if (ngrammar.entry_type() != EST_Ngrammar::frequencies) { cerr << "EST_Ngram: cannot Good-Turing smooth ngram:" << " entries are not frequencies" << endl; return false; } switch(ngrammar.representation()) { case EST_Ngrammar::sparse: case EST_Ngrammar::dense: { EST_DVector freqs,mapped_freqs; // grammar is of a single order - simple // Find frequency distribution frequency_of_frequencies(freqs,ngrammar); // smoothing should be optional - to do smoothed_frequency_distribution_ExponentialFit(freqs,maxcount-1); // Build map of frequencies adjusted_frequencies_BasicGoodTuring(mapped_freqs,freqs,maxcount); // Map all frequencies in grammar to Good Turing Smoothed values map_frequencies(ngrammar,mapped_freqs); } break; case EST_Ngrammar::backoff: { cerr << "Smoothing of backed of grammars is not available!" << endl; return false; (void)mincount; /* // need to smooth for each order independently int i,o; double threshold; //for (o=1;o<=ngrammar.order();o++) for(o=ngrammar.order();o<=ngrammar.order();o++) { EST_DVector freqs,mapped_freqs; frequency_of_frequencies(freqs,ngrammar,o); cerr << "FREQ : " << freqs << endl; if(freqs.n() < 2) { // i.e. only unseen things - zero them all threshold = 2; // 1 ? if(o>1) ngrammar.backoff_traverse(ngrammar.backoff_representation, &zero_small_f, (void*)(&threshold), o-1); continue; } int max = maxcount; if(max > freqs.n() - 2) max = freqs.n() - 2; if(max > 2) // need at least 3 points // smoothing should be optional - to do smoothed_frequency_distribution_ExponentialFit(freqs,max); cerr << "SMOOTHED : " << freqs << endl; adjusted_frequencies_BasicGoodTuring(mapped_freqs,freqs,max); // initial map of frequencies modifies total counts // so pdfs are correct map_frequencies(ngrammar,mapped_freqs,o); cerr << "Map for " << o << " : "; for(i=0;i freqs.n() - 2) max = freqs.n() - 2; if(max > 2) { // need at least 3 points // smoothing should be optional - to do // April 97 // to overcome problems with N(x)=0, shift data points, fit, and shift back for(i=0;i<=max+1;i++) freqs[i] += 1; smoothed_frequency_distribution_ExponentialFit(freqs,max); for(i=0;i<=max+1;i++) { freqs[i] -= 1; // possibly unnecesary check if ( freqs(i) < 0 ) freqs[i] = 0; } } adjusted_frequencies_BasicGoodTuring(mapped_freqs,freqs,max); // and put it in the discount array ngrammar.backoff_discount[o-1].resize(freqs.n()); for(i=(int)ngrammar.backoff_threshold;i<=max;i++) { ngrammar.backoff_discount[o-1][i] = (double)i - mapped_freqs(i); // sanity check if( ngrammar.backoff_discount[o-1][i] < 0) { ngrammar.backoff_discount[o-1][i] = 0; } } for(;i #include #include "EST_String.h" #include "EST_Token.h" #include "EST_error.h" #include "EST_Ngrammar.h" static int get_next_window(EST_TokenStream &ts, EST_StrVector &window, const EST_String &input_format, EST_Ngrammar &ngram) { int i; if ((input_format == "sentence_per_line") || (input_format == "sentence_per_file")) { EST_String t = ts.get().string(); slide(window,-1); window[ngram.order()-1] = t; if (ngram.wordlist_index(t) == -1) cerr << "EST_Ngrammar test: skipping bad word \"" << t << "\"" << endl; } else if (input_format == "ngram_per_line") { for (i=0; i < ngram.order(); i++) { EST_String t = ts.get().string(); window[i] = t; if (ngram.wordlist_index(t) == -1) cerr << "EST_Ngrammar test: skipping bad word \"" << t << "\"" << endl; } } else EST_error("EST_Ngrammar test: unknown input format \"%s\"\n", (const char *)input_format); // Sigh, you pull a little thread and it all falls down // For the time being can only deal in StrVectors rather than // IVectors for (i=0; i < ngram.order(); i++) if (ngram.wordlist_index(window(i)) == -1) return FALSE; return TRUE; } bool test_stats(EST_Ngrammar &ngram, const EST_String &filename, double &raw_entropy, double &count, double &entropy, double &perplexity, const EST_String &input_format, const EST_String &prev, const EST_String &prev_prev, const EST_String &last) { // Apply an ngram to some data and report on its performance // Output entropy and test set perplexity // H = -1/Q . log P(wi | wi-1, wi-2, ... wi-n) // H_p = 2^H // Rabiner and Juang p450 EST_TokenStream ts; double H,prob; int Q; EST_StrVector window(ngram.order()); (void)last; if (filename == "-") ts.open(stdin,FALSE); else if (ts.open(filename) == -1) EST_error("EST_Ngrammar test: unable to open test file \"%s\"\n", (const char *)filename); Q=0; H=0.0; ngram.fill_window_start(window,prev,prev_prev); while (!ts.eof() && (get_next_window(ts,window,input_format,ngram) == TRUE)) { prob = ngram.probability(window); H += log(prob); Q++; if ((input_format == "sentence_per_line") && (ts.eoln())) ngram.fill_window_start(window,prev,prev_prev); } count = Q; raw_entropy = -1 * H; entropy = -1 * (H/Q); perplexity = pow(2.0,entropy); // printf("count %g entropy %g perplexity %g\n", // count,entropy,perplexity); return true; } speech_tools/grammar/ngram/EST_lattice.cc0000644000076400007640000012122211465017155017067 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : November 1996 */ /*-----------------------------------------------------------------------*/ /* Lattice/Finite State Network */ /* */ /*=======================================================================*/ #include "EST_lattice.h" #include #include Lattice::Lattice() { tf=NULL; } Lattice::~Lattice() { } Lattice::Node* Lattice::start_node() { if(nodes.head() != NULL ) return nodes(nodes.head()); else{ cerr << "LAttice has no nodes !" << endl; return NULL; } } #if 0 bool Lattice::build_qmap(Bigram &g, float error_margin) { // very crude VQ (not vectors though) // works best on log bigrams ? // to do : automatically determine error_margin int i,j; EST_Litem *l_ptr; bool flag; // first, build a list, then transfer to array Tlist list_qmap; qmap_error_margin = error_margin; for (i = 0; i < g.size(); ++i){ for (j = 0; j < g.size(); ++j){ flag = false; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) if(fabs(list_qmap(l_ptr) - g.p(i,j)) <= error_margin){ flag = true; break; } if(!flag) list_qmap.append(g.p(i,j)); } } // special zero (within error_margin) entry, if not already there flag = false; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) if(fabs(list_qmap(l_ptr)) <= error_margin){ flag = true; break; } if(!flag) list_qmap.append(0); qsort(list_qmap); i=0; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) i++; // transfer to array qmap.resize(i); i=0; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) qmap(i++) = list_qmap(l_ptr); list_qmap.clear(); cerr << "Built qmap with " << i << " entries" << endl; return true; } bool Lattice::build_nmap(Bigram &g) { int j; //name_map_entry_t entry; EST_Litem *l_ptr; // first, build a list, then transfer to array Tlist list_nmap; // wordlist must not have !ENTER of !EXIT in it for (j = 0; j < g.size() - 2; ++j){ if(g.words(j) == "!ENTER"){ cerr << "Wordlist contains special word !ENTER" << endl; return false; } if(g.words(j) == "!EXIT"){ cerr << "Wordlist contains special word !EXIT" << endl; return false; } } // add all words for (j = 0; j < g.size() - 2; ++j) list_nmap.append(g.words(j)); // special enter and exit list_nmap.append("!ENTER"); list_nmap.append("!EXIT"); qsort(list_nmap); cerr << list_nmap << endl; j=0; for(l_ptr=list_nmap.head();l_ptr != 0; l_ptr=l_ptr->next()) j++; // transfer to array nmap.resize(j); j=0; for(l_ptr=list_nmap.head();l_ptr != 0; l_ptr=l_ptr->next()) nmap(j++) = list_nmap(l_ptr); list_nmap.clear(); cerr << "Built nmap with " << j << " entries" << endl; return true; } bool Lattice::construct_alphabet(Bigram &g) { int i,j,enteri,exiti,aindex,qindex,nindex,count; symbol_t *sym; EST_Litem *a_ptr; bool flag; if(!build_qmap(g,1.0e-02) || !build_nmap(g)) // to do : fix return false; // temporary list Tlist list_alphabet; // alphabet consists of all occurring combinations of // nmap and qmap entries enteri = g.size() - 2; exiti = g.size() - 1; aindex=0; // order is this way for speed for (j = 0; j < g.size(); ++j){ cerr << "constructing alphabet " << (int)((float)j*100/(float)g.size()) << "% \r"; if(j == enteri) nindex = nmap_name_to_index("!ENTER"); else if(j == exiti) nindex = nmap_name_to_index("!EXIT"); else nindex = nmap_name_to_index(g.words(j)); // check !! for (i = 0; i < g.size(); ++i){ qindex = qmap_value_to_index(g.p(i,j)); // have we got sym already ? flag=false; for(a_ptr=list_alphabet.tail();a_ptr!=NULL;a_ptr=a_ptr->prev()){ if( (list_alphabet(a_ptr)->nmap_index == nindex) && (list_alphabet(a_ptr)->qmap_index == qindex) ){ flag=true; break; } // since words are added in order, stop // when we get to previous word if(list_alphabet(a_ptr)->nmap_index != nindex) break; } if(!flag){ sym = new symbol_t; sym->qmap_index=qindex; sym->nmap_index=nindex; list_alphabet.append(sym); } } } // special ENTER with prob of 1 symbol nindex = nmap_name_to_index("!ENTER"); qindex = qmap_value_to_index(0); // log prob flag=false; for(a_ptr=list_alphabet.tail();a_ptr!=NULL;a_ptr=a_ptr->prev()) if( (list_alphabet(a_ptr)->nmap_index == nindex) && (list_alphabet(a_ptr)->qmap_index == qindex) ){ flag=true; break; } if(!flag){ sym = new symbol_t; sym->qmap_index=qindex; sym->nmap_index=nindex; list_alphabet.append(sym); } // and special no-label label (e-move) sym = new symbol_t; sym->qmap_index=-1; sym->nmap_index=-1; list_alphabet.append(sym); ptr_qsort(list_alphabet); count=0; for(a_ptr=list_alphabet.head();a_ptr != NULL; a_ptr=a_ptr->next()) count++; alphabet.resize(count); count=0; for(a_ptr=list_alphabet.head();a_ptr != NULL; a_ptr=a_ptr->next()) alphabet(count++) = *(list_alphabet(a_ptr)); // .. to do - delete syms list_alphabet.clear(); e_move_symbol_index = alphabet_index_lookup(-1,-1); cerr << "Alphabet has " << count << " symbols " << endl; return true; } bool Lattice::construct(Bigram &g) { // every word becomes a node, every non-zero transition becomes an arc // eliminate any transitions into ENTER and out of EXIT int i,j,k; EST_Litem *n_ptr,*a_ptr; Node *n; Arc *a; Node *from,*to; int symbol; // unfortunate, but fixed in Bigram class int enteri = g.size() - 2; int exiti = g.size() - 1; int from_name,to_name; // single entry node, no name since no arcs in // single arc out to node called "!ENTER" Node *enter_node = new Node; enter_node->name.append(-1); // no name ! nodes.append(enter_node); // make nodes - one for every entry in nmap for(i=0; iname.append(i); // index into nmap nodes.append(n); if(nmap(i) == "!ENTER"){ // temporary hack symbol = alphabet_index_lookup(i,qmap_value_to_index(0)); // for log probs !!! a = new Arc; a->label = symbol; a->to = n; enter_node->arcs_out.append(a); } // keep note of final node if(nmap(i) == "!EXIT") // temporary hack final_nodes.append(n); } // make arcs k=0; for (i = 0; i < g.size(); ++i){ cerr << "building lattice " << (int)((float)i*100/(float)g.size()) << "% \r"; for (j = 0; j < g.size(); ++j){ // ignore any transitions into ENTER or out of EXIT //if((g.p(i, j) > 0) && - for probs only, can't do for log probs if((j != enteri) && (i != exiti)){ // find from and to nodes from=NULL; to=NULL; if(i == enteri) from_name = nmap_name_to_index("!ENTER"); else from_name = nmap_name_to_index(g.words(i)); if(j == exiti) to_name = nmap_name_to_index("!EXIT"); else to_name= nmap_name_to_index(g.words(j)); for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ int name = nodes(n_ptr)->name(nodes(n_ptr)->name.head()); if(name == from_name) from = nodes(n_ptr); if(name == to_name) to = nodes(n_ptr); } if(from==NULL){ cerr << "Couldn't find 'from' node " << nmap_index_to_name(from_name) << endl; return false; } if(to==NULL){ cerr << "Couldn't find 'to' node " << nmap_index_to_name(to_name) << endl; return false; } // get arc symbol - speed up this fn ! symbol = alphabet_index_lookup(to_name,qmap_value_to_index(g.p(i,j))); if(symbol < 0){ cerr << "Couldn't lookup symbol in alphabet !" << endl; return false; } a = new Arc; a->label = symbol; a->to = to; from->arcs_out.append(a); } } } cerr << " \r"; int c1=0,c2=0,c3=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ c1++; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) c2++; } for (n_ptr = final_nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()) c3++; cerr << "NFA has " << c1 << " nodes (" << c3 << " final)" << " and " << c2 << " arcs" << endl; return true; } #endif bool Lattice::determinise() { // very simple, but potentially time/memory consuming // make a new lattice whose nodes are all permutations // of the nodes in the old lattice // BUT : only make the nodes which are actually required // (otherwise number of new nodes = 2^(number of old nodes) // we will call the old lattice NFA and the new one DFA EST_Litem *n_ptr,*n2_ptr,*a_ptr,*l_ptr; Node *new_node; EST_TList new_nodes; EST_TList new_final_nodes; EST_TList new_arcs; EST_TList arc_list; EST_TList new_name; int c,count,current_label,new_arcs_made; bool is_final; // first, sort nodes' lists of arcs by label to make // it easier cerr << "sorting arc lists" << endl; sort_arc_lists(); cerr << "making new nodes" << endl; // - for every node in the NFA, look at the outgoing arcs with // the same label // - make a DFA node which is a combination of the NFA nodes // which are the destinations of those arcs // there are more DFA nodes made later // enter node is special case, it has no in-going arcs // so will not be made in the following loop // for now, assume one enter node at head of list ... hmmmmm new_node = new Node; if(new_node == NULL){ cerr << "Could not allocate any more memory"; return false; } new_node->name = nodes(nodes.head())->name; new_nodes.append(new_node); for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ for (a_ptr = nodes(n_ptr)->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()){ current_label = nodes(n_ptr)->arcs_out(a_ptr)->label; // make list of arc destinations along arcs with this label is_final=false; new_name.clear(); new_name = nodes(n_ptr)->arcs_out(a_ptr)->to->name; if(final(nodes(n_ptr)->arcs_out(a_ptr)->to) ) is_final=true; while((a_ptr != NULL) && (a_ptr->next() != NULL) && (nodes(n_ptr)->arcs_out(a_ptr->next())->label == current_label)){ merge_sort_unique(new_name,nodes(n_ptr)->arcs_out(a_ptr->next())->to->name); if( !is_final && final(nodes(n_ptr)->arcs_out(a_ptr->next())->to) ) is_final=true; a_ptr=a_ptr->next(); } // make new node with this name, unless we already have one bool flag=false; for (n2_ptr = new_nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()) if( new_nodes(n2_ptr)->name == new_name ){ flag=true; break; } if(!flag){ // need to make new node new_node = new Node; if(new_node == NULL){ cerr << "Could not allocate any more memory"; count=0; for (n2_ptr = new_nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()) count++; cerr << " after making " << count << " nodes" << endl; return false; } new_node->name = new_name; new_nodes.append(new_node); if(is_final) new_final_nodes.append(new_node); } } // loop round outgoing arcs for this node } // loop round NFA nodes // now, for every node in the DFA, its 'transition function' (i.e. outgoing arcs) // is the sum of the transition functions of its constituent nodes from // the NFA c=0; new_arcs_made=0; for (n_ptr = new_nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ c++; cerr << "Processing node " << c << " arcs=" << new_arcs_made << " \r"; // find constituent nodes in NFA (only works if NFA names are single ints !) arc_list.clear(); for(l_ptr=new_nodes(n_ptr)->name.head(); l_ptr != 0; l_ptr = l_ptr->next()){ for(n2_ptr = nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()){ if(nodes(n2_ptr)->name(nodes(n2_ptr)->name.head()) == new_nodes(n_ptr)->name(l_ptr)) arc_list += nodes(n2_ptr)->arcs_out; } } // now we have a list of all the NFA nodes we can 'get to' // from this DFA node, sort by label and find the // DFA node for each label // or rather, take the arc list from above, and collapse // all arcs with the same label into one arc to the DFA // node which is the equivalent of the NFA nodes at the // end of those arcs sort_by_label(arc_list); for(a_ptr=arc_list.head();a_ptr!=NULL;a_ptr=a_ptr->next()){ current_label=arc_list(a_ptr)->label; //cerr << " label " << current_label; is_final=false; EST_TList new_name2; new_name2 = arc_list(a_ptr)->to->name; if(final(arc_list(a_ptr)->to) ) is_final=true; while((a_ptr != NULL) && (a_ptr->next() != NULL) && (arc_list(a_ptr->next())->label == current_label)){ merge_sort_unique(new_name2,arc_list(a_ptr)->to->name); if( !is_final && final(arc_list(a_ptr)->to) ) is_final=true; a_ptr=a_ptr->next(); } //cerr << " -> " << new_name2; // find DFA node with that name bool flag=false; for (n2_ptr = new_nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()) if( new_nodes(n2_ptr)->name == new_name2 ){ flag=true; break; } if(!flag){ // failed to make node previously, do it now new_node = new Node; if(new_node == NULL){ cerr << "Could not allocate any more memory"; count=0; for (n2_ptr = new_nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()) count++; cerr << " after making " << count << " nodes" << endl; return false; } new_node->name = new_name2; new_nodes.append(new_node); link(new_nodes(n_ptr),new_node,current_label); if(is_final) new_final_nodes.append(new_node); }else{ link(new_nodes(n_ptr),new_nodes(n2_ptr),current_label); } new_arcs_made++; } } // loop round DFA nodes cerr << endl; // delete old nodes, and replace with new nodes for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()) delete nodes(n_ptr); nodes.clear(); nodes=new_nodes; new_nodes.clear(); final_nodes.clear(); final_nodes=new_final_nodes; new_final_nodes.clear(); int c1=0,c2=0,c3=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ c1++; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) c2++; } for (n_ptr = final_nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()) c3++; cerr << "DFA has " << c1 << " nodes (" << c3 << " final)" << " and " << c2 << " arcs" << endl; return true; } bool Lattice::link(Node *n1, Node *n2, int label) { //if(l==NULL) //l=&arcs; // create arc between two nodes // in direction n1,n2 Arc *new_arc; if( (n1==NULL) || (n2==NULL) ){ cerr << "Can't link null nodes" << endl; return false; } new_arc = new Arc; //new_arc->from = n1; new_arc->to = n2; new_arc->label = label; n1->arcs_out.append(new_arc); //n2->arcs_in.append(new_arc); //l->append(new_arc); return true; } void Lattice::sort_arc_lists() { EST_Litem *n_ptr; for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ // can't sort nodes(n_ptr)->arcs_out directly // since it is a list of pointers sort_by_label(nodes(n_ptr)->arcs_out); } } void sort_by_label(EST_TList &l){ ptr_qsort(l); } bool Lattice::build_distinguished_state_table(bool ** &dst) { int i,j; EST_Litem *n_ptr,*n2_ptr; int num_nodes = nodes.length(); // not every element will be used dst = new bool*[num_nodes]; if(dst==NULL){ cerr << "Not enough memory" << endl; return false; } for(i=0;inext()!=NULL;n_ptr=n_ptr->next(),i++){ for(j=i+1,n2_ptr=n_ptr->next();n2_ptr!=NULL;n2_ptr=n2_ptr->next(),j++){ if(final(nodes(n_ptr)) && !final(nodes(n2_ptr))) dst[i][j] = true; else if(!final(nodes(n_ptr)) && final(nodes(n2_ptr))) dst[i][j] = true; } } cerr << "\r \r"; // two possible methods, depending on network representation // for sparse networks, use actual nodes and their lists of arcs //build_distinguished_state_table_direct(dst); // for dense networks, use a transition function matrix // which will be faster but more memory consuming if(!build_transition_function()){ cerr << "Couldn't build transition function" << endl; return false; } if(!build_distinguished_state_table_from_transition_function(dst)){ cerr << "Couldn't build dst from transition function" << endl; return false; } // delete tf, since it will be wrong for minimised net for(i=0;inext()!=NULL;n_ptr=n_ptr->next(),i++){ for(j=i+1,n2_ptr=n_ptr->next();n2_ptr!=NULL;n2_ptr=n2_ptr->next(),j++){ cerr << "scan " << scan_count << " : " << i << "," << j << " \r"; if(!dst[i][j]){ // go through alphabet, or rather just those symbols // occurring on the arcs out of this pair of nodes flag2=true; s_ptr=nodes(n_ptr)->arcs_out.head(); while(s_ptr != NULL){ if(flag2){ // we are going through symbols on arcs out of 'nodes(n_ptr)' this_symbol=nodes(n_ptr)->arcs_out(s_ptr)->label; i1 = node_index(nodes(n_ptr)->arcs_out(s_ptr)->to); j1=-1; for(a_ptr=nodes(n2_ptr)->arcs_out.head(); a_ptr!=NULL; a_ptr=a_ptr->next()) if(nodes(n2_ptr)->arcs_out(a_ptr)->label == this_symbol) j1 = node_index(nodes(n2_ptr)->arcs_out(a_ptr)->to); }else{ // we are going through symbols on arcs out of 'nodes(n2_ptr)' this_symbol=nodes(n2_ptr)->arcs_out(s_ptr)->label; j1 = node_index(nodes(n2_ptr)->arcs_out(s_ptr)->to); i1=-1; for(a_ptr=nodes(n_ptr)->arcs_out.head(); a_ptr!=NULL; a_ptr=a_ptr->next()) if(nodes(n_ptr)->arcs_out(a_ptr)->label == this_symbol) i1 = node_index(nodes(n_ptr)->arcs_out(a_ptr)->to); } // States (nodes) are distinguished if, for any symbol, they // have transitions (arcs) to a pair of distinguished states. // This includes the case where, for any symbol, one state // has a transition and the other does not if( ( (i1>=0) && (j1>=0) && dst[i1][j1]) || ( (i1>=0) && (j1<0) ) || ( (j1>=0) && (i1<0) ) ) { dst[i][j] = true; flag=true; break; // out of s_ptr loop } s_ptr=s_ptr->next(); if( (s_ptr==NULL) && (flag2) ){ // now go down second list s_ptr=nodes(n2_ptr)->arcs_out.head(); flag2=false; } } } } } } return true; } bool Lattice::build_distinguished_state_table_from_transition_function(bool ** &dst) { int i,j,i2,j2,k,scan_count; int num_nodes = nodes.length(); int num_symbols = alphabet.n(); bool flag; flag=true; scan_count=0; while(flag){ flag=false; scan_count++; for(i=0;i=0)){ dst[i][j] = true; flag=true; break; }else if((j2<0) && (i2>=0)){ dst[i][j] = true; flag=true; break; }else if( (i2>0) && (j2>0) && dst[i2][j2] ){ dst[i][j] = true; flag=true; break; } } } } } } return true; } bool Lattice::minimise() { // method, make distinguished state table // scan all pairs of states (a.k.a. nodes) int i,j; EST_Litem *n_ptr,*n2_ptr,*n3_ptr,*a_ptr; int num_nodes = nodes.length(); bool **dst = NULL; // distinguished state table bool flag; if(!build_distinguished_state_table(dst)){ cerr << "Couldn't build distinguished state table" << endl; return false; } int count=0,count2=0; for(i=0;i merge_list; flag=true; while(flag){ flag=false; merge_list.clear(); for(i=0,n_ptr=nodes.head();n_ptr->next()!=NULL;n_ptr=n_ptr->next(),i++){ cerr << "merge, processing row " << i << " \r"; for(j=i+1,n2_ptr=n_ptr->next();n2_ptr!=NULL;n2_ptr=n2_ptr->next(),j++){ if(!dst[i][j]){ // is the merge list empty ? if(merge_list.head() == NULL){ // put this pair of nodes on merge list merge_list.append(nodes(n_ptr)); merge_list.append(nodes(n2_ptr)); dst[i][j] = true; }else{ // merge list already has some items on it // see if either of this pair of nodes is on the merge list, // and if so add the other node in the pair bool add1=false,add2=false; for(n3_ptr=merge_list.head();n3_ptr!=NULL;n3_ptr=n3_ptr->next()){ if(merge_list(n3_ptr) == nodes(n_ptr)) add2=true; if(merge_list(n3_ptr) == nodes(n2_ptr)) add1=true; } if(add1 && !add2){ merge_list.append(nodes(n_ptr)); dst[i][j] = true; }else if(add2 && !add1){ merge_list.append(nodes(n2_ptr)); dst[i][j] = true; } } } } } // anything on the merge list ? if(merge_list.head() != NULL){ // so merge them count=0; for(n_ptr=merge_list.head();n_ptr!=NULL;n_ptr=n_ptr->next()) count++; cerr << "merging " << count << " nodes out of "; count=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()) count++; cerr << count; merge_nodes(merge_list); flag=true; count=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()) count++; cerr << " leaving " << count << endl; } } int c1=0,c2=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ c1++; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) c2++; } cerr << "Minimum state DFA has " << c1 << " nodes and " << c2 << " arcs " << endl; merge_arcs(); c1=0,c2=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ c1++; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) c2++; } cerr << "Pruned minimum state DFA has " << c1 << " nodes and " << c2 << " arcs" << endl; for(i=0;i &l) { if(l.head() == NULL) return; // make a new node with all node labels of old nodes // and all arcs of old nodes EST_Litem *n_ptr,*n2_ptr,*a_ptr,*a2_ptr; Node *new_node; new_node = new Node; // to do .. deal with final_nodes list too .... for(n_ptr=l.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ // get arcs for(a_ptr=l(n_ptr)->arcs_out.head();a_ptr!=NULL;a_ptr=a_ptr->next()) new_node->arcs_out.append(l(n_ptr)->arcs_out(a_ptr)); // get name merge_sort_unique(new_node->name,l(n_ptr)->name); // find arcs into old nodes and make them go into new node for(n2_ptr=nodes.head();n2_ptr!=NULL;n2_ptr=n2_ptr->next()){ for(a2_ptr=nodes(n2_ptr)->arcs_out.head();a2_ptr!=NULL;a2_ptr=a2_ptr->next()){ if(nodes(n2_ptr)->arcs_out(a2_ptr)->to == l(n_ptr)) nodes(n2_ptr)->arcs_out(a2_ptr)->to = new_node; } } } // delete old nodes, but not arcs for(n_ptr=l.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ for(n2_ptr=nodes.head();n2_ptr!=NULL;n2_ptr=n2_ptr->next()) if(nodes(n2_ptr) == l(n_ptr)){ nodes(n2_ptr)->name.clear(); nodes(n2_ptr)->arcs_out.clear(); delete nodes(n2_ptr); nodes.remove(n2_ptr); } } nodes.append(new_node); } void Lattice::merge_arcs() { EST_Litem *n_ptr,*a_ptr,*a2_ptr; EST_TList merge_list; int count=0,count2; // find repeated arcs with the same label between two nodes for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ count2=0; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) count2++; cerr << "merging arcs from node " << ++count << ", before:" << count2; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr->next()!=NULL; a_ptr=a_ptr->next()){ merge_list.clear(); for(a2_ptr=a_ptr->next();a2_ptr!=NULL; a2_ptr=a2_ptr->next()) if((nodes(n_ptr)->arcs_out(a_ptr)->label == nodes(n_ptr)->arcs_out(a2_ptr)->label) && (nodes(n_ptr)->arcs_out(a_ptr)->to == nodes(n_ptr)->arcs_out(a2_ptr)->to) ){ delete nodes(n_ptr)->arcs_out(a2_ptr); a2_ptr=nodes(n_ptr)->arcs_out.remove(a2_ptr); } } count2=0; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) count2++; cerr<< ", after:" << count2 << endl; } cerr << " \r" << endl; } void Lattice::prune_arcs(Node *node, EST_TList arcs) { int count=0; EST_Litem *a_ptr; for(a_ptr=arcs.head(); a_ptr != 0; a_ptr=a_ptr->next() ){ prune_arc(node, arcs(a_ptr)); count++; } //cerr << "pruned " << count << " arcs" << endl; } void Lattice::prune_arc(Node *node, Arc *arc) { remove_arc_from_nodes_out_list(node,arc); delete arc; } /* void Lattice::remove_arc_from_nodes_in_list(Node *n, Arc *a) { EST_Litem *a_ptr; for (a_ptr = n->arcs_in.head(); a_ptr != 0; a_ptr = a_ptr->next()) if(n->arcs_in(a_ptr) == a) n->arcs_in.remove(a_ptr); } */ void Lattice::remove_arc_from_nodes_out_list(Node *n, Arc *a) { EST_Litem *a_ptr; for (a_ptr = n->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()) if(n->arcs_out(a_ptr) == a) n->arcs_out.remove(a_ptr); } /* not used bool Lattice::is_enter_node(Node *n) { // contains "!ENTER" in its list of names EST_Litem *l_ptr; for(l_ptr=n->name.head(); l_ptr != 0; l_ptr=l_ptr->next()) if(n->name(l_ptr) == nmap_name_to_index("!ENTER")) // temporary !! return true; return false; } */ /* Superseded now we have list of final nodes bool Lattice::is_exit_node(Node *n) { EST_Litem *l_ptr; for(l_ptr=n->name.head(); l_ptr != 0; l_ptr=l_ptr->next()) if(n->name(l_ptr) == nmap_name_to_index("!EXIT")) // temporary !! return true; return false; } */ EST_String Lattice::nmap_index_to_name(int index) { if(index < nmap.n()) return nmap(index); else{ cerr << "Warning : nmap index " << index << " out of range" << endl; return EST_String("!error!"); } } int Lattice::nmap_name_to_index(const EST_String &name) { int i,j,mid; // binary search i=0; j=nmap.n()-1; while(true){ mid = (i+j)/2; if(name > nmap(mid)) i = mid; else if(name < nmap(mid)) j = mid; else{ // name == nmap(mid) return mid; // lucky strike } if(i==j){ if(name == nmap(i)) return i; else{ cerr << "Lattice::nmap_name_to_index failed for '" << name << "'" << endl; return -1; } }else if(j==i+1){ if(name == nmap(i)) return i; else if(name == nmap(j)) return j; else{ cerr << "Lattice::nmap_name_to_index failed for '" << name << "'" << endl; return -1; } } } return -1; } float Lattice::qmap_index_to_value(int index) { if(index < qmap.n()) return qmap(index); else{ cerr << "Warning : qmap index " << index << " out of range" << endl; return 1; } } int Lattice::qmap_value_to_index(float value) { int i,j,mid; // binary search i=0; j=qmap.n()-1; while(true){ mid = (i+j)/2; if(value > qmap(mid)) i = mid; else if(value < qmap(mid)) j = mid; else return mid; // lucky strike if(i==j) return i; else if(j==i+1){ if( fabs(qmap(i) - value) < fabs(qmap(j) - value) ) return i; else return j; } } return 0; } int Lattice::node_index(Node *n) { EST_Litem *n_ptr; for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ if(nodes(n_ptr) == n) return nodes.index(n_ptr); } //cerr << "Lattice::node_index(Node *n) couldn't find index of node " << n->name; return -1; } bool Lattice::expand() { // keep HTK happy - it can't handle multiple arcs into a node // with different word labels EST_Litem *n_ptr,*n2_ptr,*a_ptr,*w_ptr; int word; EST_TList word_list; Node *new_node; Arc *new_arc; for (n_ptr = nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ // find all arcs into this node word_list.clear(); for (n2_ptr = nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()){ for (a_ptr = nodes(n2_ptr)->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()) if(nodes(n2_ptr)->arcs_out(a_ptr)->to == nodes(n_ptr)){ if(nodes(n2_ptr)->arcs_out(a_ptr)->label != e_move_symbol_index){ word = alphabet_index_to_symbol(nodes(n2_ptr)->arcs_out(a_ptr)->label)->nmap_index; word_list.append(word); sort_unique(word_list); } } } // if word_list.head() is NULL we should be worried if((word_list.head() != NULL) && word_list.head()->next() != NULL){ // for each word make a null node, change all offending arcs to point // to it, and make another link from null node to nodes(n_ptr) for(w_ptr=word_list.head();w_ptr!=NULL;w_ptr=w_ptr->next()){ // make null node new_node = new Node; new_arc = new Arc; new_arc->label = e_move_symbol_index; // no label new_arc->to = nodes(n_ptr); new_node->arcs_out.append(new_arc); // for every arc into nodes(n_ptr) with this word label, change its arcs for (n2_ptr = nodes.head(); n2_ptr != 0; n2_ptr = n2_ptr->next()){ for (a_ptr = nodes(n2_ptr)->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()){ if(nodes(n2_ptr)->arcs_out(a_ptr)->to == nodes(n_ptr)){ word = alphabet_index_to_symbol(nodes(n2_ptr)->arcs_out(a_ptr)->label)->nmap_index; if(word == word_list(w_ptr)){ // change the arc nodes(n2_ptr)->arcs_out(a_ptr)->to = new_node; } } } } nodes.append(new_node); } } } // need to make sure ENTER node has no arcs in - if so add a dummy ENTER node //Node *enter_node = nodes(nodes.head()); bool flag=false; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()){ flag=true; break; } } /* if(flag){ cerr << " fixing ENTER node" << endl; new_node = new Node; new_arc = new Arc; new_arc->label = enter_node->label; new_arc->to = enter_node; new_node->arcs_out.append(new_arc); nodes.append(new_node); } */ // also need to make sure there is only one EXIT node if(final_nodes.length() > 1){ cerr << " making single EXIT node" << endl; // make null node new_node = new Node; for(n_ptr=final_nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ new_arc = new Arc; new_arc->label = e_move_symbol_index; // no label new_arc->to = final_nodes(n_ptr); final_nodes(n_ptr)->arcs_out.append(new_arc); } // empty final node list (nodes themselves remain on nodes list) final_nodes.clear(); // now a single final node nodes.append(new_node); final_nodes.append(new_node); } int c1=0,c2=0; for(n_ptr=nodes.head();n_ptr!=NULL;n_ptr=n_ptr->next()){ c1++; for(a_ptr=nodes(n_ptr)->arcs_out.head();a_ptr!=NULL; a_ptr=a_ptr->next()) c2++; } cerr << "HTKified DFA has " << c1 << " nodes and " << c2 << " arcs" << endl; return true; } bool Lattice::final(Node *n) { EST_Litem *n_ptr; for (n_ptr = final_nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()) if(final_nodes(n_ptr) == n) return true; return false; } EST_String Lattice::name_as_string(EST_IList &l) { EST_String name; EST_Litem *l_ptr; for(l_ptr=l.head();l_ptr!=NULL;l_ptr=l_ptr->next()) name+=nmap_index_to_name(l(l_ptr)) + ","; return name; } int Lattice::alphabet_index_lookup(int nmap_index, int qmap_index) { symbol_t sym; sym.nmap_index = nmap_index; sym.qmap_index = qmap_index; return alphabet_symbol_to_index(&sym); } Lattice::symbol_t* Lattice::alphabet_index_to_symbol(int index) { if(index < alphabet.n()) return &(alphabet[index]); else{ cerr << "Warning : alphabet index " << index << " out of range" << endl; return NULL; } } int Lattice::alphabet_symbol_to_index(Lattice::symbol_t *sym) { int i,j,mid; // binary search i=0; j=alphabet.n()-1; while(true){ mid = (i+j)/2; if(*sym > alphabet(mid)) i = mid; else if(*sym < alphabet(mid)) j = mid; else // *sym == alphabet(mid) return mid; // lucky strike if(i==j){ if(*sym == alphabet(i)) return i; else{ cerr << "Lattice::alphabet_symbol_to_index failed for '" << *sym << "' 1" << endl; return -1; } }else if(j==i+1){ if(*sym == alphabet(i)) return i; else if(*sym == alphabet(j)) return j; else{ cerr << "Lattice::alphabet_symbol_to_index failed for '" << *sym << "' 2" << endl; cerr << i << " " << alphabet(i) << endl; cerr << j << " " << alphabet(j) << endl; return -1; } } } return -1; } bool Lattice::build_transition_function() { // different representation of the network , currently only for DFAs // since for a NFA each tf cell would be a list int i,j; EST_Litem *n_ptr,*a_ptr; int num_nodes = nodes.length(); int num_symbols = alphabet.n(); if(tf != NULL) cerr << "Warning : discarding existing transition function" << endl; tf = new int*[num_nodes]; for(i=0;inext(),i++){ cerr << "building transition function " << (int)((float)(i+1)*100/(float)num_nodes) << "% \r"; for(j=0;jarcs_out.head();a_ptr!=NULL;a_ptr=a_ptr->next()){ if(j == nodes(n_ptr)->arcs_out(a_ptr)->label){ tf[i][j] = node_index(nodes(n_ptr)->arcs_out(a_ptr)->to); break; } } } } cerr << endl; return true; } bool Lattice::accepts(EST_TList &string) { (void) string; return false; } float Lattice::viterbi_transduce(EST_TList &input, EST_TList &path, EST_Litem *current_symbol, Node *start_node) { // finds maximum sum-of-probs path EST_Litem *a_ptr,*best; if(start_node == NULL){ start_node = nodes(nodes.head()); current_symbol = input.head(); path.clear(); } if(current_symbol == NULL){ // consumed all input if( final(start_node) ) return 0; // log prob 1 else return -10000000; // hack for now } best=NULL; float max=-10000000; // hack for now for (a_ptr = start_node->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()){ if( alphabet_index_to_symbol(start_node->arcs_out(a_ptr)->label)->nmap_index == nmap_name_to_index(input(current_symbol)) ){ float x = viterbi_transduce(input, path, current_symbol->next(), start_node->arcs_out(a_ptr)->to) + qmap_index_to_value(alphabet_index_to_symbol(start_node->arcs_out(a_ptr)->label)->qmap_index); if(x > max){ max = x; best = a_ptr; } } } if(best != NULL) path.append(start_node->arcs_out(best)); return max; } float Lattice::viterbi_transduce(EST_Track &observations, EST_TList &path, float &score, int current_frame, Node *start_node) { // finds maximum sum-of-probs path EST_Litem *a_ptr,*best; if(start_node == NULL){ start_node = nodes(nodes.head()); current_frame = 0; path.clear(); score = 0.0; } if(current_frame == observations.num_frames()){ // consumed all input if( final(start_node) ) return 0; // log prob 1 else return -10000000; // hack for now } if(score < -100000){ // hack ! return -10000000; } best=NULL; float max=-10000000; // hack for now for (a_ptr = start_node->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()){ int observation_element = alphabet_index_to_symbol(start_node->arcs_out(a_ptr)->label)->nmap_index - 2; // HACK !!@!!!! to skip ENTER/EXIT float this_observation = observations.a(current_frame,observation_element); //cerr << "frame " << current_frame << "," << observation_element //<< " : " << this_observation << endl; float x = viterbi_transduce(observations, path, score, current_frame+1, start_node->arcs_out(a_ptr)->to) + qmap_index_to_value(alphabet_index_to_symbol(start_node->arcs_out(a_ptr)->label)->qmap_index) + this_observation; if(x > max){ max = x; best = a_ptr; } } if(best != NULL){ path.append(start_node->arcs_out(best)); int observation_element = alphabet_index_to_symbol(start_node->arcs_out(best)->label)->nmap_index; float this_observation = observations.a(current_frame,observation_element); score += qmap_index_to_value(alphabet_index_to_symbol(start_node->arcs_out(best)->label)->qmap_index) + this_observation; ; } cerr << max << endl; return max; } // hack for now (required for SHARED=2) bool Lattice::symbol_t::operator!=(Lattice::symbol_t const &) const { return false; } speech_tools/grammar/ngram/EST_lattice_io.cc0000644000076400007640000003272011465017155017562 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Simon King */ /* Date : November 1996 */ /*-----------------------------------------------------------------------*/ /* Lattice/Finite State Network i/o functions */ /* */ /*=======================================================================*/ #include #include #include "EST_lattice.h" #include "EST_types.h" #include "EST_Token.h" #include "EST_StringTrie.h" bool save(Lattice &lattice, EST_String filename) { ostream *outf; EST_Litem *n_ptr, *a_ptr; int acount=0,ncount=0; int i,from,to; Lattice::symbol_t *symbol; EST_String word; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "lattice save: can't open lattice output file \"" << filename << "\"" << endl; return false; } // count for (n_ptr = lattice.nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ ncount++; for (a_ptr = lattice.nodes(n_ptr)->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()) acount++; } // size line (duh!) *outf << "# " << "Generated by Edinburgh Speech Tools" << endl << "#" << endl; *outf << "# Header" << endl; *outf << "VERSION=1.1" << endl << "#" << endl; *outf << "# Size line" << endl; *outf << "N=" << ncount << " L=" << acount << endl; *outf << "#" << endl; // to do : for HTK name nodes, not arcs // since all arcs in have same label // nodes for(i=0;i<=1;i++){ if(i==0) *outf << "# Nodes" << endl; else *outf << "# Arcs" << endl; ncount=0; acount=0; for (n_ptr = lattice.nodes.head(); n_ptr != 0; n_ptr = n_ptr->next()){ from=lattice.node_index(lattice.nodes(n_ptr)); if(i==0){ *outf << "I=" << from << endl; }else for (a_ptr = lattice.nodes(n_ptr)->arcs_out.head(); a_ptr != 0; a_ptr = a_ptr->next()){ to = lattice.node_index(lattice.nodes(n_ptr)->arcs_out(a_ptr)->to); symbol = lattice.alphabet_index_to_symbol(lattice.nodes(n_ptr)->arcs_out(a_ptr)->label); if(lattice.nodes(n_ptr)->arcs_out(a_ptr)->label == lattice.e_move_symbol_index){ *outf << "J=" << acount++ << " S=" << from << " E=" << to << " W=!NULL" << endl; }else{ *outf << "J=" << acount++ << " S=" << from << " E=" << to << " l=" << lattice.qmap_index_to_value(symbol->qmap_index) << " W=" << lattice.nmap_index_to_name(symbol->nmap_index) << endl; } } } } return true; } bool load(Lattice &lattice,EST_String filename) { EST_String name, next_token, str; EST_TokenStream ts; EST_Token t; int i,j; // temporary storage struct arc_t{ int start; int end; float logprob; EST_String word; }; arc_t *temp_arcs = NULL; int arcindex=0; int nodeindex=0; // nodes can have labels too - but this is not yet supported if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) { cerr << "Can't open lattice input file " << filename << endl; return false; } // read file into a arrays, make alphabet, then make lattice // find 'size' line int numnodes=0; int numarcs=0; int narcs=-1; int nnodes=-1; int nodenum=-1; int arcnum=-1; int startnode=-1; int endnode=-1; float logprob = 0.0; EST_String word=""; while(!ts.eof()) { str = ts.get().string(); if(!str.contains("=")) continue; EST_String left=str.before("="); EST_String right=str.after("="); if(left == "N") nnodes=atoi(right); else if(left == "L") narcs=atoi(right); else if(left == "I") nodenum=atoi(right); else if(left == "J") arcnum=atoi(right); else if(left == "S") startnode=atoi(right); else if(left == "E") endnode=atoi(right); else if(left == "l") logprob=atof(right); else if(left == "W") word=right; if(ts.eoln()){ // do something if( (narcs>0) && (nnodes>0) ){ // it's the size line if(temp_arcs != NULL){ cerr << "Error in lattice file : 2 size lines found" << " : line " << ts.linenum() << endl; ts.close(); return false; }else{ numarcs=narcs; numnodes=nnodes; temp_arcs = new arc_t[numarcs]; cerr << "size : " << numnodes << " " << numarcs << endl; } }else if(nodenum>=0){ if(arcnum>0){ cerr << "Error in lattice file at line " << ts.linenum() << endl; ts.close(); return false; } if(nodenum>=numnodes){ cerr << "Error in lattice file at line " << ts.linenum() << " : node index (" << nodenum << ") out of range" << endl; ts.close(); return false; } nodeindex++; }else if(arcnum>=0){ if(nodenum>0){ cerr << "Error in lattice file at line " << ts.linenum() << endl; ts.close(); return false; } if(arcnum>=numarcs){ cerr << "Error in lattice file at line " << ts.linenum() << " : arc index (" << arcnum << ") out of range" << endl; ts.close(); return false; } if((startnode<0) || (startnode>=numnodes)){ cerr << "Error in lattice file at line " << ts.linenum() << endl << " arc starts at out of range node " << startnode << endl; return false; } if((endnode<0) || (endnode>=numnodes)){ cerr << "Error in lattice file at line " << ts.linenum() << endl << " arc ends at out of range node " << endnode << endl; return false; } // make arc temp_arcs[arcindex].start = startnode; temp_arcs[arcindex].end = endnode; temp_arcs[arcindex].logprob = logprob; temp_arcs[arcindex].word = word; arcindex++; } narcs=-1; nnodes=-1; nodenum=-1; arcnum=-1; startnode=-1; endnode=-1; logprob=-1; word=""; } } if(arcindex != numarcs){ cerr << "Error in lattice file at line " << "found " << arcindex << " arcs, but expected " << numarcs << endl; return false; } if(nodeindex != numnodes){ cerr << "Error in lattice file at line " << "found " << nodeindex << " nodes, but expected " << numnodes << endl; return false; } // make nmap EST_StringTrie seen_before; EST_StrList list_nmap; for(i=0;inext()) i++; // transfer to array lattice.nmap.resize(i); i=0; for(l_ptr=list_nmap.head();l_ptr != 0; l_ptr=l_ptr->next()) lattice.nmap[i++] = list_nmap(l_ptr); list_nmap.clear(); cerr << "Built nmap with " << i << " entries" << endl; // make qmap // should be a separate fn EST_TList list_qmap; float error_margin = 1.0e-02; // temporary hack for(i=0;inext()) if(fabs(list_qmap(l_ptr) - temp_arcs[i].logprob) <= error_margin){ flag = true; break; } if(!flag) list_qmap.append(temp_arcs[i].logprob); } // special zero (within error_margin) entry, if not already there flag = false; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) if(fabs(list_qmap(l_ptr)) <= error_margin){ flag = true; break; } if(!flag) list_qmap.append(0); qsort(list_qmap); i=0; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) i++; // transfer to array lattice.qmap.resize(i); i=0; for(l_ptr=list_qmap.head();l_ptr != 0; l_ptr=l_ptr->next()) lattice.qmap[i++] = list_qmap(l_ptr); list_qmap.clear(); cerr << "Built qmap with " << i << " entries" << endl; // make alphabet // temporary list bool **used; // index nmap,qmap int nl = lattice.nmap.n(); int ql = lattice.qmap.n(); used = new bool*[nl]; for(i=0;inmap_index=i; sym->qmap_index=j; lattice.alphabet[count++] = *sym; } cerr << "Alphabet has " << count << " symbols " << endl; // make lattice itself // nodes for(i=0;inext(),count++){ if(n_ptr == NULL){ cerr << "Couldn't find 'from' node "; return false; } } Lattice::Node *from_node = lattice.nodes(n_ptr); // double check if(from_node == NULL){ cerr << "Couldn't find from node, index " << temp_arcs[j].start << endl; return false; } for (n_ptr = lattice.nodes.head(),count=0; countnext(),count++){ if(n_ptr == NULL){ cerr << "Couldn't find 'to' node "; return false; } } Lattice::Node *to_node = lattice.nodes(n_ptr); // double check if(to_node == NULL){ cerr << "Couldn't find to node, index " << temp_arcs[j].end << endl; return false; } int word_index = lattice.nmap_name_to_index(temp_arcs[j].word); // get arc symbol int symbol = lattice.alphabet_index_lookup(word_index, lattice.qmap_value_to_index(temp_arcs[j].logprob)); if(symbol < 0){ cerr << "Couldn't lookup symbol in alphabet !" << endl; return false; } Lattice::Arc *new_arc = new Lattice::Arc; new_arc->label = symbol; new_arc->to = to_node; if(to_node->name.head() == NULL) to_node->name.append(word_index); // only name of first arc in .. ! from_node->arcs_out.append(new_arc); } // find final nodes for (n_ptr = lattice.nodes.head(),count=0; n_ptr!= NULL; n_ptr = n_ptr->next()){ if(lattice.nodes(n_ptr)->arcs_out.head() == NULL){ lattice.final_nodes.append(lattice.nodes(n_ptr)); count++; } } cerr << "found " << count << " final nodes" << endl; cerr << "Lattice loaded !" << endl; delete [] used; delete [] temp_arcs; return true; } speech_tools/grammar/ngram/freqsmooth.cc0000644000076400007640000001511510510313621017104 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor & Simon King & Alan W Black */ /* Date : April 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Yet another method for smoothing an ngram */ /* */ /* Good_Turing smooth n-grammar so there are no zero occurrences */ /* For each ngram */ /* if |n-1gram| < threshold */ /* F(ngram) = !n-1gram|*(P(n-1gram)) */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_Ngrammar.h" static double fs_find_backoff_prob(EST_Ngrammar *backoff_ngrams, int order,const EST_StrVector words, int smooth_thresh); void Ngram_freqsmooth(EST_Ngrammar &ngram,int smooth_thresh1, int smooth_thresh2) { // To assign reasonable frequencies for all ngrams in grammar EST_Ngrammar *backoff_ngrams; backoff_ngrams = new EST_Ngrammar[ngram.order()-1]; Good_Turing_smooth(ngram,smooth_thresh1); fs_build_backoff_ngrams(backoff_ngrams,ngram); fs_backoff_smooth(backoff_ngrams,ngram,smooth_thresh2); delete [] backoff_ngrams; } void fs_build_backoff_ngrams(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram) { // Build all the backoff grammars back to uni-grams int i,j,l; EST_Litem *k; for (i=0; i < ngram.order()-1; i++) backoff_ngrams[i].init(i+1,EST_Ngrammar::dense, *ngram.vocab,*ngram.pred_vocab); for (i=0; i < ngram.num_states(); i++) { const EST_StrVector words = ngram.make_ngram_from_index(i); for (k=ngram.p_states[i].pdf().item_start(); !ngram.p_states[i].pdf().item_end(k); k = ngram.p_states[i].pdf().item_next(k)) { double freq; EST_String name; ngram.p_states[i].pdf().item_freq(k,name,freq); // Build all the sub-ngrams and accumulate them for (j=0; j < ngram.order()-1; j++) { EST_StrVector nnn(j+1); nnn[j] = name; for (l=0; l < j; l++) nnn[l] = words(ngram.order()-1-j); backoff_ngrams[j].accumulate(nnn,freq); } } } } int fs_backoff_smooth(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram, int smooth_thresh) { // For all ngrams which are too infrequent, adjust their // frequencies based on their backoff probabilities int i; EST_Litem *j; double occurs; double backoff_prob; if (ngram.representation() != EST_Ngrammar::dense) { cerr << "Ngrammar: can only ptsmooth dense ngrammars" << endl; return FALSE; } else { for (i=0; i < ngram.num_states(); i++) { if (ngram.p_states[i].pdf().samples() < smooth_thresh) { EST_DiscreteProbDistribution &pdf = ngram.p_states[i].pdf(); occurs = ngram.p_states[i].pdf().samples(); EST_StrVector words = ngram.make_ngram_from_index(i); words.resize(words.n()+1); for (j=pdf.item_start(); ! pdf.item_end(j); j = pdf.item_next(j)) { EST_String name; double freq; pdf.item_freq(j,name,freq); words[words.n()-1] = name; backoff_prob = fs_find_backoff_prob(backoff_ngrams, ngram.order()-1, words, smooth_thresh); pdf.set_frequency(j,occurs*backoff_prob); } } } } return TRUE; } static double fs_find_backoff_prob(EST_Ngrammar *backoff_ngrams, int order,const EST_StrVector words, int smooth_thresh) { // Find the backoff prob for n-1gram EST_StrVector nnn; int i; if (order == 0) return TINY_FREQ; // ultimate floor nnn.resize(order); for(i=0; i #include #include #include #include "EST_String.h" #include "EST_types.h" #include "EST_Token.h" #include "EST_PST.h" #include "EST_multistats.h" VAL_REGISTER_CLASS(pstnode,EST_PredictionSuffixTree_tree_node) // Out of vocabulary identifier const EST_String PredictionSuffixTree_oov("_OOV_"); const EST_DiscreteProbDistribution PSTnullProbDistribution; void slide(EST_IVector &i, const int l); void slide(EST_StrVector &i, const int l); EST_PredictionSuffixTree_tree_node::~EST_PredictionSuffixTree_tree_node() { } void EST_PredictionSuffixTree_tree_node::print_freqs(ostream &os) { // Print out path and frequency for each leaf if (p_level == 0) { // Base -- print from pd EST_String s; double freq; EST_Litem *i; for (i = pd.item_start(); !pd.item_end(i); i=pd.item_next(i)) { pd.item_freq(i,s,freq); os << get_path() << " " << s << " : " << freq << endl; } } else { EST_Features::Entries t; for (t.begin(nodes); t; t++) pstnode(t->v)->print_freqs(os); } } void EST_PredictionSuffixTree_tree_node::print_probs(ostream &os) { // Print out path and probability distributions for node above leafs if (p_level == 0) { // Base -- print from pd EST_String s; double prob; os << get_path() << " :"; for (EST_Litem *i = pd.item_start(); !pd.item_end(i) ; i=pd.item_next(i)) { pd.item_prob(i,s,prob); os << " " << s << " " << prob; } os << endl; } else { EST_Features::Entries t; for (t.begin(nodes); t; t++) pstnode(t->v)->print_probs(os); } } const EST_String & EST_PredictionSuffixTree_tree_node::most_probable(double *prob) const { // Find most probable symbol in this node return pd.most_probable(prob); } EST_PredictionSuffixTree::EST_PredictionSuffixTree(void) { p_order = 0; num_states = 0; nodes = 0; pd = 0; } void EST_PredictionSuffixTree::init(const int order) { p_order = order; num_states = 0; nodes = new EST_PredictionSuffixTree_tree_node; nodes->set_level(order-1); pd = new EST_DiscreteProbDistribution; } EST_PredictionSuffixTree::~EST_PredictionSuffixTree() { delete nodes; delete pd; } void EST_PredictionSuffixTree::clear(void) { delete nodes; delete pd; pd = 0; } const EST_DiscreteProbDistribution & EST_PredictionSuffixTree::p_prob_dist(EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, const int index) const { // Return the probability distribution for this EST_PredictionSuffixTree context if (words.n() == index+1){ return node->prob_dist(); }else { EST_PredictionSuffixTree_tree_node *next; EST_PredictionSuffixTree_tree_node *n=0; next = pstnode(node->nodes.f(words(index),est_val(n))); if (next == 0) { //cerr << "EST_PredictionSuffixTree: " //<< "no EST_PredictionSuffixTree probabilities for context \n"; return PSTnullProbDistribution; } return p_prob_dist(next,words,index+1); } } void EST_PredictionSuffixTree::accumulate(const EST_StrVector &words, const double count, const int index) { /* cerr << "accumulate "; for (int i=0; i < p_order-1; i++) cerr << words(i+index) << " "; cerr << count << endl; */ if (words.n()+index < p_order) cerr << "EST_PredictionSuffixTree: accumlating window is wtoo small" << endl; else { pd->cumulate(words(p_order-1+index),count); // a little extra book-keeping p_accumulate(nodes,words,count,index); } } void EST_PredictionSuffixTree::p_accumulate(EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, double count, const int index) { /* Expand tree with new gram */ if (words.n() == index+1) { if (node->prob_dist().samples() == 0) // A new terminal node node->set_state(num_states++); node->cumulate(words(index),count); } else { EST_PredictionSuffixTree_tree_node *next; EST_PredictionSuffixTree_tree_node *n = 0; next = pstnode(node->nodes.f(words(index),est_val(n))); if (next == 0) { next = new EST_PredictionSuffixTree_tree_node; if (node->get_path() == "") next->set_path(words(index)); else { next->set_path(node->get_path()+" "+ words(index)); } next->set_level(node->get_level()-1); node->nodes.set_val(words(index),est_val(next)); } p_accumulate(next,words,count,index+1); } } double EST_PredictionSuffixTree::rev_prob(const EST_StrVector &words) const { // Reverse probability. What is prob of this context given predictee const EST_DiscreteProbDistribution &pg = prob_dist(words); double d1 = pg.frequency(words(order()-1)); double d2 = pd->frequency(words(order()-1)); double d3 = d1/d2; return d3; } double EST_PredictionSuffixTree::rev_prob(const EST_StrVector &words, const EST_DiscreteProbDistribution &pg) const { // Reverse probability. What is prob of this context given predictee return (double)pg.frequency(words(order()-1)) / pd->frequency(words(order()-1)); } const EST_String &EST_PredictionSuffixTree::predict(const EST_StrVector &words) const { double p; int state; return ppredict(nodes,words,&p,&state); } const EST_String &EST_PredictionSuffixTree::predict(const EST_StrVector &words,double *p) const { int state; return ppredict(nodes,words,p,&state); } const EST_String &EST_PredictionSuffixTree::predict(const EST_StrVector &words,double *p, int *state) const { return ppredict(nodes,words,p,state); } const EST_String &EST_PredictionSuffixTree::ppredict(EST_PredictionSuffixTree_tree_node *node, const EST_StrVector &words, double *p,int *state, const int index) const { /* Given the context whats the most probably symbol (or OOV) */ if (words.n() == index+1) { *state = node->get_state(); return node->most_probable(p); } else { EST_PredictionSuffixTree_tree_node *next; EST_PredictionSuffixTree_tree_node *n=0; next = pstnode(node->nodes.f(words(index),est_val(n))); if (next == 0) { *p = 0.0; *state = 0; // No not really acceptable return PredictionSuffixTree_oov; /* utterly improbable -- i.e. not in EST_PredictionSuffixTree */ } else return ppredict(next,words,p,state,index+1); } } void EST_PredictionSuffixTree::print_freqs(ostream &os) { // Print a list of all PredictionSuffixTrees with their frequencies os << "EST_PredictionSuffixTree order=" << p_order << endl; nodes->print_freqs(os); } void EST_PredictionSuffixTree::print_probs(ostream &os) { // Print a list of all grams(-last) with their probability distributions os << "EST_PredictionSuffixTree " << p_order << endl; nodes->print_probs(os); } int EST_PredictionSuffixTree::save(const EST_String filename, const EST_PredictionSuffixTree::EST_filetype type) { // Save an EST_PredictionSuffixTree to file -- actual the grams and frequencies (void)type; if (filename == "-") print_freqs(cout); else { ofstream os(filename); print_freqs(os); } return 0; } int EST_PredictionSuffixTree::load(const EST_String filename) { // Load an EST_PredictionSuffixTree for given file EST_TokenStream ts; int i,order,freq; clear(); if (ts.open(filename) != 0) { cerr << "EST_PredictionSuffixTree: failed to open \"" << filename << "\" for reading\n"; return -1; } ts.set_SingleCharSymbols(":"); if (ts.get() != "EST_PredictionSuffixTree") // magic number { cerr << "EST_PredictionSuffixTree: file \"" << filename << "\" not an EST_PredictionSuffixTree\n"; return -1; } order = atoi(ts.get().string()); if ((order < 1) || (order > 10)) { cerr << "EST_PredictionSuffixTree: file \"" << filename << "\" has bad order\n"; return -1; } init(order); //EST_String const* *window = new EST_String const*[order+1]; EST_StrVector window(order); for (i=0; inext()) { slide(window,-1); window[p_order-1] = input(i_ptr); accumulate(window,1); } } void EST_PredictionSuffixTree::test(const EST_String filename) { // Run the current EST_PredictionSuffixTree over the given file name and generate // statistics of its prediction power for the contents of that // file. Use the confusion function EST_StrStr_KVL pairs; EST_StrList lex; EST_TokenStream ts; int i; if (filename == "-") ts.open(stdin, FALSE); else if (ts.open(filename) == -1) return; /* The top level nodes list will always contain all the tokens */ /* Build the lexicon for confusion matrix */ EST_Features::Entries p; for (p.begin(nodes->nodes); p; p++) lex.append(p->k); lex.append("_OOV_"); EST_StrVector window(p_order); //EST_String const* *window = new EST_String const*[p_order+1]; for (i=0; i #include "EST_Pathname.h" #include "EST_SCFG.h" EST_SCFG_Rule::EST_SCFG_Rule(double prob,int p, int m) { set_rule(prob,p,m); } EST_SCFG_Rule::EST_SCFG_Rule(double prob,int p, int q, int r) { set_rule(prob,p,q,r); } void EST_SCFG_Rule::set_rule(double prob,int p, int m) { p_prob = prob; p_mother = p; p_daughter1 = m; p_type = est_scfg_unary_rule; } void EST_SCFG_Rule::set_rule(double prob,int p, int q, int r) { p_prob = prob; p_mother = p; p_daughter1 = q; p_daughter2 = r; p_type = est_scfg_binary_rule; } EST_SCFG::EST_SCFG() { p_prob_B=0; p_prob_U=0; } EST_SCFG::EST_SCFG(LISP rs) { p_prob_B=0; p_prob_U=0; set_rules(rs); } EST_SCFG::~EST_SCFG(void) { delete_rule_prob_cache(); } void EST_SCFG::find_terms_nonterms(EST_StrList &nt, EST_StrList &t,LISP rs) { // Cummulate the nonterminals and terminals LISP r; for (r=rs; r != NIL; r=cdr(r)) { LISP p = car(cdr(car(r))); if (!strlist_member(nt,get_c_string(p))) nt.append(get_c_string(p)); if (siod_llength(car(r)) == 3) // unary rule { LISP d = car(cdr(cdr(car(r)))); if (!strlist_member(t,get_c_string(d))) t.append(get_c_string(d)); } else // binary rules { LISP d1 = car(cdr(cdr(car(r)))); LISP d2 = car(cdr(cdr(cdr(car(r))))); if (!strlist_member(nt,get_c_string(d1))) nt.append(get_c_string(d1)); if (!strlist_member(nt,get_c_string(d2))) nt.append(get_c_string(d2)); } } } void EST_SCFG::set_rules(LISP lrules) { // Initialise rule base from Lisp form LISP r; EST_StrList nt_list, term_list; rules.clear(); delete_rule_prob_cache(); find_terms_nonterms(nt_list,term_list,lrules); nonterminals.init(nt_list); terminals.init(term_list); if (!consp(car(cdr(car(lrules))))) p_distinguished_symbol = nonterminal(get_c_string(car(cdr(car(lrules))))); else cerr << "SCFG: no distinguished symbol" << endl; for (r=lrules; r != NIL; r=cdr(r)) { if ((siod_llength(car(r)) < 3) || (siod_llength(car(r)) > 4) || (!numberp(car(car(r))))) cerr << "SCFG rule is malformed" << endl; // est_error("SCFG rule is malformed\n"); else { EST_SCFG_Rule rule; if (siod_llength(car(r)) == 3) { int m = nonterminal(get_c_string(car(cdr(car(r))))); int d = terminal(get_c_string(car(cdr(cdr(car(r)))))); rule.set_rule(get_c_float(car(car(r))),m,d); } else { int p = nonterminal(get_c_string(car(cdr(car(r))))); int d1=nonterminal(get_c_string(car(cdr(cdr(car(r)))))); int d2 = nonterminal(get_c_string(car(cdr(cdr(cdr(car(r))))))); rule.set_rule(get_c_float(car(car(r))),p,d1,d2); } rules.append(rule); } } rule_prob_cache(); } LISP EST_SCFG::get_rules() { // Return LISP form of rules EST_Litem *p; LISP r; for (r=NIL,p=rules.head(); p != 0; p=p->next()) { if (rules(p).type() == est_scfg_unary_rule) r = cons(cons(flocons(rules(p).prob()), cons(rintern(nonterminal(rules(p).mother())), cons(rintern(terminal(rules(p).daughter1())),NIL))), r); else if (rules(p).type() == est_scfg_binary_rule) r = cons(cons(flocons(rules(p).prob()), cons(rintern(nonterminal(rules(p).mother())), cons(rintern(nonterminal(rules(p).daughter1())), cons(rintern(nonterminal(rules(p).daughter2())), NIL)))), r); } return reverse(r); } EST_read_status EST_SCFG::load(const EST_String &filename) { LISP rs; rs = vload(filename,1); set_rules(rs); return format_ok; } EST_write_status EST_SCFG::save(const EST_String &filename) { EST_Pathname outfile(filename); FILE *fd; LISP r; if (outfile == "-") fd = stdout; else { if ((fd=fopen(outfile,"w")) == NULL) { cerr << "scfg_train: failed to open file \"" << outfile << "\" for writing" << endl; return misc_write_error; } } for (r=get_rules(); r != NIL; r=cdr(r)) pprint_to_fd(fd,car(r)); if (fd != stdout) fclose(fd); return write_ok; } void EST_SCFG::rule_prob_cache() { // Build access cache for the probabilities of binary rules // This will have to made much more efficient int i,j; p_prob_B = new double**[num_nonterminals()]; p_prob_U = new double*[num_nonterminals()]; for (i=0; i < num_nonterminals(); i++) { p_prob_B[i] = new double*[num_nonterminals()]; p_prob_U[i] = new double[num_terminals()]; memset(p_prob_U[i],0,sizeof(double)*num_terminals()); for (j=0; j < num_nonterminals(); j++) { p_prob_B[i][j] = new double[num_nonterminals()]; memset(p_prob_B[i][j],0,sizeof(double)*num_nonterminals()); } } set_rule_prob_cache(); } void EST_SCFG::set_rule_prob_cache() { EST_Litem *pp; for (pp=rules.head(); pp != 0; pp = pp->next()) { if (rules(pp).type() == est_scfg_binary_rule) { int p = rules(pp).mother(); int q = rules(pp).daughter1(); int r = rules(pp).daughter2(); p_prob_B[p][q][r] = rules(pp).prob(); } else if (rules(pp).type() == est_scfg_unary_rule) { int p = rules(pp).mother(); int m = rules(pp).daughter1(); p_prob_U[p][m] = rules(pp).prob(); } } } void EST_SCFG::delete_rule_prob_cache() { int i,j; if (p_prob_B == 0) return; for (i=0; i < num_nonterminals(); i++) { for (j=0; j < num_nonterminals(); j++) delete [] p_prob_B[i][j]; delete [] p_prob_B[i]; delete [] p_prob_U[i]; } delete [] p_prob_B; delete [] p_prob_U; p_prob_B = 0; p_prob_U = 0; } ostream &operator << (ostream &s, const EST_SCFG_Rule &rule) { (void)rule; return s << "<>"; } Declare_TList(EST_SCFG_Rule) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" #include "../base_class/EST_TSortable.cc" Instantiate_TList(EST_SCFG_Rule) #endif speech_tools/grammar/scfg/EST_SCFG_inout.cc0000644000076400007640000003527311465017155017232 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Implementation of an inside-outside reestimation procedure for */ /* building a stochastic CFG seeded with a bracket corpus. */ /* Based on "Inside-Outside Reestimation from partially bracketed */ /* corpora", F Pereira and Y. Schabes. pp 128-135, 30th ACL, Newark, */ /* Delaware 1992. */ /* */ /* This should really be done in the log domain. Addition in the log */ /* domain can be done with a formula in Huang, Ariki and Jack */ /* (log(a)-log(b)) */ /* log(a+b) = log(1 + e ) + log(b) */ /* */ /*=======================================================================*/ #include #include "EST_SCFG_Chart.h" #include "EST_simplestats.h" #include "EST_math.h" #include "EST_TVector.h" static const EST_bracketed_string def_val_s; static EST_bracketed_string error_return_s; template <> const EST_bracketed_string *EST_TVector::def_val=&def_val_s; template <> EST_bracketed_string *EST_TVector::error_return=&error_return_s; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TVector.cc" template class EST_TVector; #endif void set_corpus(EST_Bcorpus &b, LISP examples) { LISP e; int i; b.resize(siod_llength(examples)); for (i=0,e=examples; e != NIL; e=cdr(e),i++) b.a_no_check(i).set_bracketed_string(car(e)); } void EST_bracketed_string::init() { bs = NIL; gc_protect(&bs); symbols = 0; valid_spans = 0; p_length = 0; } EST_bracketed_string::EST_bracketed_string() { init(); } EST_bracketed_string::EST_bracketed_string(LISP string) { init(); set_bracketed_string(string); } EST_bracketed_string::~EST_bracketed_string() { int i; bs=NIL; gc_unprotect(&bs); delete [] symbols; for (i=0; i < p_length; i++) delete [] valid_spans[i]; delete [] valid_spans; } void EST_bracketed_string::set_bracketed_string(LISP string) { bs=NIL; delete [] symbols; p_length = find_num_nodes(string); symbols = new LISP[p_length]; set_leaf_indices(string,0,symbols); bs = string; int i,j; valid_spans = new int*[length()]; for (i=0; i < length(); i++) { valid_spans[i] = new int[length()+1]; for (j=i+1; j <= length(); j++) valid_spans[i][j] = 0; } // fill in valid table if (p_length > 0) find_valid(0,bs); } int EST_bracketed_string::find_num_nodes(LISP string) { // This wont could nil as an atom if (string == NIL) return 0; else if (CONSP(string)) return find_num_nodes(car(string))+ find_num_nodes(cdr(string)); else return 1; } int EST_bracketed_string::set_leaf_indices(LISP string,int i,LISP *syms) { if (string == NIL) return i; else if (!CONSP(car(string))) { syms[i] = string; return set_leaf_indices(cdr(string),i+1,syms); } else // car is a tree { return set_leaf_indices(cdr(string), set_leaf_indices(car(string),i,syms), syms); } } void EST_bracketed_string::find_valid(int s,LISP t) const { LISP l; int c; if (consp(t)) { for (c=s,l=t; l != NIL; l=cdr(l)) { c += num_leafs(car(l)); valid_spans[s][c] = 1; } find_valid(s,car(t)); find_valid(s+num_leafs(car(t)),cdr(t)); } } int EST_bracketed_string::num_leafs(LISP t) const { if (t == NIL) return 0; else if (!consp(t)) return 1; else return num_leafs(car(t)) + num_leafs(cdr(t)); } EST_SCFG_traintest::EST_SCFG_traintest(void) : EST_SCFG() { inside = 0; outside = 0; n.resize(0); d.resize(0); } EST_SCFG_traintest::~EST_SCFG_traintest(void) { } void EST_SCFG_traintest::load_corpus(const EST_String &filename) { set_corpus(corpus,vload(filename,1)); } // From the formula in the paper double EST_SCFG_traintest::f_I_cal(int c, int p, int i, int k) { // Find Inside probability double res; if (i == k-1) { res = prob_U(p,terminal(corpus.a_no_check(c).symbol_at(i))); // printf("prob_U p %s (%d) %d m %s (%d) res %g\n", // (const char *)nonterminal(p),p, // i, // (const char *)corpus.a_no_check(c).symbol_at(i), // terminal(corpus.a_no_check(c).symbol_at(i)), // res); } else if (corpus.a_no_check(c).valid(i,k) == TRUE) { int j; double s=0; int q,r; for (q = 0; q < num_nonterminals(); q++) for (r = 0; r < num_nonterminals(); r++) { double pBpqr = prob_B(p,q,r); if (pBpqr > 0) for (j=i+1; j < k; j++) { double in = f_I(c,q,i,j); if (in > 0) s += pBpqr * in * f_I(c,r,j,k); } } res = s; } else res = 0.0; inside[p][i][k] = res; // printf("f_I p %s i %d k %d res %g\n", // (const char *)nonterminal(p),i,k,res); return res; } double EST_SCFG_traintest::f_O_cal(int c, int p, int i, int k) { // Find Outside probability double res; if ((i == 0) && (k == corpus.a_no_check(c).length())) { if (p == distinguished_symbol()) // distinguished non-terminal res = 1.0; else res = 0.0; } else if (corpus.a_no_check(c).valid(i,k) == TRUE) { double s1=0.0; double s2,s3; double pBqrp,pBqpr; int j; int q,r; for (q = 0; q < num_nonterminals(); q++) for (r = 0; r < num_nonterminals(); r++) { pBqrp = prob_B(q,r,p); s2 = s3 = 0.0; if (pBqrp > 0) { for (j=0;j < i; j++) { double out = f_O(c,q,j,k); if (out > 0) s2 += out * f_I(c,r,j,i); } s2 *= pBqrp; } pBqpr = prob_B(q,p,r); if (pBqpr > 0) { for (j=k+1;j <= corpus.a_no_check(c).length(); j++) { double out = f_O(c,q,i,j); if (out > 0) s3 += out * f_I(c,r,k,j); } s3 *= pBqpr; } s1 += s2 + s3; } res = s1; } else // not a valid bracketing res = 0.0; outside[p][i][k] = res; return res; } void EST_SCFG_traintest::reestimate_rule_prob_B(int c, int ri, int p, int q, int r) { // Re-estimate probability for binary rules int i,j,k; double n2=0; double pBpqr = prob_B(p,q,r); if (pBpqr > 0) { for (i=0; i <= corpus.a_no_check(c).length()-2; i++) for (j=i+1; j <= corpus.a_no_check(c).length()-1; j++) { double d1 = f_I(c,q,i,j); if (d1 == 0) continue; for (k=j+1; k <= corpus.a_no_check(c).length(); k++) { double d2 = f_I(c,r,j,k); if (d2 == 0) continue; double d3 = f_O(c,p,i,k); if (d3 == 0) continue; n2 += d1 * d2 * d3; } } n2 *= pBpqr; } // f_P(c) is probably redundant double fp = f_P(c); double n1,d1; n1 = n2 / fp; if (fp == 0) n1=0; d1 = f_P(c,p) / fp; if (fp == 0) d1=0; // printf("n1 %f d1 %f n2 %f fp %f\n",n1,d1,n2,fp); n[ri] += n1; d[ri] += d1; } void EST_SCFG_traintest::reestimate_rule_prob_U(int c,int ri, int p, int m) { // Re-estimate probability for unary rules int i; // printf("reestimate_rule_prob_U: %f p %s m %s\n", // prob_U(ip,im), // (const char *)p, // (const char *)m); double n2=0; for (i=1; i < corpus.a_no_check(c).length(); i++) if (m == terminal(corpus.a_no_check(c).symbol_at(i-1))) n2 += prob_U(p,m) * f_O(c,p,i-1,i); double fP = f_P(c); if (fP != 0) { n[ri] += n2 / fP; d[ri] += f_P(c,p) / fP; } } double EST_SCFG_traintest::f_P(int c) { return f_I(c,distinguished_symbol(),0,corpus.a_no_check(c).length()); } double EST_SCFG_traintest::f_P(int c,int p) { int i,j; double db=0; for (i=0; i < corpus.a_no_check(c).length(); i++) for (j=i+1; j <= corpus.a_no_check(c).length(); j++) { double d1 = f_O(c,p,i,j); if (d1 == 0) continue; db += f_I(c,p,i,j)*d1; } return db; } void EST_SCFG_traintest::reestimate_grammar_probs(int passes, int startpass, int checkpoint, int spread, const EST_String &outfile) { // Iterate over the corpus cummulating factors for each rules // This reduces the space requirements and recalculations of // values for each sentences. // Repeat training passes to number specified int pass = 0; double zero=0; double se; int ri,c; n.resize(rules.length()); d.resize(rules.length()); for (pass = startpass; pass < passes; pass++) { EST_Litem *r; double mC, lPc; d.fill(zero); n.fill(zero); set_rule_prob_cache(); for (mC=0.0,lPc=0.0,c=0; c < corpus.length(); c++) { // For skipping some sentences to speed up convergence if ((spread > 0) && (((c+(pass*spread))%100) >= spread)) continue; printf(" %d",c); fflush(stdout); if (corpus.a_no_check(c).length() == 0) continue; init_io_cache(c,num_nonterminals()); for (ri=0,r=rules.head(); r != 0; r=r->next(),ri++) { if (rules(r).type() == est_scfg_binary_rule) reestimate_rule_prob_B(c,ri, rules(r).mother(), rules(r).daughter1(), rules(r).daughter2()); else reestimate_rule_prob_U(c, ri, rules(r).mother(), rules(r).daughter1()); } lPc += safe_log(f_P(c)); mC += corpus.a_no_check(c).length(); clear_io_cache(c); } printf("\n"); for (se=0.0,ri=0,r=rules.head(); r != 0; r=r->next(),ri++) { double n_prob = n[ri]/d[ri]; if (d[ri] == 0) n_prob = 0; se += (n_prob-rules(r).prob())*(n_prob-rules(r).prob()); rules(r).set_prob(n_prob); } printf("pass %d cross entropy %g RMSE %f %f %d\n", pass,-(lPc/mC),sqrt(se/rules.length()), se,rules.length()); if (checkpoint != -1) { if ((pass % checkpoint) == checkpoint-1) { char cp[20]; sprintf(cp,".%03d",pass); save(outfile+cp); user_gc(NIL); // just to keep things neat } } } } void EST_SCFG_traintest::train_inout(int passes, int startpass, int checkpoint, int spread, const EST_String &outfile) { // Train a Stochastic CFG using the inside outside algorithm reestimate_grammar_probs(passes, startpass, checkpoint, spread, outfile); } void EST_SCFG_traintest::init_io_cache(int c,int nt) { // Build an array to cache the in/out values int i,j,k; int mc = corpus.a_no_check(c).length()+1; inside = new double**[nt]; outside = new double**[nt]; for (i=0; i < nt; i++) { inside[i] = new double*[mc]; outside[i] = new double*[mc]; for (j=0; j < mc; j++) { inside[i][j] = new double[mc]; outside[i][j] = new double[mc]; for (k=0; k < mc; k++) { inside[i][j][k] = -1; outside[i][j][k] = -1; } } } } void EST_SCFG_traintest::clear_io_cache(int c) { int mc = corpus.a_no_check(c).length()+1; int i,j; if (inside == 0) return; for (i=0; i < num_nonterminals(); i++) { for (j=0; j < mc; j++) { delete [] inside[i][j]; delete [] outside[i][j]; } delete [] inside[i]; delete [] outside[i]; } delete [] inside; delete [] outside; inside = 0; outside = 0; } double EST_SCFG_traintest::cross_entropy() { double lPc=0,mC=0; int c; for (c=0; c < corpus.length(); c++) { lPc += log(f_P(c)); mC += corpus.a_no_check(c).length(); } return -(lPc/mC); } void EST_SCFG_traintest::test_corpus() { // Test corpus against current grammar. double mC,lPc; int c,i; int failed=0; double fP; // Lets try simply finding the cross entropy n.resize(rules.length()); d.resize(rules.length()); for (i=0; i < rules.length(); i++) d[i] = n[i] = 0.0; for (mC=0.0,lPc=0.0,c=0; c < corpus.length(); c++) { if (corpus.length() > 50) { printf(" %d",c); fflush(stdout); } init_io_cache(c,num_nonterminals()); fP = f_P(c); if (fP == 0) failed++; else { lPc += safe_log(fP); mC += corpus.a_no_check(c).length(); } clear_io_cache(c); } if (corpus.length() > 50) printf("\n"); cout << "cross entropy " << -(lPc/mC) << " (" << failed << " failed out of " << corpus.length() << " sentences )" << endl; } speech_tools/grammar/scfg/EST_SCFG_Chart.cc0000644000076400007640000003530711465017155017133 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : June 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A SCFG chart parser */ /* */ /*=======================================================================*/ #include #include "siod.h" #include "EST_math.h" #include "EST_SCFG.h" #include "EST_SCFG_Chart.h" EST_SCFG_Chart_Edge::EST_SCFG_Chart_Edge() { } EST_SCFG_Chart_Edge::EST_SCFG_Chart_Edge(double prob, int d1, int d2, int pos) { p_d1 = d1; p_d2 = d2; p_pos = pos; p_prob = prob; } EST_SCFG_Chart_Edge::~EST_SCFG_Chart_Edge() { } LISP EST_SCFG_Chart::print_edge(int start, int end, int p, EST_SCFG_Chart_Edge *e) { // Return a lisp representation of the edge if (e->prob() == 0) { return NIL; // failed } else if (start+1 == end) { // unary rule, preterminal LISP r = cons(rintern(grammar->nonterminal(p)), cons(flocons(e->prob()), cons(flocons(start), cons(flocons(end), cons(rintern(grammar->terminal(e->d1())), NIL))))); return r; } else { //name prob start end daughters EST_SCFG_Chart_Edge *d1, *d2; d1 = edges[start][e->pos()][e->d1()]; d2 = edges[e->pos()][end][e->d2()]; LISP daughters = cons(print_edge(start,e->pos(),e->d1(),d1), cons(print_edge(e->pos(),end,e->d2(),d2), NIL)); LISP r = cons(rintern(grammar->nonterminal(p)), cons(flocons(e->prob()), cons(flocons(start), cons(flocons(end), daughters)))); return r; } } EST_SCFG_Chart::EST_SCFG_Chart() { n_vertices = 0; edges = 0; wfst = 0; emptyedge = 0; grammar_local = TRUE; grammar = new EST_SCFG; } EST_SCFG_Chart::~EST_SCFG_Chart() { // delete all the vertices delete_edge_table(); if (grammar_local) delete grammar; } void EST_SCFG_Chart::set_grammar_rules(EST_SCFG &imported_grammar) { if (grammar_local) delete grammar; grammar_local = FALSE; grammar = &imported_grammar; } void EST_SCFG_Chart::set_grammar_rules(LISP r) { grammar->set_rules(r); } void EST_SCFG_Chart::setup_wfst(EST_Relation *s,const EST_String &name) { // Set up well formed substring table from feature name in each // stream item in s setup_wfst(s->head(),0,name); } void EST_SCFG_Chart::setup_wfst(EST_Item *s, EST_Item *e,const EST_String &name) { // Set up well formed substring table from feature name in each // stream item in s EST_Item *p; int n; delete_edge_table(); for (n_vertices=1,p=s; p != e; p=p->next()) n_vertices++; setup_edge_table(); for (n=0,p=s; p != e; p=p->next(),n++) { int term = grammar->terminal(p->f(name).string()); if (term == -1) { cerr << "SCFG_Chart: unknown terminal symbol \"" << p->f(name).string() << "\"" << endl; term = 0; // to avoid crashing } wfst[n] = new EST_SCFG_Chart_Edge(1.0,term,0,-1); } } void EST_SCFG_Chart::delete_edge_table() { int i,j,k; if (wfst == 0) return; for (i=0; i < n_vertices; i++) { delete wfst[i]; for (j=0; j < n_vertices; j++) { for (k=0; k < grammar->num_nonterminals(); k++) if (edges[i][j][k] != emptyedge) delete edges[i][j][k]; delete [] edges[i][j]; } delete [] edges[i]; } delete [] wfst; delete [] edges; delete emptyedge; wfst = 0; edges = 0; } void EST_SCFG_Chart::setup_edge_table() { int i,j,k; int nt = grammar->num_nonterminals(); wfst = new EST_SCFG_Chart_Edge*[n_vertices]; edges = new EST_SCFG_Chart_Edge ***[n_vertices]; emptyedge = new EST_SCFG_Chart_Edge(0,0,0,0); for (i=0; i < n_vertices; i++) { wfst[i] = 0; edges[i] = new EST_SCFG_Chart_Edge **[n_vertices]; for (j=0; j < n_vertices; j++) { edges[i][j] = new EST_SCFG_Chart_Edge *[nt]; for (k=0; k < nt; k++) edges[i][j][k] = 0; } } } double EST_SCFG_Chart::find_best_tree_cal(int start,int end,int p) { // Find the best parse for non/terminal p between start and end int best_j = -1; int best_q = -1, best_r = -1; double best_prob = 0; if (end-1 == start) { best_prob = grammar->prob_U(p,wfst[start]->d1()); if (best_prob > 0) edges[start][end][p] = new EST_SCFG_Chart_Edge(best_prob*wfst[start]->prob(), wfst[start]->d1(),0,-1); else edges[start][end][p] = emptyedge; return best_prob; } else { // for all rules expanding p find total and best prob double s=0,t_prob,left,right; int j,q,r; int nt = grammar->num_nonterminals(); for (q=0; q < nt; q++) for (r=0; r < nt; r++) { double pBpqr = grammar->prob_B(p,q,r); if (pBpqr > 0) { for (j=start+1; j < end; j++) { left=find_best_tree(start,j,q); if (left > 0) { right = find_best_tree(j,end,r); t_prob = pBpqr * left * right; if (t_prob > best_prob) { best_prob = t_prob; best_q = q; best_r = r; best_j = j; } s += t_prob; } } } } if (best_prob > 0) edges[start][end][p] = new EST_SCFG_Chart_Edge(s,best_q,best_r,best_j); else edges[start][end][p] = emptyedge; return s; } } void EST_SCFG_Chart::parse(void) { // do the parsing, find best parse only find_best_tree(0,n_vertices-1,grammar->distinguished_symbol()); } LISP EST_SCFG_Chart::find_parse() { // Extract the parse from the edge table EST_SCFG_Chart_Edge *top; top = edges[0][n_vertices-1][grammar->distinguished_symbol()]; if (top == 0) return NIL; // no parse else return print_edge(0,n_vertices-1,grammar->distinguished_symbol(),top); } void EST_SCFG_Chart::extract_parse(EST_Relation *syn, EST_Relation *word, int force) { // Build a tree stream in Syn linking the leafs of Syn to those // in word, force guarantees a parse is necessary (though probably // a random one) extract_parse(syn,word->head(),0,force); } void EST_SCFG_Chart::extract_parse(EST_Relation *syn, EST_Item *s, EST_Item *e, int force) { // Build a tree stream in Syn linking the leafs of Syn to those // in word EST_Item *p; int num_words; for (num_words=0,p=s; p != e; p=p->next()) num_words++; if (num_words != (n_vertices-1)) { cerr << "SCFG_Chart: extract_parse, number of items in link stream " << " different from those in parse tree" << endl; return; } EST_SCFG_Chart_Edge *top; EST_Item *w = s; top = edges[0][n_vertices-1][grammar->distinguished_symbol()]; if (top == 0) return; // failed to parse so no parse tree else { EST_Item *ss = syn->append(); extract_edge(0,n_vertices-1,grammar->distinguished_symbol(),top, ss,&w); if ((force) && (!daughter1(ss))) // no parse found but *need* one extract_forced_parse(0,n_vertices-1,ss,w); return; } } void EST_SCFG_Chart::extract_forced_parse(int start, int end, EST_Item *s, EST_Item *w) { // Extract a parse even though one wasn't found (often happens // with single word or dual word sentences. if (start+1 == end) { s->append_daughter(w); s->set_name(grammar->nonterminal(grammar->distinguished_symbol())); s->set("prob",0.0); // maybe should be epsilon } else { extract_forced_parse(start,start+1,s->append_daughter(),w); EST_Item *st = s->append_daughter(); st->set_name(grammar->nonterminal(grammar->distinguished_symbol())); st->set("prob",0.0); // maybe should be epsilon EST_Item *nw = w->next(); extract_forced_parse(start+1,end,st,nw); } } void EST_SCFG_Chart::extract_edge(int start, int end, int p, EST_SCFG_Chart_Edge *e, EST_Item *s, EST_Item **word) { // Build the node for this edge, and all of its daughters if (e->prob() == 0) { return; // failed } else if (start+1 == end) { // unary rule, preterminal s->append_daughter((*word)); s->set_name(grammar->nonterminal(p)); s->set("prob",(float)e->prob()); *word = (*word)->next(); // increment along "word" stream return; } else { //name prob start end daughters EST_SCFG_Chart_Edge *d1, *d2; d1 = edges[start][e->pos()][e->d1()]; d2 = edges[e->pos()][end][e->d2()]; // Inserts the new nodes in the tree (and creates new si nodes) s->append_daughter(); s->append_daughter(); extract_edge(start,e->pos(),e->d1(),d1,daughter1(s),word); extract_edge(e->pos(),end,e->d2(),d2,daughter2(s),word); s->set_name(grammar->nonterminal(p)); s->set("prob",(float)e->prob()); return; } } void EST_SCFG_chart_load_relation(EST_Relation &s,LISP sent) { // Set up well formed substring table form lisp list // Setup a relation and call the standard method of set up LISP w,f; for (w=sent; w != NIL; w=cdr(w)) { EST_Item *word = s.append(); if (consp(car(w))) { // a word with other feature info word->set_name(get_c_string(car(car(w)))); if (consp(car(cdr(car(w))))) for (f=car(cdr(car(w))); f != NIL; f=cdr(f)) { if (FLONUMP(car(cdr(car(f))))) word->set(get_c_string(car(car(f))), get_c_float(car(cdr(car(f))))); else word->set(get_c_string(car(car(f))), get_c_string(car(cdr(car(f))))); } else // we assume its a POS value, cause they didn't say word->set("name",get_c_string(car(cdr(car(w))))); } else // for easy we set the pos field to the be the name word->set("name",get_c_string(car(w))); } } void scfg_parse(EST_Relation *Word, const EST_String &name, EST_Relation *Syntax, EST_SCFG &grammar) { // Parse feature name in Word to build Syntax relation // The relations names above are *not* the names of the relations // just named to reflect there conceptual usage EST_SCFG_Chart chart; chart.set_grammar_rules(grammar); chart.setup_wfst(Word,name); chart.parse(); chart.extract_parse(Syntax,Word,TRUE); return; } LISP scfg_parse(LISP string, LISP grammar) { // Parse and return full parse EST_SCFG_Chart chart; EST_Relation words; LISP parse; chart.set_grammar_rules(grammar); EST_SCFG_chart_load_relation(words,string); chart.setup_wfst(&words,"name"); chart.parse(); parse = chart.find_parse(); return parse; } LISP scfg_parse(LISP string, EST_SCFG &grammar) { // Parse and return full parse EST_SCFG_Chart chart; EST_Relation words; LISP parse; chart.set_grammar_rules(grammar); EST_SCFG_chart_load_relation(words,string); chart.setup_wfst(&words,"name"); chart.parse(); parse = chart.find_parse(); return parse; } LISP scfg_bracketing_only(LISP parse) { if (consp(siod_nth(4,parse))) { LISP d,ds; for (d=cdr(cdr(cdr(cdr(parse)))),ds=NIL; d != NIL; d=cdr(d)) ds = cons(scfg_bracketing_only(car(d)),ds); return reverse(ds); } else return siod_nth(4,parse); } void EST_SCFG_traintest::test_crossbrackets() { // Compare bracketing of best parse to bracketing on original // For each sentence parse it (unbracketed) and then // find the percentage of valid brackets in parsed version that // are valid in the original one. int c; LISP parse; EST_SuffStats cb; int failed = 0; int fully_contained=0; for (c=0; c < corpus.length(); c++) { LISP flat = siod_flatten(corpus.a_no_check(c).string()); parse = scfg_parse(flat,*this); if (parse == NIL) { failed++; continue; } EST_bracketed_string parsed(scfg_bracketing_only(parse)); EST_SuffStats vs; count_bracket_crossing(corpus.a_no_check(c),parsed,vs); if (vs.mean() == 1) fully_contained++; cb += vs.mean(); } cout << "cross bracketing " << cb.mean()*100 << " (" << failed << " failed " << (float)(100.0*fully_contained)/corpus.length() << "% fully consistent from " << corpus.length() << " sentences)" << endl; } void count_bracket_crossing(const EST_bracketed_string &ref, const EST_bracketed_string &test, EST_SuffStats &vs) { int i,j; if (ref.length() != test.length()) { EST_error("bracket_crossing: sentences of different lengths"); } for (i=0; i < ref.length(); i++) for (j=i+1; j <= ref.length(); j++) if (test.valid(i,j) == 1) { if (ref.valid(i,j) == 0) vs += 0; else vs += 1; } } speech_tools/grammar/scfg/Makefile0000644000076400007640000000546607262605664015721 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for stochastic context free grammar classes # #=========================================================================# TOP=../.. DIRNAME=grammar/scfg H = CSRCS = TSRCS = EST_SCFG.cc EST_SCFG_inout.cc CPPSRCS = $(TSRCS) EST_SCFG_Chart.cc SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) FILES = $(SRCS) $(H) Makefile scfg.mak ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/grammar/scfg/scfg.mak0000644000076400007640000000670007262605664015665 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Definitions for including SCFG system. ## ## ## ########################################################################### INCLUDE_SCFG=1 MOD_DESC_SCFG=Stochastic context free grammars ifeq ($(DIRNAME),grammar) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) scfg endif ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) \ scfg_make_main.cc scfg_train_main.cc \ scfg_test_main.cc scfg_parse_main.cc endif ifndef INCLUDE_SIOD .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include SIOD to use scfg" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/grammar/wfst/EST_WFST.cc0000644000076400007640000004361611465017155016116 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A class for representing Weighted Finite State Transducers */ /* */ /* This is based on various papers by Mehryar Mohri but not forgetting */ /* the Kay and Kaplan stuff as well as my own Koskenniemi implementation */ /* and finite state machine manipulations in my earlier lives */ /* */ /*=======================================================================*/ #include #include "EST_Pathname.h" #include "EST_cutils.h" #include "EST_Token.h" #include "EST_FileType.h" #include "EST_WFST.h" #include "EST_TVector.h" Declare_TList_T(EST_WFST_Transition *, EST_WFST_TransitionP) Declare_TVector_Base_T(EST_WFST_State *, NULL, NULL, EST_WFST_StateP) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList_T(EST_WFST_Transition *, EST_WFST_TransitionP) #include "../base_class/EST_TVector.cc" Instantiate_TVector_T(EST_WFST_State *, EST_WFST_StateP) #endif // Used for marking states duration traversing functions int EST_WFST::traverse_tag = 0; EST_WFST_State::EST_WFST_State(int name) { p_name = name; p_type = wfst_error; p_tag = 0; } EST_WFST_State::EST_WFST_State(const EST_WFST_State &state) { EST_Litem *p; p_name = state.p_name; p_type = state.p_type; p_tag = p_tag; for (p=state.transitions.head(); p != 0; p=p->next()) transitions.append(new EST_WFST_Transition(*state.transitions(p))); } EST_WFST_State::~EST_WFST_State() { EST_Litem *p; for (p=transitions.head(); p != 0; p=p->next()) delete transitions(p); } EST_WFST_Transition *EST_WFST_State::add_transition(float w, int end, int in, int out) { // Add new transition EST_WFST_Transition *s = new EST_WFST_Transition(w,end,in,out); transitions.append(s); return s; } EST_WFST::~EST_WFST() { clear(); } void EST_WFST::clear() { // delete up to p_num_states, rather than p_states.length() as // only up to there is necessarily filled for (int i=0; i < p_num_states; ++i) delete p_states[i]; p_num_states = 0; p_cumulate = 0; } EST_WFST::EST_WFST() { p_num_states = 0; init(0); } void EST_WFST::copy(const EST_WFST &wfst) { clear(); p_in_symbols = wfst.p_in_symbols; p_out_symbols = wfst.p_out_symbols; p_start_state = wfst.p_start_state; current_tag = wfst.current_tag; p_num_states = wfst.p_num_states; p_states.resize(p_num_states); for (int i=0; i < p_num_states; ++i) p_states[i] = new EST_WFST_State(*wfst.state(i)); } void EST_WFST::init(int init_num_states) { int i; clear(); p_states.resize(init_num_states); for (i=0; i < p_states.length(); i++) p_states[i] = 0; p_num_states = init_num_states; } void EST_WFST::init(LISP in_alphabet,LISP out_alphabet) { EST_StrList in,out; LISP iin,oout; in.append("__epsilon__"); in.append("="); for (iin=in_alphabet; iin != NIL; iin=cdr(iin)) if ((!streq(get_c_string(car(iin)),"__epsilon__")) && (!streq(get_c_string(car(iin)),"="))) in.append(get_c_string(car(iin))); out.append("__epsilon__"); out.append("="); for (oout=out_alphabet; oout != NIL; oout=cdr(oout)) if ((!streq(get_c_string(car(oout)),"__epsilon__")) && (!streq(get_c_string(car(oout)),"="))) out.append(get_c_string(car(oout))); p_in_symbols.init(in); p_out_symbols.init(out); } int EST_WFST::transduce(int state,const EST_String &in,EST_String &out) const { int nstate; int in_i = p_in_symbols.name(in); int out_i=0; if (in_i == -1) { cerr << "WFST transduce: \"" << in << "\" not in alphabet" << endl; return WFST_ERROR_STATE; } nstate = transduce(state,in_i,out_i); out = p_out_symbols.name(out_i); return nstate; } void EST_WFST::transduce(int state,int in,wfst_translist &out) const { EST_WFST_State *s = p_states(state); EST_Litem *i; for (i=s->transitions.head(); i != 0; i=i->next()) { if (in == s->transitions(i)->in_symbol()) { if (cumulate()) s->transitions(i)->set_weight(1+s->transitions(i)->weight()); out.append(s->transitions(i)); } } // could return if any transitions were found } int EST_WFST::transduce(int state,int in,int &out) const { EST_WFST_State *s = p_states(state); EST_Litem *i; for (i=s->transitions.head(); i != 0; i=i->next()) { if (in == s->transitions(i)->in_symbol()) { out = s->transitions(i)->out_symbol(); return s->transitions(i)->state(); } } return WFST_ERROR_STATE; // no match } int EST_WFST::transition(int state,const EST_String &inout) const { if (inout.contains("/")) return transition(state,inout.before("/"),inout.after("/")); else return transition(state,inout,inout); } int EST_WFST::transition(int state,const EST_String &in, const EST_String &out) const { int in_i = p_in_symbols.name(in); int out_i = p_out_symbols.name(out); if ((in_i == -1) || (out_i == -1)) { cerr << "WFST: one of " << in << "/" << out << " not in alphabet" << endl; return WFST_ERROR_STATE; } return transition(state,in_i,out_i); } int EST_WFST::transition(int state,int in, int out) const { // Finds first transition (hopefully deterministic) float prob; return transition(state,in,out,prob); } EST_WFST_Transition *EST_WFST::find_transition(int state,int in, int out) const { // Finds first transition (hopefully deterministic) EST_WFST_State *s = p_states(state); EST_Litem *i; for (i=s->transitions.head(); i != 0; i=i->next()) { if ((in == s->transitions(i)->in_symbol()) && (out == s->transitions(i)->out_symbol())) { if (cumulate()) s->transitions(i)->set_weight(1+s->transitions(i)->weight()); return s->transitions(i); } } return 0; // no match } int EST_WFST::transition(int state,int in, int out,float &prob) const { // Finds first transition (hopefully deterministic) EST_WFST_Transition *trans = find_transition(state,in,out); if (trans == 0) { prob = 0; return WFST_ERROR_STATE; } else { prob = trans->weight(); return trans->state(); } } EST_write_status EST_WFST::save_binary(FILE *fd) { int i; EST_Litem *j; int num_transitions, type, in, out, next_state; float weight; for (i=0; inum_transitions(); fwrite(&num_transitions,4,1,fd); if (p_states[i]->type() == wfst_final) type = WFST_FINAL; else if (p_states[i]->type() == wfst_nonfinal) type = WFST_NONFINAL; else if (p_states[i]->type() == wfst_licence) type = WFST_LICENCE; else type = WFST_ERROR; fwrite(&type,4,1,fd); for (j=p_states[i]->transitions.head(); j != 0; j=j->next()) { in = p_states[i]->transitions(j)->in_symbol(); out = p_states[i]->transitions(j)->out_symbol(); next_state = p_states[i]->transitions(j)->state(); weight = p_states[i]->transitions(j)->weight(); if (in == out) { in *= -1; fwrite(&in,4,1,fd); } else { fwrite(&in,4,1,fd); fwrite(&out,4,1,fd); } fwrite(&next_state,4,1,fd); fwrite(&weight,4,1,fd); } } return write_ok; } EST_write_status EST_WFST::save(const EST_String &filename, const EST_String type) { FILE *ofd; int i; static EST_Regex needquotes(".*[()'\";., \t\n\r].*"); EST_Litem *j; if (filename == "-") ofd = stdout; else if ((ofd = fopen(filename,"wb")) == NULL) { cerr << "WFST: cannot write to file \"" << filename << "\"" << endl; return misc_write_error; } fprintf(ofd,"EST_File fst\n"); fprintf(ofd,"DataType %s\n",(const char *)type); fprintf(ofd,"in %s\n", (const char *)quote_string(EST_String("(")+ p_in_symbols.print_to_string(TRUE)+")", "\"","\\",1)); fprintf(ofd,"out %s\n", (const char *)quote_string(EST_String("(")+ p_out_symbols.print_to_string(TRUE)+")", "\"","\\",1)); fprintf(ofd,"NumStates %d\n",p_num_states); fprintf(ofd, "ByteOrder %s\n", ((EST_NATIVE_BO == bo_big) ? "10" : "01")); fprintf(ofd,"EST_Header_End\n"); if (type == "binary") save_binary(ofd); else { for (i=0; i < p_num_states; i++) { EST_WFST_State *s=p_states[i]; fprintf(ofd,"((%d ",s->name()); switch(s->type()) { case wfst_final: fprintf(ofd,"final "); break; case wfst_nonfinal: fprintf(ofd,"nonfinal "); break; case wfst_licence: fprintf(ofd,"licence "); break; default: fprintf(ofd,"error "); } fprintf(ofd,"%d)\n",s->num_transitions()); for (j=s->transitions.head(); j != 0; j=j->next()) { EST_String in = p_in_symbols.name(s->transitions(j)->in_symbol()); EST_String out=p_out_symbols.name(s->transitions(j)->out_symbol()); if (in.matches(needquotes)) fprintf(ofd," (%s ",(const char *)quote_string(in,"\"","\\",1)); else fprintf(ofd," (%s ",(const char *)in); if (out.matches(needquotes)) fprintf(ofd," %s ",(const char *)quote_string(out,"\"","\\",1)); else fprintf(ofd," %s ",(const char *)out); fprintf(ofd,"%d %g)\n", s->transitions(j)->state(), s->transitions(j)->weight()); } fprintf(ofd,")\n"); } } if (ofd != stdout) fclose(ofd); return write_ok; } static float get_float(FILE *fd,int swap) { float f; fread(&f,4,1,fd); if (swap) swapfloat(&f); return f; } static int get_int(FILE *fd,int swap) { int i; fread(&i,4,1,fd); if (swap) return SWAPINT(i); else return i; } EST_read_status EST_WFST::load_binary(FILE *fd, EST_Option &hinfo, int num_states, int swap) { EST_read_status r; int i,j, s; int num_trans, state_type; int in_sym, out_sym, next_state; float trans_cost; r = format_ok; for (i=0; i < num_states; i++) { num_trans = get_int(fd,swap); state_type = get_int(fd,swap); if (state_type == WFST_FINAL) s = add_state(wfst_final); else if (state_type == WFST_NONFINAL) s = add_state(wfst_nonfinal); else if (state_type == WFST_LICENCE) s = add_state(wfst_licence); else if (state_type == WFST_ERROR) s = add_state(wfst_error); else { cerr << "WFST load: unknown state type \"" << state_type << "\"" << endl; r = read_format_error; break; } if (s != i) { cerr << "WFST load: internal error: unexpected state misalignment" << endl; r = read_format_error; break; } for (j=0; j < num_trans; j++) { in_sym = get_int(fd,swap); if (in_sym < 0) { in_sym *= -1; out_sym = in_sym; } else out_sym = get_int(fd,swap); next_state = get_int(fd,swap); trans_cost = get_float(fd,swap); p_states[i]->add_transition(trans_cost,next_state,in_sym,out_sym); } } return r; } EST_read_status EST_WFST::load(const EST_String &filename) { // Load a WFST from a file FILE *fd; EST_TokenStream ts; EST_Option hinfo; bool ascii; EST_EstFileType t; EST_read_status r; int i,s; int swap; if ((fd=fopen(filename,"r")) == NULL) { cerr << "WFST load: unable to open \"" << filename << "\" for reading" << endl; return read_error; } ts.open(fd,FALSE); ts.set_quotes('"','\\'); if (((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) || (t != est_file_fst)) { cerr << "WFST load: not a WFST file \"" << filename << "\"" <add_transition(w,end,in,out); } return format_ok; } EST_String EST_WFST::summary() const { int i; int tt=0; for (i=0; i < p_num_states; i++) tt += p_states(i)->transitions.length(); return EST_String("WFST ")+itoString(p_num_states)+" states "+ itoString(tt)+" transitions "; } void EST_WFST::more_states(int new_max) { int i; p_states.resize(new_max); for (i=p_num_states; i < new_max; i++) p_states[i] = 0; } int EST_WFST::add_state(enum wfst_state_type state_type) { // Add new state of given type EST_WFST_State *s = new EST_WFST_State(p_num_states); if (p_num_states >= p_states.length()) { // Need more space for states more_states((int)((float)(p_states.length()+1)*1.5)); } p_states[p_num_states] = s; s->set_type(state_type); p_num_states++; return s->name(); } void EST_WFST::start_cumulate(void) { // cumulate transitions during recognition EST_Litem *j; int i; p_cumulate = 1; for (i=0; i < p_num_states; i++) { EST_WFST_State *s=p_states[i]; for (j=s->transitions.head(); j !=0; j=j->next()) s->transitions(j)->set_weight(0); } } void EST_WFST::stop_cumulate(void) { EST_Litem *j; int i; float t; p_cumulate = 0; for (i=0; i < p_num_states; i++) { EST_WFST_State *s=p_states[i]; for (t=0,j=s->transitions.head(); j !=0; j=j->next()) t += s->transitions(j)->weight(); if (t > 0) for (j=s->transitions.head(); j !=0; j=j->next()) s->transitions(j)->set_weight(s->transitions(j)->weight()/t); } } speech_tools/grammar/wfst/wfst_regex.cc0000644000076400007640000001476710127000720016762 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* WFST functions for building from REGEXs */ /* */ /*=======================================================================*/ #include #include "EST_cutils.h" #include "EST_WFST.h" void EST_WFST::build_or_transition(int start, int end, LISP disjunctions) { // Choice of either disjunct LISP l; int intermed; if (disjunctions == NIL) cerr << "WFST construct: disjunct is nil\n"; for (l=disjunctions; l != NIL; l=cdr(l)) { // Can't go directly to end as other transitions could be added there intermed = add_state(wfst_nonfinal); build_wfst(start,intermed,car(l)); build_wfst(intermed,end,epsilon_label()); } } void EST_WFST::build_and_transition(int start, int end, LISP conjunctions) { // require each conjunct in turn int intermed,lstart; LISP l; if (conjunctions == NIL) cerr << "WFST build: conjunct is nil\n"; lstart = start; for (l=conjunctions; cdr(l) != NIL; l=cdr(l)) { intermed = add_state(wfst_nonfinal); build_wfst(lstart,intermed,car(l)); lstart = intermed; } build_wfst(lstart,end,car(l)); } int EST_WFST::terminal(LISP l) { // true, l is a terminal in a regex if (atomp(l)) return TRUE; else return FALSE; } int EST_WFST::operator_or(LISP l) { if (l && !consp(l) && (streq("or",get_c_string(l)))) return TRUE; else return FALSE; } int EST_WFST::operator_plus(LISP l) { if (l && !consp(l) && (streq("+",get_c_string(l)))) return TRUE; else return FALSE; } int EST_WFST::operator_not(LISP l) { if (l && !consp(l) && (streq("not",get_c_string(l)))) return TRUE; else return FALSE; } int EST_WFST::operator_star(LISP l) { if (l && !consp(l) && (streq("*",get_c_string(l)))) return TRUE; else return FALSE; } int EST_WFST::operator_optional(LISP l) { if (l && !consp(l) && (streq("?",get_c_string(l)))) return TRUE; else return FALSE; } int EST_WFST::operator_and(LISP l) { if (l && !consp(l) && (streq("and",get_c_string(l)))) return TRUE; else return FALSE; } void EST_WFST::build_wfst(int start, int end,LISP regex) { if (terminal(regex)) { // unpack the label int in,out; EST_String s_name(get_c_string(regex)); if (s_name.contains("/")) { in = p_in_symbols.name(s_name.before("/")); out = p_out_symbols.name(s_name.after("/")); } else { in = p_in_symbols.name(get_c_string(regex)); out = p_out_symbols.name(get_c_string(regex)); } if ((in == -1) || (out == -1)) cerr << "WFST_build: symbol " << get_c_string(regex) << " not in alphabet\n"; p_states[start]->add_transition(0,end,in,out); } else if (operator_or(car(regex))) build_or_transition(start,end,cdr(regex)); else if (operator_plus(car(regex))) { build_wfst(start,end,cdr(regex)); build_wfst(end,end,cdr(regex)); } else if (operator_star(car(regex))) { build_wfst(start,start,cdr(regex)); build_wfst(start,end,epsilon_label()); } else if (operator_not(car(regex))) { int errstate = add_state(wfst_error); build_and_transition(start,errstate,cdr(regex)); } else if (operator_optional(car(regex))) { build_wfst(start,end,cdr(regex)); build_wfst(start,end,epsilon_label()); } else if (operator_and(car(regex))) build_and_transition(start,end,cdr(regex)); else build_and_transition(start,end,regex); // default is and } void EST_WFST::build_from_regex(LISP inalpha, LISP outalpha, LISP regex) { clear(); cout << "building from regex: " << endl; pprint(regex); init(inalpha,outalpha); // alphabets if (regex == NIL) p_start_state = add_state(wfst_final); // empty WFST else { p_start_state = add_state(wfst_nonfinal); int end = add_state(wfst_final); build_wfst(p_start_state,end,regex); } } speech_tools/grammar/wfst/wfst_ops.cc0000644000076400007640000007571611465017155016472 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Basic WFST operations: minimization, determinization, intersection, */ /* union, composition */ /* */ /*=======================================================================*/ #include #include #include "EST_WFST.h" #include "wfst_aux.h" #include "EST_String.h" #include "EST_TList.h" #include "EST_TKVL.h" #include "EST_THash.h" Declare_TList_T(EST_WFST_MultiState *,EST_WFST_MultiStateP) // Declare_KVL(int, EST_IList) typedef EST_TKVI KVI_int_EST_IList_t; typedef EST_TKVL KVL_int_EST_IList_t; static EST_IList int_EST_IList_kv_def_EST_IList_s; static int int_EST_IList_kv_def_int_s; template <> EST_IList *EST_TKVL< int, EST_IList >::default_val=&int_EST_IList_kv_def_EST_IList_s; template <> int *EST_TKVL< int, EST_IList >::default_key=&int_EST_IList_kv_def_int_s; Declare_TList_N(KVI_int_EST_IList_t, 0) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList_T_MIN(EST_WFST_MultiState *,EST_WFST_MultiStateP) #include "../base_class/EST_TKVL.cc" // Instantiate_KVL(int, EST_IList) template class EST_TKVL; template class EST_TKVI; // ostream &operator<<(ostream &s, EST_TKVI< int , EST_IList > const &i){ return s << i.k << "\t" << i.v << "\n"; } // ostream& operator << (ostream& s, EST_TKVL< int , EST_IList > const &l) {EST_Litem *p; for (p = l.list.head(); p ; p = p->next()) s << l.list(p).k << "\t" << l.list(p).v << endl; return s;} Instantiate_TIterator_T(KVL_int_EST_IList_t, KVL_int_EST_IList_t::IPointer_k, int, KVL_int_EST_IList_kitt) Instantiate_TStructIterator_T(KVL_int_EST_IList_t, KVL_int_EST_IList_t::IPointer, KVI_int_EST_IList_t, KVL_int_EST_IList_itt) Instantiate_TIterator_T(KVL_int_EST_IList_t, KVL_int_EST_IList_t::IPointer, KVI_int_EST_IList_t, KVL_int_EST_IList_itt) // Instantiate_TList(KVI_int_EST_IList_t) template class EST_TList< TLIST_KVI_int_EST_IList_t_VAL >; template class EST_TItem< TLIST_KVI_int_EST_IList_t_VAL >; template const char *error_name(EST_TList< KVI_int_EST_IList_t > val); Instantiate_TIterator_T( EST_TList, EST_TList::IPointer, KVI_int_EST_IList_t, TList_KVI_int_EST_IList_t_itt); #endif typedef EST_TList Agenda; static enum wfst_state_type intersect_state_type(wfst_list &wl, EST_WFST_MultiState *ms); static int check_distinguished(const EST_WFST &nmwfst, int p, int q, wfst_marks &marks, wfst_assumes &assumptions); void EST_WFST_MultiState::add(int i) { // If of set type only add it if its not already there EST_Litem *p; if (p_type == wfst_ms_set) for (p=head(); p != 0; p=p->next()) { if ((*this)(p) == i) return; else if (i < (*this)(p)) // keep the list ordered { insert_before(p,i); return; } } append(i); } int multistate_index(EST_WFST_MultiStateIndex &index, EST_WFST_MultiState *ms,int proposed) { // Returns proposed if ms is not already in index, otherwise // returns the value that was proposed when it was first new. // I'll have to make this more efficient in future. EST_String istring(""); EST_Litem *p; int ns,found; for (p=ms->head(); p != 0; p = p->next()) istring += itoString((*ms)(p)) + " "; ns = index.val(istring,found); if (found) return ns; else { index.add_item(istring,proposed); return proposed; } } static int pair_check(EST_THash &pairs_done, int i, int o, int odim) { int p; int found; p = (i*odim)+o; // unique number representing i/o pair pairs_done.val(p,found); if (!found) { // first time seeing this pair pairs_done.add_item(p,1); return 0; } return 1; } void EST_WFST::determinize(const EST_WFST &ndwfst) { // Determinise a non-deterministic WFST EST_WFST_MultiState *start_state,*nms,*current; int ns; Agenda multistate_agenda; EST_WFST_MultiStateIndex index(100); int i,o, new_name; int c=0; EST_Litem *sp, *tp; clear(); p_in_symbols.copy(ndwfst.p_in_symbols); p_out_symbols.copy(ndwfst.p_out_symbols); // Create a starting state and add it to this WFST start_state = new EST_WFST_MultiState(wfst_ms_set); start_state->add(ndwfst.start_state()); ndwfst.add_epsilon_reachable(start_state); p_start_state = add_state(ndwfst.ms_type(start_state)); start_state->set_name(p_start_state); multistate_agenda.append(start_state); // initialize agenda while (multistate_agenda.length() > 0) { EST_THash pairs_done(100); current = multistate_agenda.first(); multistate_agenda.remove(multistate_agenda.head()); if ((c % 100) == 99) cout << "Determinizing " << summary() << " Agenda " << multistate_agenda.length() << endl; c++; for (sp=current->head(); sp != 0; sp=sp->next()) { const EST_WFST_State *s = ndwfst.state((*current)(sp)); for (tp=s->transitions.head(); tp != 0; tp = tp->next()) { i = s->transitions(tp)->in_symbol(); o = s->transitions(tp)->out_symbol(); // Need to check if i/o has already been proposed if (pair_check(pairs_done,i,o,p_out_symbols.length()) == 1) continue; // already prosed those // for (i=0; i < p_in_symbols.length(); i++) // { // start at 2 to skip any and epsilon characters -- hmm bad // for (o=0; o < p_out_symbols.length(); o++) // { if ((i==o) && (i==0)) continue; // don't deal here with epsilon transitions nms = apply_multistate(ndwfst,current,i,o); if ((nms->length() == 0) || (ndwfst.ms_type(nms) == wfst_error)) { delete nms; continue; // no state to go to } new_name = multistate_index(index,nms,p_num_states); if (new_name == p_num_states) // genuinely new { // create a real state and add it to the agenda ns = add_state(ndwfst.ms_type(nms)); nms->set_name(ns); multistate_agenda.append(nms); } else { nms->set_name(new_name); delete nms; } // Add new transition to current state p_states[current->name()] ->add_transition(nms->weight(), nms->name(), i,o); } } delete current; // Probably want some progress summary } } EST_WFST_MultiState *EST_WFST::apply_multistate(const EST_WFST &wfst, EST_WFST_MultiState *ms, int in, int out) const { // Apply in and out to ms and find all new states it becomes EST_Litem *p; EST_WFST_MultiState *new_ms = new EST_WFST_MultiState(wfst_ms_set); new_ms->clear(); for (p=ms->head(); p != 0; p=p->next()) // Add all new possible states from ms(p) given in/out wfst.transition_all((*ms)(p),in,out,new_ms); // Add epsilon reachable states from any states in multistates wfst.add_epsilon_reachable(new_ms); return new_ms; } enum wfst_state_type EST_WFST::ms_type(EST_WFST_MultiState *ms) const { // Returns wfst_error if ms contains an error state, wfst_final // if there is at least one final and wfst_non_final EST_Litem *p; enum wfst_state_type r = wfst_nonfinal; for (p=ms->head(); p != 0; p = p->next()) if (p_states((*ms)(p))->type() == wfst_error) return wfst_error; else if (p_states((*ms)(p))->type() == wfst_licence) // wfst_licence states are generated in KK compilation r = wfst_licence; else if ((p_states((*ms)(p))->type() == wfst_final) && (r != wfst_licence)) r = wfst_final; if (r == wfst_licence) return wfst_nonfinal; else return r; } void EST_WFST::transition_all(int state, int in, int out, EST_WFST_MultiState *ms) const { // Find all possible new states from state given in/out const EST_WFST_State *s = p_states(state); EST_Litem *i; for (i=s->transitions.head(); i != 0; i=i->next()) { if ((in == s->transitions(i)->in_symbol()) && (out == s->transitions(i)->out_symbol())) ms->add(s->transitions(i)->state()); } } static int is_a_member(const EST_IList &ii, int i) { for (EST_Litem *p=ii.head(); p != 0; p=p->next()) if (ii(p) == i) return TRUE; return FALSE; } void EST_WFST::add_epsilon_reachable(EST_WFST_MultiState *ms) const { // As ms->add() adds in order we need to copy to a new list and append // to it any new epsilon accessible states EST_Litem *p; EST_IList ii; int ie = p_in_symbols.name(get_c_string(epsilon_label())); int oe = p_out_symbols.name(get_c_string(epsilon_label())); for (p=ms->head(); p != 0; p=p->next()) ii.append((*ms)(p)); for (p=ii.head(); p != 0; p=p->next()) { const EST_WFST_State *s = p_states(ii(p)); EST_Litem *i; for (i=s->transitions.head(); i != 0; i=i->next()) { if ((ie == s->transitions(i)->in_symbol()) && (oe == s->transitions(i)->out_symbol())) { // Add to end of ii if not already there int nstate = s->transitions(i)->state(); if (!is_a_member(ii,nstate)); { ii.append(nstate); ms->add(nstate); // gets added in order } } } } } /************************************************************************/ /* Intersection of a list of transducers, i.e. what is accepted by all */ /************************************************************************/ void EST_WFST::intersection(wfst_list &wl) { // This is very similar to determinisation, similar complexity too EST_WFST_MultiState *start_state = new EST_WFST_MultiState(wfst_ms_list); EST_WFST_MultiState *nms,*current; int ns; Agenda multistate_agenda; EST_WFST_MultiStateIndex index(100); int i,o, new_name, n; EST_Litem *p,*q; int c=0; // Initialize this WFST from the given ones clear(); p_in_symbols.copy(wl.first().p_in_symbols); p_out_symbols.copy(wl.first().p_out_symbols); // Determinize each input WFST and make a new start state consisting of // the start states of each of the input WFSTs for (p=wl.tail(); p != 0; p=p->prev()) { if (!wl(p).deterministic()) { cout << "...intersection deterministing" << endl; EST_WFST tt = wl(p); wl(p).determinize(tt); } start_state->add(wl(p).start_state()); } p_start_state = add_state(intersect_state_type(wl,start_state)); // Label multistate start start with single-state name start_state->set_name(p_start_state); multistate_agenda.append(start_state); // initialize agenda while (multistate_agenda.length() > 0) { current = multistate_agenda.first(); multistate_agenda.remove(multistate_agenda.head()); if ((c % 100) == 99) cout << "Intersection " << summary() << " Agenda " << multistate_agenda.length() << endl; c++; // For all possible in/out pairs for (i=0; i < p_in_symbols.length(); i++) { // start at 2 to skip any and epsilon characters -- hmm bad for (o=0; o < p_out_symbols.length(); o++) { if ((i==o) && (i==0)) // shouldn't be epsilon/epsilon here continue; nms = new EST_WFST_MultiState(wfst_ms_list); // Increment multistate to new multistate for each individual // state using each WFST for (n=0,p=wl.head(),q=current->head(); (p != 0) && (q != 0); p=p->next(),q=q->next(),n++) nms->add(wl(p).transition((*current)(q),i,o)); if (intersect_state_type(wl,nms) == wfst_error) { delete nms; continue; // no state to go to } new_name = multistate_index(index,nms,p_num_states); if (new_name == p_num_states) // genuinely new and unseen { // create a real state and add it to the agenda ns = add_state(intersect_state_type(wl,nms)); nms->set_name(ns); multistate_agenda.append(nms); } else // already seen this state, and is already named { nms->set_name(new_name); delete nms; } // Add new transition to current state p_states[current->name()] ->add_transition(nms->weight(),nms->name(),i,o); } } delete current; // Probably want some progress summary } } static enum wfst_state_type intersect_state_type(wfst_list &wl, EST_WFST_MultiState *ms) { // Find the state type of the combined states // If any are error, return error, if one is nonfinal return nonfinal // otherwise its final EST_Litem *p,*q; enum wfst_state_type r = wfst_final; for (p=wl.head(),q=ms->head(); (p != 0) && (q != 0); p=p->next(),q=q->next()) { if ((*ms)(q) == WFST_ERROR_STATE) return wfst_error; enum wfst_state_type dd = wl(p).state((*ms)(q))->type(); if (dd == wfst_error) return wfst_error; else if (dd == wfst_nonfinal) r = wfst_nonfinal; } return r; } void EST_WFST::intersection(const EST_WFST &a, const EST_WFST &b) { // Intersect two WFSTs wfst_list wl; wl.append(a); wl.append(b); intersection(wl); } /*******************************************************************/ /* Minimization is of complexity of O(n^2) */ /*******************************************************************/ void EST_WFST::minimize(const EST_WFST &nmwfst) { // Minimize a WFST int p,q; wfst_marks marks(nmwfst.num_states()); wfst_assumes assumptions; // For each combination of states for (p=0; p < nmwfst.num_states()-1; p++) for (q=p+1; q < nmwfst.num_states(); q++) check_distinguished(nmwfst,p,q,marks,assumptions); // The marked array now has all different and lists to equivalent states // Build an array mapping old name to new name. int num_new_states; int i; EST_IVector state_map; marks.find_state_map(state_map,num_new_states); // Build the new minimized WFST mapping existing transitions clear(); p_in_symbols.copy(nmwfst.p_in_symbols); p_out_symbols.copy(nmwfst.p_out_symbols); init(num_new_states); p_start_state = state_map(nmwfst.p_start_state); for (i=0; i < nmwfst.num_states(); i++) { if (p_states[state_map(i)] == 0) p_states[state_map(i)] = copy_and_map_states(state_map,nmwfst.state(i),nmwfst); } } static int check_distinguished(const EST_WFST &nmwfst, int p, int q, wfst_marks &marks, wfst_assumes &assumptions) { // Check to see if these two are equivalent EST_Litem *t; EST_IList from_p,from_q; if (marks.distinguished(p,q)) // been here, done that return TRUE; else if (marks.undistinguished(p,q)) // been here too return FALSE; // Not been here yet so do some work to try to find out if // these states can be distinguished else if ((nmwfst.state(p)->type() != nmwfst.state(q)->type()) || (nmwfst.state(p)->num_transitions() != nmwfst.state(q)->num_transitions())) { // Different final/non-final type or different number // of transitions so obviously different states marks.distinguish(p,q); return TRUE; } else { // Have to check their transitions individually for (t=nmwfst.state(p)->transitions.head(); t != 0; t=t->next()) { int in = nmwfst.state(p)->transitions(t)->in_symbol(); int out = nmwfst.state(p)->transitions(t)->out_symbol(); int y = nmwfst.state(p)->transitions(t)->state(); int z = nmwfst.transition(q,in,out); if ((z == WFST_ERROR_STATE) || (marks.distinguished(y,z))) { // no equiv transition or obviously different states marks.distinguish(p,q); return TRUE; } else if (equivalent_to(y,z,assumptions)) continue; else // Potential equivalence, record y,z for later { from_p.append(y); from_q.append(z); } } // All transitions had potential match so only now // actually check their follow sets EST_Litem *yp, *zp; int tl = FALSE; if (assumptions.length() == 0) tl = TRUE; // assume they are undistinguished add_assumption(p,q,assumptions); for (yp=from_p.head(),zp=from_q.head(); yp != 0; yp=yp->next(),zp=zp->next()) if (check_distinguished(nmwfst,from_p(yp),from_q(zp), marks, assumptions)) { marks.distinguish(p,q); // set the distinguished assumptions.clear(); return TRUE; } // ok I give up, they are the same if (tl) { // This is equivalent given the assumptions (and no // higher level assumptions) so we can mark these states // as undistinguished (and all the assumptions) mark_undistinguished(marks,assumptions); assumptions.clear(); } return FALSE; } } void EST_WFST::extend_alphabets(const EST_WFST &b) { // Extend current in/out alphabets to accommodate anything in b's // that are not in a's // This guarantees that the number in this will still be valid EST_StrList ivocab, ovocab; int i; for (i=0; iname())); EST_Litem *i; ns->set_type(s->type()); for (i=s->transitions.head(); i != 0; i=i->next()) { int mapped_state= state_map(s->transitions(i)->state()); if (mapped_state != WFST_ERROR_STATE) ns->add_transition(s->transitions(i)->weight(), mapped_state, in_symbol(b.in_symbol(s->transitions(i)->in_symbol())), out_symbol(b.out_symbol(s->transitions(i)->out_symbol()))); } return ns; } /***********************************************************************/ /* Build a WFST which doesn't accept any of the strings that a accepts */ /* This keeps the same in/out alphabet */ /***********************************************************************/ void EST_WFST::complement(const EST_WFST &a) { int i; copy(a); for (i=0; i < num_states(); i++) { if (p_states[i]->type() == wfst_final) p_states[i]->set_type(wfst_nonfinal); else if (p_states[i]->type() == wfst_nonfinal) p_states[i]->set_type(wfst_final); // errors remain errors } } static int noloopstostart(const EST_WFST &a) { // TRUE if there are no transitions leading to the start state // when this is true there is a union operation which preserves // deterministicness int i; for (i=0; i < a.num_states(); i++) { const EST_WFST_State *s = a.state(i); EST_Litem *p; for (p=s->transitions.head(); p != 0; p=p->next()) { if (s->transitions(p)->state() == a.start_state()) return FALSE; } } return TRUE; } int EST_WFST::deterministiconstartstates(const EST_WFST &a, const EST_WFST &b) const { // TRUE if there are no common transition labels from a and b's // start state EST_IMatrix tab; int in,out; tab.resize(a.p_in_symbols.length(),a.p_out_symbols.length()); tab.fill(0); for (EST_Litem *t=a.state(a.start_state())->transitions.head(); t != 0; t=t->next()) { tab(a.state(a.start_state())->transitions(t)->in_symbol(), a.state(a.start_state())->transitions(t)->out_symbol()) = 1; } for (EST_Litem *tt=b.state(b.start_state())->transitions.head(); tt != 0; tt=tt->next()) { in = a.in_symbol(b.in_symbol(b.state(b.start_state())->transitions(tt)->in_symbol())); out = a.out_symbol(b.out_symbol(b.state(b.start_state())->transitions(tt)->out_symbol())); if (in == -1) continue; // obviously not a clash else if (out == -1) continue; // obviously not a clash else if (tab(in,out) == 1) return FALSE; } return TRUE; } /***********************************************************************/ /* Build a WFST which accepts both strings of a and of b */ /***********************************************************************/ void EST_WFST::uunion(const EST_WFST &a,const EST_WFST &b) { EST_IVector smap; int i; copy(a); extend_alphabets(b); if (a.deterministic() && b.deterministic() && noloopstostart(a) && noloopstostart(b) && deterministiconstartstates(a,b)) { // This does the union without the epsilon and will preserve // deterministic wfsts in this special case smap.resize(b.num_states()); smap[0] = start_state(); for (i=1; i < b.num_states(); ++i) smap[i] = i+a.num_states()-1; more_states(a.num_states()+b.num_states()-1); p_num_states += b.num_states()-1; for (i=1; i < b.num_states(); i++) p_states[smap(i)] = copy_and_map_states(smap,b.state(i),b); const EST_WFST_State *s = b.state(b.start_state()); EST_Litem *p; for (p=s->transitions.head(); p != 0; p=p->next()) { int mapped_state= smap(s->transitions(p)->state()); if (mapped_state != WFST_ERROR_STATE) p_states[start_state()]-> add_transition(s->transitions(p)->weight(), mapped_state, in_symbol(b.in_symbol(s->transitions(p)->in_symbol())), out_symbol(b.out_symbol(s->transitions(p)->out_symbol()))); } } else { // do it the hard way smap.resize(b.num_states()); for (i=0; i < b.num_states(); ++i) smap[i] = i+a.num_states(); more_states(a.num_states()+b.num_states()); p_num_states += b.num_states(); for (i=0; i < b.num_states(); i++) p_states[smap(i)] = copy_and_map_states(smap,b.state(i),b); // Actually do the union bit by adding an epsilon transition from // the start of a to start state of b p_states[start_state()]->add_transition(0.0,smap[b.start_state()], in_epsilon(), out_epsilon()); } } /***********************************************************************/ /* Build a WFST which a followed by b */ /***********************************************************************/ void EST_WFST::concat(const EST_WFST &a,const EST_WFST &b) { EST_IVector smap; int i; copy(a); extend_alphabets(b); smap.resize(b.num_states()); for (i=0; i < b.num_states(); ++i) smap[i] = i+a.num_states(); more_states(a.num_states()+b.num_states()); // everything final in a becomes non final and an epsilon transition // goes from them to the start of b for (i=0; i < num_states(); i++) { if (p_states[i]->type() == wfst_final) { p_states[i]->set_type(wfst_nonfinal); p_states[i]->add_transition(0.0,smap[b.start_state()], in_epsilon(), out_epsilon()); } } p_num_states += b.num_states(); for (i=0; i < b.num_states(); i++) p_states[smap(i)] = copy_and_map_states(smap,b.state(i),b); } /***********************************************************************/ /* Build a WFST from composing a and b (feeding output of a to */ /* input of b) */ /***********************************************************************/ void EST_WFST::compose(const EST_WFST &a,const EST_WFST &b) { EST_WFST_MultiState *start_state = new EST_WFST_MultiState(wfst_ms_list); EST_WFST_MultiState *nms,*current; Agenda multistate_agenda; EST_WFST_MultiStateIndex index(100); wfst_list wl; EST_WFST t; int i,new_name; EST_Litem *p,*q; clear(); p_in_symbols.copy(a.p_in_symbols); p_out_symbols.copy(b.p_out_symbols); // Unfortunately need to needlessly copy a and b here wl.append(a); start_state->add(a.start_state()); wl.append(b); start_state->add(b.start_state()); p_start_state = add_state(intersect_state_type(wl,start_state)); // Label multistate start start with single-state name start_state->set_name(p_start_state); multistate_agenda.append(start_state); // initialize agenda while (multistate_agenda.length() > 0) { current = multistate_agenda.first(); multistate_agenda.remove(multistate_agenda.head()); // For all possible in/out pairs for (i=0; i < p_in_symbols.length(); i++) { // start at 2 to skip any and epsilon characters -- hmm bad // find transitions wfst_translist transa; wl.first().transduce(current->first(),i,transa); for (p=transa.head(); p != 0; p=p->next()) { wfst_translist transb; // feed a's out to b'is in wl.last().transduce( current->last(), b.in_symbol(a.out_symbol(transa(p)->out_symbol())), transb); for (q = transb.head(); q != 0; q=q->next()) { nms = new EST_WFST_MultiState(wfst_ms_list); nms->add(transa(p)->state()); nms->add(transb(q)->state()); if (intersect_state_type(wl,nms) == wfst_error) { delete nms; continue; // no state to go to } new_name = multistate_index(index,nms,p_num_states); if (new_name == p_num_states) // genuinely new and unseen { // create a real state and add it to the agenda int ns = add_state(intersect_state_type(wl,nms)); nms->set_name(ns); multistate_agenda.append(nms); } else // already seen this state, and is already named nms->set_name(new_name); // Add new transition to current state p_states[current->name()] ->add_transition(nms->weight(),nms->name(), i,transb(q)->out_symbol()); } } } delete current; // Probably want some progress summary } } /***********************************************************************/ /* Build a WFST which accepts strings in a but not in b */ /***********************************************************************/ void EST_WFST::difference(const EST_WFST &a,const EST_WFST &b) { EST_WFST compb; // This is sort of a complement, but not quite // But what would the name of this operation be? compb.copy(b); for (int i=0; i < compb.num_states(); i++) { if (compb.p_states[i]->type() == wfst_final) compb.p_states[i]->set_type(wfst_error); } uunion(a,compb); } /***********************************************************************/ /* Remove states from which a final state can't be reached */ /***********************************************************************/ void EST_WFST::remove_error_states(const EST_WFST &a) { // Find all states which are reachable from the start state, and // can reach a final state. Mark all others as error states wfst_list wl; wl.append(a); EST_WFST &ab = wl.first(); ab.current_tag = ++traverse_tag; for (int i=0; i < ab.p_num_states; i++) ab.can_reach_final(i); // This will copy only the non-error states intersection(wl); } int EST_WFST::can_reach_final(int state) { // Return TRUE iff this state is final or can reach a final state if (p_states[state]->type() == wfst_final) return TRUE; else if (p_states[state]->type() == wfst_error) return FALSE; else if (p_states[state]->tag() == current_tag) // Been here and it is reachable return TRUE; else { EST_Litem *i; enum wfst_state_type current_val = p_states[state]->type(); enum wfst_state_type r = wfst_error; // temporarily set this to error to stop infinite recursion p_states[state]->set_type(wfst_error); for (i=p_states[state]->transitions.head(); i != 0; i=i->next()) // if any transition goes to something that reaches a final state // set the value back to its original if (can_reach_final(p_states[state]->transitions(i)->state())) r = current_val; // Will be set back to original value iff a final state // is reachable from here p_states[state]->set_type(r); if (r == wfst_error) return FALSE; else { p_states[state]->set_tag(current_tag); return TRUE; } } } /***********************************************************************/ /* True is wfst is deterministic */ /***********************************************************************/ int EST_WFST::deterministic() const { // True if all states contains no multiple arcs with the same symbol EST_IMatrix tab; tab.resize(p_in_symbols.length(),p_out_symbols.length()); for (int i=0; i < p_num_states; i++) { tab.fill(0); for (EST_Litem *t=state(i)->transitions.head(); t != 0; t=t->next()) { if (tab(state(i)->transitions(t)->in_symbol(), state(i)->transitions(t)->out_symbol()) == 1) return FALSE; else tab(state(i)->transitions(t)->in_symbol(), state(i)->transitions(t)->out_symbol()) = 1; } } return TRUE; } speech_tools/grammar/wfst/wfst_transduce.cc0000644000076400007640000002313611465017155017646 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Transduction using a WFST */ /* */ /*=======================================================================*/ #include #include "EST_WFST.h" /** An internal class in transduction of WFSTs holding intermediate state information. */ class wfst_tstate { public: int state; EST_IList outs; float score; }; ostream &operator << (ostream &s, const wfst_tstate &state) { (void)state; return s << "<>"; } Declare_TList(wfst_tstate) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList(wfst_tstate) #endif typedef EST_TList wfst_tstate_list; static void add_transduce_mstate(const EST_WFST &wfst, const wfst_tstate &cs, wfst_translist &tranlist, wfst_tstate_list &ns); int transduce(const EST_WFST &wfst,const EST_StrList &in,EST_StrList &out) { // Map names to internal ints before transduction EST_Litem *p; EST_IList in_i,out_i; int r; for (p=in.head(); p != 0; p=p->next()) in_i.append(wfst.in_symbol(in(p))); r = transduce(wfst,in_i,out_i); for (p=out_i.head(); p != 0; p=p->next()) out.append(wfst.out_symbol(out_i(p))); return r; } int transduce(const EST_WFST &wfst,const EST_IList &in,EST_IList &out) { // Transduce input stream to an output stream EST_Litem *i,*cs; int r=FALSE; wfst_tstate_list *current_ms = new wfst_tstate_list; wfst_tstate start_state; wfst_translist ss_eps_trans; start_state.state = wfst.start_state(); start_state.score = 0; current_ms->append(start_state); // Add any epsilon accessible states wfst.transduce(wfst.start_state(),wfst.in_epsilon(),ss_eps_trans); add_transduce_mstate(wfst,start_state,ss_eps_trans,*current_ms); for (i=in.head(); i != 0; i=i->next()) { wfst_tstate_list *ns = new wfst_tstate_list; for (cs=current_ms->head(); cs != 0; cs=cs->next()) { // For each state in current update list of new states wfst_translist translist; wfst.transduce((*current_ms)(cs).state,in(i),translist); add_transduce_mstate(wfst,(*current_ms)(cs),translist,*ns); } // Using pointers to avoid having to copy the state list delete current_ms; current_ms = ns; if (current_ms->length() == 0) break; // give up, no transition possible } // current_ms will contain the list of possible transitions if (current_ms->length() > 1) cerr << "WFST: found " << current_ms->length() << " transductions" << endl; // should find "best" but we'll find longest at present // Choose the longest (should be based on score) for (cs = current_ms->head(); cs != 0; cs=cs->next()) { if ((wfst.final((*current_ms)(cs).state)) && ((*current_ms)(cs).outs.length() > out.length())) { r = TRUE; out = (*current_ms)(cs).outs; } } delete current_ms; return r; } static void add_transduce_mstate(const EST_WFST &wfst, const wfst_tstate &cs, wfst_translist &translist, wfst_tstate_list &ns) { // For each possible transduction of in from cs.state in WFST // add it to ns. // This should really only add states if they are not already there // but you really need stae plus recognized path to get all // transductions so a tree structure would be better. EST_Litem *t; // Add new states to ns if not already there for (t=translist.head(); t != 0; t=t->next()) { // Declare a new one and put it on the end of the list // before we fill its values, this saves a copy wfst_tstate tts; ns.append(tts); wfst_tstate &ts = ns.last(); ts.state = translist(t)->state(); // the combination is probably WFST dependant ts.score = translist(t)->weight()+cs.score; // copying the outs up to now (pity) ts.outs = cs.outs; ts.outs.append(translist(t)->out_symbol()); // Also any potential epsilon transitions for this new state wfst_translist etranslist; wfst.transduce(ts.state,wfst.in_epsilon(),etranslist); add_transduce_mstate(wfst,ts,etranslist,ns); } } int recognize(const EST_WFST &wfst,const EST_StrList &in,int quiet) { // Map names to internal ints before recognition EST_Litem *p; EST_IList in_i,out_i; int i,o; int r; for (p=in.head(); p != 0; p=p->next()) { if (in(p).contains("/")) { i = wfst.in_symbol(in(p).before("/")); o = wfst.out_symbol(in(p).after("/")); } else { i = wfst.in_symbol(in(p)); o = wfst.out_symbol(in(p)); } in_i.append(i); out_i.append(o); } r = recognize(wfst,in_i,out_i,quiet); return r; } int recognize(const EST_WFST &wfst,const EST_IList &in, const EST_IList &out, int quiet) { int state = wfst.start_state(); EST_Litem *p,*q; int nstate; for (p=in.head(),q=out.head(); ((p != 0) && (q != 0)); p=p->next(),q=q->next()) { nstate = wfst.transition(state,in(p),out(q)); if (!quiet) printf("state %d %s/%s -> %d\n",state, (const char *)wfst.in_symbol(in(p)), (const char *)wfst.out_symbol(out(q)), nstate); state = nstate; if (state == WFST_ERROR_STATE) return FALSE; } if (p != q) { cerr << "wfst recognize: in/out tapes of different lengths" << endl; return FALSE; } if (wfst.final(state)) return TRUE; else return FALSE; } int recognize_for_perplexity(const EST_WFST &wfst, const EST_StrList &in, int quiet, float &count, float &sumlogp) { // Map names to internal ints before recognition EST_Litem *p; EST_IList in_i,out_i; int i,o; int r; for (p=in.head(); p != 0; p=p->next()) { if (in(p).contains("/")) { i = wfst.in_symbol(in(p).before("/")); o = wfst.out_symbol(in(p).after("/")); } else { i = wfst.in_symbol(in(p)); o = wfst.out_symbol(in(p)); } in_i.append(i); out_i.append(o); } r = recognize_for_perplexity(wfst,in_i,out_i,quiet,count,sumlogp); return r; } int recognize_for_perplexity(const EST_WFST &wfst, const EST_IList &in, const EST_IList &out, int quiet, float &count, float &sumlogp) { int state = wfst.start_state(); EST_Litem *p,*q; int nstate; float prob; count = 0; sumlogp = 0; for (p=in.head(),q=out.head(); ((p != 0) && (q != 0)); p=p->next(),q=q->next()) { nstate = wfst.transition(state,in(p),out(q),prob); count++; if (prob > 0) sumlogp += log(prob); else sumlogp += -100; // bad hack if (!quiet) printf("state %d %s/%s -> %d\n",state, (const char *)wfst.in_symbol(in(p)), (const char *)wfst.out_symbol(out(q)), nstate); state = nstate; if (state == WFST_ERROR_STATE) return FALSE; } if (p != q) { cerr << "wfst recognize: in/out tapes of different lengths" << endl; return FALSE; } if (wfst.final(state)) return TRUE; else return FALSE; } speech_tools/grammar/wfst/kkcompile.cc0000644000076400007640000002741311465017155016573 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996-1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A Koskenniemi/Kay/Kaplan rule compiler to WFST using the techniques */ /* Ritchie et al.'s "Computational Morphology" (but followed through to */ /* make real WFSTs). */ /* */ /*=======================================================================*/ #include #include "EST_WFST.h" #include "EST_cutils.h" ostream &operator << (ostream &s, const EST_WFST &w) { (void)w; return s << "<>"; } Declare_TList(EST_WFST) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList(EST_WFST) #endif static LISP expand_fp(const EST_String p,LISP fp); static LISP find_feasible_pairs(LISP rules); static LISP all_but(LISP rulepair,LISP fp); static LISP expand_sets(LISP sets,LISP fp); static LISP inline_sets(LISP l, LISP sets); static void full_kkcompile(LISP inalpha,LISP outalpha, LISP fp, LISP rules, LISP sets, EST_WFST &all_wfst); void kkcompile(LISP ruleset, EST_WFST &all_wfst) { // Build a transducer from given kkrule (Kay/Kaplan/Koskenniemi) // Rules are of the form LeftContext Map RightContext // The WFST is recognizing all string except the rulepair unless // its in the proper context. LISP fp; // feasible pairs, those pairs with rules (rather than IxO) LISP inalpha = siod_nth(1,siod_assoc_str("Alphabets",cdr(cdr(ruleset)))); LISP outalpha = siod_nth(2,siod_assoc_str("Alphabets",cdr(cdr(ruleset)))); LISP sets = cdr(siod_assoc_str("Sets",ruleset)); LISP rules = cdr(siod_assoc_str("Rules",ruleset)); fp = find_feasible_pairs(rules); sets = expand_sets(sets,fp); full_kkcompile(inalpha,outalpha,fp,rules,sets,all_wfst); } static void full_kkcompile(LISP inalpha,LISP outalpha, LISP fp, LISP rules, LISP sets, EST_WFST &all_wfst) { wfst_list rulelist; LISP r; for (r=rules; r != NIL; r=cdr(r)) { EST_WFST r_wfst,base_wfst,det_wfst; rulelist.append(r_wfst); EST_WFST &rr_wfst = rulelist.last(); // to avoid copying the filled one cout << "Rule: " << siod_llength(rules)-siod_llength(r) << endl; pprint(car(r)); base_wfst.kkrule_compile(inalpha,outalpha,fp,car(r),sets); cout << " base " << base_wfst.summary() << endl; det_wfst.determinize(base_wfst); cout << " determinized " << det_wfst.summary() << endl; rr_wfst.minimize(det_wfst); cout << " minimized " << rr_wfst.summary() << endl; } cout << "WFST: intersecting " << rulelist.length() << " rules" << endl; EST_Litem *p,*nnp; int i; for (i=0,p=rulelist.head(); p->next() != 0; p=nnp) { EST_WFST r_wfst,base_wfst,det_wfst; EST_WFST mmm; rulelist.append(r_wfst); EST_WFST &rr_wfst = rulelist.last(); // to avoid copying the filled one cout << "intersecting " << i << " and " << i+1 << " " << rulelist.length()-2 << " left" << endl; cout << " " << rulelist(p).summary() << " and " << endl; cout << " " << rulelist(p->next()).summary() << " becomes " << endl; mmm.intersection(rulelist(p),rulelist(p->next())); cout << " " << mmm.summary() << " minimizes to " << endl; rr_wfst.minimize(mmm); cout << " " << rr_wfst.summary() << endl; nnp=p->next()->next(); i+=2; rulelist.remove(p->next()); rulelist.remove(p); } all_wfst = rulelist.first(); } static LISP expand_sets(LISP sets,LISP fp) { // Expand sets into regexes that represent them. Single // char values are converted to disjunctions of feasible pairs // that have the same surface character LISP s,es=NIL,e,ne; for (s=sets; s != NIL; s=cdr(s)) { for (ne=NIL,e=cdr(car(s)); e != NIL; e=cdr(e)) { EST_String ss = get_c_string(car(e)); if (ss.contains("/")) ne = cons(car(e),ne); else ne = append(expand_fp(ss,fp),ne); } if (ne == NIL) { cerr << "WFST: kkcompile: set " << get_c_string(car(car(s))) << " has no feasible pairs" << endl; } else if (siod_llength(ne) == 1) es = cons(cons(car(car(s)),ne),es); else es = cons(cons(car(car(s)), cons(cons(rintern("or"),reverse(ne)), NIL)),es); } return reverse(es); } static LISP expand_fp(const EST_String p,LISP fp) { // Find all fp's that have this p as their surface char LISP m=NIL,f; EST_Regex rg(EST_String("^")+p+"/.*"); for (f=fp; f != NIL; f=cdr(f)) { EST_String ss = get_c_string(car(f)); if ((p == ss) || (ss.matches(rg))) m = cons(car(f),m); } return m; } static LISP find_feasible_pairs(LISP rules) { // Find the set of pairs that have rules associated with them // This effectively defines the transducer alphabet. LISP fp = NIL; LISP r; for (r=rules; r != NIL; r=cdr(r)) { if (siod_member_str(get_c_string(siod_nth(0,car(r))),fp) == NIL) fp = cons(siod_nth(0,car(r)),fp); } return fp; } static int surface_coercion(LISP rt) { return (streq("<=",get_c_string(rt))); } static int context_restriction(LISP rt) { return (streq("=>",get_c_string(rt))); } static int composite(LISP rt) { return (streq("<=>",get_c_string(rt))); } static LISP inline_sets(LISP l, LISP sets) { // Replace any set name with the regex equivalent LISP s; if (l == NIL) return NIL; else if (consp(l)) return cons(inline_sets(car(l),sets),inline_sets(cdr(l),sets)); else if ((s=siod_assoc_str(get_c_string(l),sets)) != NIL) return car(cdr(s)); else return l; } void EST_WFST::kkrule_compile(LISP inalpha, LISP outalpha, LISP fp, LISP rule,LISP sets) { // Build a WFST to transduce this particular rule // Accepts any other combination of feasible pairs too LISP leftcontext = inline_sets(siod_nth(2,rule),sets); LISP rulepair = siod_nth(0,rule); LISP ruletype = siod_nth(1,rule); LISP rightcontext = inline_sets(siod_nth(4,rule),sets); LISP p; int i; int end_LC,end_RP,end_NOTRP,end_RC,err_state; // Initialize alphabets init(inalpha,outalpha); // should be passed as discretes p_start_state = add_state(wfst_final); // empty WFST // Add transitions for all pairs except rulepair for (p=fp; p != NIL; p=cdr(p)) if ((!equal(rulepair,car(p))) || (surface_coercion(ruletype))) build_wfst(p_start_state,p_start_state,car(p)); // build for LC if (leftcontext) { end_LC = add_state(wfst_final); build_wfst(p_start_state,end_LC,leftcontext); // for all states in LC mark final & add epsilon to p_start_state for (i=end_LC; i < p_num_states; i++) { build_wfst(i,p_start_state,epsilon_label()); p_states[i]->set_type(wfst_final); } } else // no LC end_LC = p_start_state; // build for RP and RC from end_LC if (composite(ruletype) || context_restriction(ruletype)) { if (rightcontext) { end_RP = add_state(wfst_nonfinal); build_wfst(end_LC,end_RP,rulepair); // build for RC from end map to p_start_state build_wfst(end_RP,p_start_state,rightcontext); err_state = add_state(wfst_error); for (i=end_RP; i < err_state; i++) { // for everything other that the correct path go to err_state // without this explicit error state the epsilon to start // allows almost everything if (transition(i,get_c_string(epsilon_label())) != WFST_ERROR_STATE) break; // not a state require extra transitions for (p=fp; p != NIL; p=cdr(p)) if (transition(i,get_c_string(car(p))) == WFST_ERROR_STATE) build_wfst(i,err_state,car(p)); build_wfst(i,p_start_state,epsilon_label()); p_states[i]->set_type(wfst_licence); } } else // no RC, so end back at start build_wfst(end_LC,p_start_state,rulepair); } // Build for notRP and RC from end_LC if (composite(ruletype) || surface_coercion(ruletype)) { LISP abrp = all_but(rulepair,fp); if (abrp) { if (rightcontext) { end_RC = add_state(wfst_error); end_NOTRP = add_state(wfst_nonfinal); build_wfst(end_LC,end_NOTRP,abrp); // build for RC from end RP to error state build_wfst(end_NOTRP,end_RC,rightcontext); // for all states in RC except final one mark final & add // epsilon to p_start_state for (i=end_NOTRP; i < p_num_states; i++) { build_wfst(i,p_start_state,epsilon_label()); p_states[i]->set_type(wfst_final); } } else // no RC, { end_RC = add_state(wfst_error); build_wfst(end_LC,end_RC,abrp); } } } } static LISP all_but(LISP rulepair,LISP fp) { // Returns pairs that have the same surface symbol as rulepair // but different lexical symbol LISP r,notrp=NIL; EST_String s,l,p,sr,lr,rr; p = get_c_string(rulepair); if (p.contains("/")) { s = p.before("/"); l = p.after("/"); } else { s = p; l = p; } for (r=fp; r != NIL; r = cdr(r)) { rr = get_c_string(car(r)); if (rr.contains("/")) { sr = rr.before("/"); lr = rr.after("/"); } else { sr = rr; lr = rr; } if ((l != lr) && (s == sr)) notrp = cons(car(r),notrp); } if (siod_llength(notrp) > 1) notrp = cons(strintern("or"),notrp); return notrp; } void intersect(wfst_list &wl, EST_WFST &all) { // Intersect the wfst's in wl into all all.intersection(wl); } speech_tools/grammar/wfst/wfst_aux.cc0000644000076400007640000001272211465017155016452 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* internal classes, methods and function used in minimization and */ /* determinization of WFST. */ /* */ /*=======================================================================*/ #include #include "EST_WFST.h" #include "wfst_aux.h" wfst_marks::wfst_marks(int x) { // Set up mark table int i,j; // Triangular matrix p_x = x; p_mark_table = new char *[x]; for (i=0; i < x; i++) { p_mark_table[i] = new char[i+1]; for (j=0; j < i+1; j++) p_mark_table[i][j] = '?'; } } wfst_marks::~wfst_marks() { int i; for (i=0; i < p_x; i++) delete [] p_mark_table[i]; delete [] p_mark_table; p_mark_table = 0; } void wfst_marks::find_state_map(EST_IVector &state_map,int &num_new_states) { // Find the mapping from old state names to new int i,j,new_name; state_map.resize(p_x); for (i=0,new_name=0; i < p_x; i++) { state_map[i] = -1; for (j=0; j < i; j++) if (!distinguished(j,i)) { state_map[i] = state_map[j]; break; } if (state_map[i] == -1) state_map[i] = new_name++; } num_new_states = new_name; } void add_assumption(int y,int z,wfst_assumes &assumptions) { // Add a binding of y to z, and z to y to assumptions EST_Litem *p; int y_ok = FALSE; int z_ok = FALSE; for (p=assumptions.list.head(); p != 0; p=p->next()) { if (assumptions.list(p).k == y) { assumptions.list(p).v.append(z); y_ok = TRUE; } if (assumptions.list(p).k == z) { assumptions.list(p).v.append(y); z_ok = TRUE; } if (z_ok && y_ok) break; } if (!z_ok) { EST_IList b; b.append(y); assumptions.add_item(z,b); } if (!y_ok) { EST_IList b; b.append(z); assumptions.add_item(y,b); } } int equivalent_to(int y,int z,wfst_assumes &assumptions) { // true if y == z or z is assumed to be equivalent to y EST_Litem *p,*q; if (y==z) return TRUE; else { for (p=assumptions.list.head(); p != 0; p=p->next()) { if (assumptions.list(p).k == y) { EST_IList &b = assumptions.list(p).v; for (q=b.head(); q != 0; q=q->next()) if (z == b(q)) return TRUE; } if (assumptions.list(p).k == z) { EST_IList &b = assumptions.list(p).v; for (q=b.head(); q != 0; q=q->next()) if (y == b(q)) return TRUE; } } return FALSE; } } void mark_undistinguished(wfst_marks &marks,wfst_assumes &assumptions) { EST_Litem *p, *q; for (p=assumptions.list.head(); p != 0; p=p->next()) { int x = assumptions.list(p).k; EST_IList &b = assumptions.list(p).v; for (q=b.head(); q != 0; q=q->next()) marks.undistinguish(x,b(q)); } } VAL_REGISTER_CLASS(wfst,EST_WFST) speech_tools/grammar/wfst/ltscompile.cc0000644000076400007640000002610710127000720016747 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A LTS rule compiler, where rules are contextual rewrite rules. Rules */ /* are of the for LC [ x ] RC => y where LC and RC are regexs on the */ /* tape only and x and y are simple strings on symbols. That is the */ /* standard form of LTS rules used in Festival. */ /* */ /*=======================================================================*/ #include #include "EST_cutils.h" #include "EST_WFST.h" static LISP lts_find_feasible_pairs(LISP rules); static LISP make_fp(LISP in, LISP out); static LISP find_outs(LISP rule); static LISP find_ins(LISP rule); static LISP add_alpha(LISP n, LISP existing); static LISP lts_find_alphabets(LISP rules); static void ltsrule_compile(LISP inalpha, LISP outalpha, LISP fp, LISP sets, LISP rule, EST_WFST &a, EST_WFST ¬_a); static LISP analyse_rule(LISP rule); static LISP expand_sets(LISP l, LISP fp, LISP sets); static LISP expand_set(LISP p, LISP fp, LISP sets); static LISP find_notMAP(LISP MAP,LISP fp); void ltscompile(LISP lts_rules, EST_WFST &all_wfst) { // Build a transducer from given LTS rules. Because the interpretation // of these rules is normally ordered and the WFST is not, the // complement of each cumulative WFST must be generated before // adding the next rule LISP r; LISP fp; // feasible pairs, those pairs with rules (rather than IxO) LISP inalpha,outalpha,alphas; LISP sets=siod_nth(2,lts_rules); LISP rules=siod_nth(3,lts_rules); EST_WFST nots; alphas = lts_find_alphabets(lts_rules); inalpha = car(alphas); outalpha = cdr(alphas); fp = lts_find_feasible_pairs(rules); // set up an empty WFST, accepts nothing all_wfst.build_from_regex(inalpha,outalpha,NIL); // matches things not matched by rules, everything to begin with nots.build_from_regex(inalpha,outalpha, cons(rintern("*"), cons(cons(rintern("or"),fp),NIL))); nots.save("-"); for (r=rules; r != NIL; r=cdr(r)) { EST_WFST a, not_a,b,c,d; // all = all u (all' n r) ltsrule_compile(inalpha,outalpha,fp,sets,car(r),a,not_a); pprint(car(r)); a.save("-"); c.intersection(a,nots); c.save("-"); // Add for next rule b.uunion(nots,not_a); not_a.save("-"); b.save("-"); nots = b; d.uunion(all_wfst,c); all_wfst = d; all_wfst.save("-"); } } static LISP lts_find_alphabets(LISP rules) { // Find the alphabets used in the rules LISP r; LISP in=NIL, out=NIL; for (r=siod_nth(3,rules); r != NIL; r=cdr(r)) { in = add_alpha(find_ins(car(r)),in); out = add_alpha(find_outs(car(r)),out); } return cons(in,out); } static LISP add_alpha(LISP n, LISP existing) { // Add values in n if not already in existing LISP t; LISP e=existing; for (t=n; t != NIL; t=cdr(t)) if (!siod_member_str(get_c_string(car(t)),e)) e = cons(car(t),e); return e; } static LISP find_ins(LISP rule) { // find all symbols in [] in rule LISP c; int state=FALSE; LISP ins = NIL; for (c=rule; c != NIL; c=cdr(c)) { if (streq("[",get_c_string(car(c)))) state=TRUE; else if (streq("]",get_c_string(car(c)))) break; else if (state) ins = cons(car(c),ins); } return reverse(ins); } static LISP find_outs(LISP rule) { // find all symbols after = rule LISP c; int state=FALSE; LISP outs = NIL; for (c=rule; c != NIL; c=cdr(c)) { if (streq("=",get_c_string(car(c)))) state=TRUE; else if (state) outs = cons(car(c),outs); } return reverse(outs); } static LISP lts_find_feasible_pairs(LISP rules) { // Find the set of pairs that have rules associated with them // This effectively defines the transducer alphabet. // We take the surface part in [] and the part after the = and // linearly match them to form a set of pairs, padded with epsilon // if necessary. LISP fp = NIL; LISP r; for (r=rules; r != NIL; r=cdr(r)) { LISP in = find_ins(car(r)); LISP out = find_outs(car(r)); LISP pairs = make_fp(in,out); for (LISP p=pairs; p != NIL; p=cdr(p)) { if (!siod_member_str(get_c_string(car(p)),fp)) fp = cons(car(p),fp); } } return fp; } static LISP make_fp(LISP in, LISP out) { // Returns a list of pairs by matching each member of in to out // padding the shorted one with _epsilon_ if necessary LISP i,o; LISP fp=NIL; EST_String is,os; int m; if (siod_llength(in) > siod_llength(out)) m = siod_llength(in); else m = siod_llength(out); for (i=in,o=out ; m > 0; --m,i=cdr(i),o=cdr(o)) { if (i == NIL) is = "__epsilon__"; else is = get_c_string(car(i)); if (o == NIL) os = "__epsilon__"; else os = get_c_string(car(o)); fp = cons(strintern(is+"/"+os),fp); } return reverse(fp); } static void ltsrule_compile(LISP inalpha, LISP outalpha, LISP fp, LISP sets, LISP rule, EST_WFST &a, EST_WFST ¬_a) { // Return two regexs, one matching with rewrites and another // that matches things this rule doesn't match. LISP LC,MAP,RC,notMAP,r; r = analyse_rule(rule); LC = siod_nth(0,r); MAP = siod_nth(1,r); RC = siod_nth(2,r); LC = expand_sets(LC,fp,sets); RC = expand_sets(RC,fp,sets); notMAP = find_notMAP(MAP,fp); LISP kk = cons(LC,cons(MAP,cons(RC,NIL))); cout << "kk rule" << endl; pprint(kk); a.kkrule_compile(inalpha,outalpha,fp,kk,NIL); // (or (* ) (not )) ;; everything except the rule LISP regex_r = cons(rintern("and"),append(LC,append(MAP,RC))); // LISP nn = cons(rintern("or"), // cons(cons(rintern("*"),cons(cons(rintern("or"),fp),NIL)), // cons(cons(rintern("not"),cons(regex_r,NIL)), // NIL))); LISP nn = cons(rintern("not"),cons(regex_r,NIL)); not_a.build_from_regex(inalpha,outalpha,nn); } static LISP analyse_rule(LISP rule) { // return the left context, map and right context; LISP LC=NIL, RC=NIL, in=NIL, out=NIL; LISP l; int state=0; for (l=rule; l != NIL; l=cdr(l)) { if ((state==0) && (!streq("[",get_c_string(car(l))))) LC = cons(car(l),LC); else if ((state==0) && (streq("[",get_c_string(car(l))))) state = 1; else if ((state==1) && (!streq("]",get_c_string(car(l))))) in = cons(car(l),in); else if ((state==1) && (streq("]",get_c_string(car(l))))) state = 2; else if ((state==2) && (!streq("=",get_c_string(car(l))))) RC = cons(car(l),RC); else if ((state==2) && (streq("=",get_c_string(car(l))))) state = 3; else if (state == 3) { out = l; break; } } return cons(reverse(LC), cons(make_fp(reverse(in),out), cons(reverse(RC),NIL))); } static LISP expand_sets(LISP l, LISP fp, LISP sets) { // Expand sets in l and fix regex characters LISP r,es=NIL; for (r=l; r != NIL; r=cdr(r)) { LISP s = expand_set(car(r),fp,sets); if (cdr(r) && (streq("*",get_c_string(car(cdr(r)))))) { es = cons(cons(rintern("*"),s),es); r=cdr(r); } else if (cdr(r) && (streq("+",get_c_string(car(cdr(r)))))) { es = cons(cons(rintern("+"),s),es); r=cdr(r); } else es = cons(cons(rintern("and"),s),es); } return reverse(es); } static LISP expand_set(LISP p, LISP fp, LISP sets) { // expand p with respect to sets and feasible pairs LISP set = siod_assoc_str(get_c_string(p),sets); LISP s,f; LISP r=NIL; if (set == NIL) set = cons(p,NIL); for (s=set; s != NIL; s=cdr(s)) { for (f=fp; f != NIL; f=cdr(f)) { EST_String ss = get_c_string(car(s)); EST_String sf = get_c_string(car(f)); if (sf.contains(ss+"/")) r = cons(car(f),r); } } return reverse(r); } static LISP find_notMAP(LISP MAP,LISP fp) { // Returns REGEX that matches everything except MAP, this doesn't // try all possible epsilons though LISP r,notrp=NIL,m,np; EST_String s,l,p,sr,lr,rr; for (m=MAP; m != NIL; m=cdr(m)) { p = get_c_string(car(m)); if (p.contains("/")) { s = p.before("/"); l = p.after("/"); } else { s = p; l = p; } for (np=NIL,r=fp; r != NIL; r = cdr(r)) { rr = get_c_string(car(r)); if (rr.contains("/")) { sr = rr.before("/"); lr = rr.after("/"); } else { sr = rr; lr = rr; } if ((s == sr) && (l != lr)) np = cons(car(r),np); } notrp = cons(cons(rintern("or"),np),notrp); } return reverse(notrp); } speech_tools/grammar/wfst/rgcompile.cc0000644000076400007640000002215710127000720016556 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* A Regular grammar compiler, its pretty free about the grammar */ /* Actually it will take full context free grammars and convert them */ /* up to a specified rewrite depth */ /* */ /* Based loosely on "Finite State Machines from Features Grammars" by */ /* Black, International Workshop of Parsing Technologies, CMU 89 */ /* */ /*=======================================================================*/ #include #include "EST_cutils.h" #include "EST_WFST.h" static LISP find_rewrites(LISP rules, LISP terms, LISP nonterms); static LISP rg_find_nt_ts(LISP rules,LISP sets); static LISP prod_join(LISP n, LISP p); static int production_index(LISP state, EST_WFST_MultiStateIndex &index, int proposed); void rgcompile(LISP rg, EST_WFST &all_wfst) { // Build a transducer from given regular grammar. LISP nt_ts,nonterms,terms,rewrites; LISP sets=siod_nth(2,rg); LISP rules=siod_nth(3,rg); nt_ts = rg_find_nt_ts(rules,sets); nonterms = car(nt_ts); terms = cdr(nt_ts); rewrites = find_rewrites(rules,terms,nonterms); if (rewrites == NIL) return; // left recursive or no rules all_wfst.build_from_rg(terms,terms, car(car(rules)), // distinguished symbol rewrites, sets,terms,25); } static LISP find_rewrites(LISP rules, LISP terms, LISP nonterms) { // Find the full rewrites of each nonterminal until a terminal // appears as the first item LISP nt,r; LISP rewrites = NIL; (void)terms; // got lazy and haven't done this recursively yet ... for (nt=nonterms; nt != NIL; nt=cdr(nt)) { LISP nn = NIL; for (r=rules; r != NIL; r=cdr(r)) if (car(car(r)) == car(nt)) // depend on symbols being eq nn = cons(cdr(cdr(car(r))),nn); rewrites = cons(cons(car(nt),nn),rewrites); } return rewrites; } static LISP rg_find_nt_ts(LISP rules,LISP sets) { // Find the alphabets used in the rules LISP terms=NIL,nonterms=NIL,r,s,set,t; for (r=rules; r != NIL; r=cdr(r)) if (!siod_member_str(get_c_string(car(car(r))),nonterms)) nonterms = cons(car(car(r)),nonterms); for (r=rules; r != NIL; r=cdr(r)) for (s=cdr(cdr(car(r))); s != NIL; s=cdr(s)) if ((!siod_member_str(get_c_string(car(s)),terms)) && (!siod_member_str(get_c_string(car(s)),nonterms)) && (!siod_assoc_str(get_c_string(car(s)),sets))) terms = cons(car(s),terms); else if ((set=siod_assoc_str(get_c_string(car(s)),sets))) { for (t=cdr(set); t != 0; t=cdr(t)) if (!siod_member_str(get_c_string(car(t)),terms)) terms = cons(car(t),terms); } return cons(nonterms,terms); } void EST_WFST::build_from_rg(LISP inalpha, LISP outalpha, LISP distinguished, LISP rewrites, LISP sets, LISP terms, int max_depth) { // This is sort of similar to determinising in that the "state" // is represented by a list of numbers, i.e. the remainder of // of production LISP current, start_state, remainder, set, new_prod; int ns, current_state; const char *current_sym; LISP agenda = NIL; EST_WFST_MultiStateIndex index(100); (void)max_depth; int c=0; clear(); init(inalpha,outalpha); int i_epsilon = in_epsilon(); int o_epsilon = out_epsilon(); // Create a starting state and add it to this WFST p_start_state = add_state(wfst_nonfinal); start_state = cons(flocons((double)p_start_state), cons(distinguished,NIL)); production_index(start_state,index,p_start_state); agenda = cons(start_state,agenda); // initialize agenda while (agenda != NIL) { current = car(agenda); agenda = cdr(agenda); current_state = get_c_int(car(current)); current_sym = get_c_string(car(cdr(current))); remainder = cdr(cdr(current)); if ((c % 1000)== 0) cout << summary() << " Agenda " << siod_llength(agenda) << endl; c++; if ((set=siod_assoc_str(current_sym,sets))) { ns = production_index(remainder,index,p_num_states); // add transitions for each member of set for (LISP s=cdr(set); s != NIL; s=cdr(s)) p_states[current_state] ->add_transition(0.0, // no weights ns, p_in_symbols.name(get_c_string(car(s))), p_out_symbols.name(get_c_string(car(s)))); if (remainder == NIL) add_state(wfst_final); else if (ns == p_num_states) // its a new remainder { add_state(wfst_nonfinal); agenda = cons(cons(flocons(ns),remainder),agenda); } } else if (siod_member_str(current_sym,terms)) { ns = production_index(remainder,index,p_num_states); // Add transition for this terminal symbol p_states[current_state] ->add_transition(0.0, // no weights ns, p_in_symbols.name(current_sym), p_out_symbols.name(current_sym)); if (remainder == NIL) add_state(wfst_final); else if (ns == p_num_states) // its a new remainder { add_state(wfst_nonfinal); agenda = cons(cons(flocons(ns),remainder),agenda); } } else // its a non-terminal so simply rewrite { for (LISP p=cdr(siod_assoc_str(current_sym,rewrites)); p != NIL; p=cdr(p)) { new_prod = prod_join(car(p),remainder); ns = production_index(new_prod,index,p_num_states); p_states[current_state] ->add_transition(0.0, // no weights ns,i_epsilon,o_epsilon); if (ns == p_num_states) // its a new remainder { if (new_prod == NIL) add_state(wfst_final); else { add_state(wfst_nonfinal); agenda = cons(cons(flocons(ns),new_prod),agenda); } } } } } } static int production_index(LISP state, EST_WFST_MultiStateIndex &index, int proposed) { // Returns proposed if ms is not already in index, otherwise // returns the value that was proposed when it was first new. // I'll have to make this more efficient in future. EST_String istring(""); LISP p; for (p=state; p != NIL; p = cdr(p)) istring += EST_String(get_c_string(car(p))) + " "; int ns,found; for (p=state; p != NIL; p = cdr(p)) istring += EST_String(get_c_string(car(p))) + " "; ns = index.val(istring,found); if (found) return ns; else { index.add_item(istring,proposed); return proposed; } } static LISP prod_join(LISP n, LISP p) { if (n == NIL) return p; else return cons(car(n),prod_join(cdr(n),p)); } speech_tools/grammar/wfst/tlcompile.cc0000644000076400007640000001541210127000720016561 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : September 1999 */ /*-----------------------------------------------------------------------*/ /* */ /* Building tree lexicons from rules. This could almost be done by the */ /* regular grammar compiler but for efficiently reasons we have a */ /* specific compiler. As the ends of the trees are never minimized */ /* Actually it will take full context free grammars and convert them */ /* up to a specified rewrite depth */ /* */ /* Based loosely on "Finite State Machines from Features Grammars" by */ /* Black, International Workshop of Parsing Technologies, CMU 89 */ /* */ /*=======================================================================*/ #include #include "EST_cutils.h" #include "EST_THash.h" #include "EST_WFST.h" static LISP tl_find_l_w(LISP rules); static int production_index(LISP state, EST_TStringHash &index, int proposed); void tlcompile(LISP tl, EST_WFST &all_wfst) { // Build a transducer from given tree-lexicon. LISP l_w,letters,words; // LISP sets=siod_nth(2,tl); LISP rules=siod_nth(3,tl); l_w = tl_find_l_w(rules); letters = car(l_w); // or phones or "bits" or whatever words = cdr(l_w); // the things you are indexing all_wfst.build_tree_lex(letters,words,rules); } static LISP tl_find_l_w(LISP rules) { // Find the alphabets used in the rules LISP letters=NIL,words=NIL,r,s; for (r=rules; r != NIL; r=cdr(r)) { for (s = car(r); s != NIL; s=cdr(s)) { if (streq("->",get_c_string(car(s)))) { if (!siod_member_str(get_c_string(car(cdr(s))),words)) words = cons(car(cdr(s)),words); break; } else if (!siod_member_str(get_c_string(car(s)),letters)) { letters = cons(car(s),letters); } } } return cons(letters,words); } void EST_WFST::build_tree_lex(LISP inalpha, LISP outalpha, LISP wlist) { // Build a determinized tree lexicon for given list LISP w,l; int cs,ns; EST_WFST_Transition *trans; EST_TStringHash index(100); int fff; clear(); init(inalpha,outalpha); int i_epsilon = in_epsilon(); int o_epsilon = out_epsilon(); float weight; // Create a starting state and add it to this WFST p_start_state = add_state(wfst_nonfinal); fff = add_state(wfst_final); for (w=wlist; w; w=cdr(w)) { // lprint(car(w)); weight = get_c_float(car(siod_last(car(w)))); for (cs=p_start_state,l=car(w); l; l=cdr(l)) { if (streq("->",get_c_string(car(l)))) { // reached word trans = find_transition(cs,i_epsilon, p_out_symbols.name(get_c_string(car(cdr(l))))); if (trans == 0) { p_states[cs] ->add_transition(weight, fff,i_epsilon, p_out_symbols.name(get_c_string(car(cdr(l))))); } // else // duplicate word // { // cerr << "WFST: tlcompile, duplicate word ignored\n"; // } break; } else { trans = find_transition(cs, p_in_symbols.name(get_c_string(car(l))), o_epsilon); if (trans == 0) { ns = production_index(cdr(l),index,p_num_states); if (ns == p_num_states) ns = add_state(wfst_nonfinal); p_states[cs] ->add_transition(weight, ns, p_in_symbols.name(get_c_string(car(l))), o_epsilon); } else // increment count { ns = trans->state(); trans->set_weight(trans->weight()+weight); } } cs = ns; } } // normalized transition weights into probabilities stop_cumulate(); } static int production_index(LISP state, EST_TStringHash &index, int proposed) { // Returns proposed if ms is not already in index, otherwise // returns the value that was proposed when it was first new. // I'll have to make this more efficient in future. EST_String istring(""); LISP p; int ns,found; for (p=state; p != NIL; p = cdr(p)) istring += EST_String(get_c_string(car(p))) + " "; ns = index.val(istring,found); if (found) return ns; else { index.add_item(istring,proposed); return proposed; } } speech_tools/grammar/wfst/wfst_train.cc0000644000076400007640000004536511465017155017003 0ustar awbawb/*************************************************************************/ /* */ /* Language Technologies Institute */ /* Carnegie Mellon University */ /* Copyright (c) 1999-2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1999 */ /*-----------------------------------------------------------------------*/ /* */ /* Training method to split states of existing WFST based on data to */ /* optimize entropy */ /* */ /* Confusing as this has nothing to do with the modelling */ /* technique known as "maximum entropy" */ /* */ /*=======================================================================*/ #include #include #include "EST_WFST.h" #include "wfst_aux.h" #include "EST_Token.h" #include "EST_simplestats.h" VAL_REGISTER_TYPE_NODEL(trans,EST_WFST_Transition) SIOD_REGISTER_CLASS(trans,EST_WFST_Transition) VAL_REGISTER_CLASS(pdf,EST_DiscreteProbDistribution) SIOD_REGISTER_CLASS(pdf,EST_DiscreteProbDistribution) static LISP *find_state_usage(EST_WFST &wfst, LISP data); static double entropy(const EST_WFST_State *s); static LISP *find_state_entropies(const EST_WFST &wfst, LISP *data); EST_WFST_Transition *find_best_trans_split(EST_WFST &wfst, int split_state, LISP *data); static LISP find_best_split(EST_WFST &wfst, int split_state_name, LISP *data); static double find_score_if_split(EST_WFST &wfst, int fromstate, EST_WFST_Transition *trans, LISP *data); static LISP find_split_pdfs(EST_WFST &wfst, int split_state_name, LISP *data, EST_DiscreteProbDistribution &pdf_all); static double score_pdf_combine(EST_DiscreteProbDistribution &a, EST_DiscreteProbDistribution &b, EST_DiscreteProbDistribution &all); #if 0 static void split_state(EST_WFST &wfst, EST_WFST_Transition *trans); #endif static void split_state(EST_WFST &wfst, LISP trans_list, int ostate); LISP load_string_data(EST_WFST &wfst,EST_String &filename) { // Load in sentences into data table, assume sentence per line EST_TokenStream ts; LISP ss = NIL; EST_String t; int id; int i,j; if (ts.open(filename) == -1) EST_error("wfst_train: failed to read data from \"%s\"", (const char *)filename); i = 0; j = 0; while (!ts.eof()) { LISP s = NIL; do { t = (EST_String)ts.get(); id = wfst.in_symbol(t); if (id == -1) { cerr << "wfst_train: data contains unknown symbol \"" << t << "\"" << endl; } s = cons(flocons(id),s); j++; } while (!ts.eoln() && !ts.eof()); i++; ss = cons(reverse(s),ss); } printf("wfst_train: loaded %d lines of %d tokens\n", i,j); return reverse(ss); } static LISP *find_state_usage(EST_WFST &wfst, LISP data) { // Builds list of states, and which data points the represent LISP *state_data = new LISP[wfst.num_states()]; static LISP ddd = NIL; int s,i,id; LISP d,w; EST_WFST_Transition *trans; // EST_Litem *tp; if (ddd == NIL) gc_protect(&ddd); ddd = NIL; wfst.start_cumulate(); // zero existing weights for (i=0; i < wfst.num_states(); i++) { state_data[i] = NIL; ddd = cons(state_data[i],ddd); // // smoothing // for (tp=wfst.state(i)->transitions.head(); tp != 0; tp = tp->next()) // wfst.state(i)->transitions(tp)->set_weight(1); } for (i=0,d=data; d; d=cdr(d),i++) { s = wfst.start_state(); for (w=car(d); w; w=cdr(w)) { state_data[s] = cons(w,state_data[s]); id = get_c_int(car(w)); trans = wfst.find_transition(s,id,id); if (!trans) { printf("sentence %d not in language, skipping\n",i); continue; } else { trans->set_weight(trans->weight()+1); s = trans->state(); } } } wfst.stop_cumulate(); return state_data; } static double entropy(const EST_WFST_State *s) { double sentropy,w; EST_Litem *tp; for (sentropy=0,tp=s->transitions.head(); tp != 0; tp = tp->next()) { w = s->transitions(tp)->weight(); /* the probability */ if (w > 0) sentropy += w * log(w); } return -1 * sentropy; } void wfst_train(EST_WFST &wfst, LISP data) { LISP *state_data; LISP *state_entropies; LISP best_trans_list = NIL; int c=0,i, max_entropy_state; gc_protect(&data); while (1) { // Build table of state to points in data, and cumulate transitions state_data = find_state_usage(wfst,data); /* find entropy for each state (sorted) */ state_entropies = find_state_entropies(wfst,state_data); max_entropy_state = -1; for (i=0; i < wfst.num_states(); i++) { // double me = (double)get_c_float(car(state_entropies[i])); max_entropy_state = get_c_int(cdr(state_entropies[i])); // printf("trying %d %g\n",max_entropy_state,me); // best_trans = find_best_trans_split(wfst,max_entropy_state, // state_data); best_trans_list = find_best_split(wfst,max_entropy_state, state_data); if (best_trans_list != NIL) break; // else // printf("No best trans\n"); } delete [] state_entropies; if (max_entropy_state == -1) { printf("No new max_entropy state\n"); break; } if (best_trans_list == NIL) { printf("No best_trans in max_entropy state\n"); break; } /* for each transition *entering* max_entropy_state */ /* find entropy if it were split */ /* find best split */ /* print stats */ /* some sort of stop check */ c++; printf("c is %d\n",c); if (c > 5000) { printf("reached cycle end %d\n",c); break; } /* split on best split */ split_state(wfst, best_trans_list, max_entropy_state); if ((c % 100) == 0) { EST_String chkpntname = "chkpnt"; char bbb[7]; sprintf(bbb,"%03d",c); wfst.save(chkpntname+bbb+".wfst"); } delete [] state_data; user_gc(NIL); } } static int me_compare_function(const void *a, const void *b) { LISP la; LISP lb; la = *(LISP *)a; lb = *(LISP *)b; float fa = get_c_float(car(la)); float fb = get_c_float(car(lb)); if (fa < fb) return 1; else if (fa == fb) return 0; else return -1; } static LISP *find_state_entropies(const EST_WFST &wfst, LISP *data) { double all_entropy = 0; int i; double sentropy; LISP *slist = new LISP[wfst.num_states()]; static LISP ddd = NIL; if (ddd == NIL) gc_protect(&ddd); ddd = NIL; for (i=0; i < wfst.num_states(); i++) { const EST_WFST_State *s = wfst.state(i); sentropy = entropy(s); // printf("dlength is %d %d\n",i,siod_llength(data[i])); all_entropy += sentropy * siod_llength(data[i]); slist[i] = cons(flocons(sentropy),flocons(i)); ddd = cons(slist[i],ddd); } printf("average entropy is %g\n",all_entropy/i); qsort(slist,wfst.num_states(),sizeof(LISP),me_compare_function); return slist; } static LISP find_best_split(EST_WFST &wfst, int split_state_name, LISP *data) { // Find the best partition of incoming translations that // minimises entropy EST_DiscreteProbDistribution pdf_all(&wfst.in_symbols()); EST_DiscreteProbDistribution *a_pdf, *b_pdf; LISP splits,s,dd,r; LISP *ssplits; gc_protect(&splits); EST_String sname; int b,best_b; EST_Litem *i; int num_pdfs; double best_score, score, sfreq; for (dd = data[split_state_name]; dd; dd = cdr(dd)) pdf_all.cumulate(get_c_int(car(car(dd)))); splits = find_split_pdfs(wfst,split_state_name,data,pdf_all); if (siod_llength(splits) < 2) return NIL; ssplits = new LISP[siod_llength(splits)]; for (num_pdfs=0,s=splits; s != NIL; s=cdr(s),num_pdfs++) ssplits[num_pdfs] = car(s); qsort(ssplits,num_pdfs,sizeof(LISP),me_compare_function); // Combine trans pdfs in pdfs until more combination doesn't improve while (1) { best_score = get_c_float(car(ssplits[0])); best_b = -1; a_pdf = pdf(car(cdr(cdr(ssplits[0])))); for (b=1; b < num_pdfs; b++) { if (ssplits[b] == NIL) continue; score = score_pdf_combine(*a_pdf,*pdf(car(cdr(cdr(ssplits[b])))), pdf_all); if (score < best_score) { best_score = score; best_b = b; } } // combine a and b if (best_b == -1) break; else { // combine a and b // Add trans to 0 setcar(cdr(ssplits[0]), append(car(cdr(ssplits[0])), car(cdr(ssplits[best_b])))); setcar(ssplits[0], flocons(best_score)); // Update 0's pdf with values from best_b's b_pdf = pdf(car(cdr(cdr(ssplits[best_b])))); for (i=b_pdf->item_start(); !b_pdf->item_end(i); i = b_pdf->item_next(i)) { b_pdf->item_freq(i,sname,sfreq); a_pdf->cumulate(i,sfreq); } ssplits[best_b] = NIL; } } printf("score %g ",(double)get_c_float(car(ssplits[0]))); for (dd=car(cdr(ssplits[0])); dd; dd=cdr(dd)) printf("%s ",(const char *)wfst.in_symbol(trans(car(dd))->in_symbol())); printf("\n"); gc_unprotect(&splits); r = car(cdr(ssplits[0])); delete [] ssplits; return r; } static double score_pdf_combine(EST_DiscreteProbDistribution &a, EST_DiscreteProbDistribution &b, EST_DiscreteProbDistribution &all) { // Find score of (a+b) vs (all-(a+b)) EST_DiscreteProbDistribution ab(a); EST_DiscreteProbDistribution all_but_ab(all); EST_Litem *i; EST_String sname; double sfreq, score; for (i=b.item_start(); !b.item_end(i); i = b.item_next(i)) { b.item_freq(i,sname,sfreq); ab.cumulate(i,sfreq); } for (i=ab.item_start(); !ab.item_end(i); i = ab.item_next(i)) { ab.item_freq(i,sname,sfreq); all_but_ab.cumulate(i,-1*sfreq); } score = (ab.entropy() * ab.samples()) + (all_but_ab.entropy() * all_but_ab.samples()); return score; } static LISP find_split_pdfs(EST_WFST &wfst, int split_state_name, LISP *data, EST_DiscreteProbDistribution &pdf_all) { // Find following pdfs for each incoming transition as if they where // split to a new state int i,id, in; EST_Litem *tp; LISP pdfs = NIL,dd,ttt,p,t; EST_DiscreteProbDistribution empty; double value; for (i=0; i < wfst.num_states(); i++) { const EST_WFST_State *s = wfst.state(i); for (tp=s->transitions.head(); tp != 0; tp = tp->next()) { if ((s->transitions(tp)->state() == split_state_name) && (s->transitions(tp)->weight() > 0)) { in = s->transitions(tp)->in_symbol(); EST_DiscreteProbDistribution *pdf = new EST_DiscreteProbDistribution(&wfst.in_symbols()); for (dd = data[i]; dd; dd = cdr(dd)) { id = get_c_int(car(car(dd))); if (id == in) { // This one would go to the new state so we count it if (cdr(car(dd))) // not end of data string pdf->cumulate(get_c_int(car(cdr(car(dd))))); } } // value, list of trans, pdf value = score_pdf_combine(*pdf,empty,pdf_all); if ((value > 0) && // ignore transitions with no data (pdf->samples() > 10))// and those with only a few data pnts { t = siod(s->transitions(tp)); p = siod(pdf); ttt = cons(flocons(value), cons(cons(t,NIL), cons(p,NIL))); pdfs = cons(ttt,pdfs); } else delete pdf; } } } return pdfs; } EST_WFST_Transition *find_best_trans_split(EST_WFST &wfst, int split_state_name, LISP *data) { EST_Litem *tp; EST_WFST_Transition *best_trans = 0; const EST_WFST_State *split_state = wfst.state(split_state_name); double best_score,bb; int i; best_score = entropy(split_state)*siod_llength(data[split_state_name]); // printf("unsplit score %g\n",best_score); /* For each transition going to split_state */ for (i=1; i < wfst.num_states(); i++) { const EST_WFST_State *s = wfst.state(i); for (tp=s->transitions.head(); tp != 0; tp = tp->next()) { if ((wfst.state(s->transitions(tp)->state()) == split_state) && (s->transitions(tp)->weight() > 0)) { bb = find_score_if_split(wfst,i,s->transitions(tp),data); // cout << i << " " // << wfst.in_symbol(s->transitions(tp)->in_symbol()) << " " // << s->transitions(tp)->state() << " " << bb << endl; if (bb == -1) /* didn't find a split */ continue; if (bb < best_score) { best_score = bb; best_trans = s->transitions(tp); } } } } if (best_trans) cout << "best " << wfst.in_symbol(best_trans->in_symbol()) << " " << best_trans->weight() << " " << best_trans->state() << " " << best_score << endl; return best_trans; } static double find_score_if_split(EST_WFST &wfst, int fromstate, EST_WFST_Transition *trans, LISP *data) { double ent_split; double ent_remain; double score; EST_DiscreteProbDistribution pdf_split(&wfst.in_symbols()); EST_DiscreteProbDistribution pdf_remain(&wfst.in_symbols()); int in, tostate, id; EST_Litem *i; double sfreq; EST_String sname; ent_split = ent_remain = 32*32*32*32; LISP dd; // printf("considering %d %s %g %d\n", // fromstate, // (const char *)wfst.in_symbol(trans->in_symbol()), // trans->weight(), // trans->state()); /* find entropy of possible new state */ /* for each data point through fromstate */ in = trans->in_symbol(); for (dd = data[fromstate]; dd; dd = cdr(dd)) { id = get_c_int(car(car(dd))); if (id == in) { // This one would go to the new state so we count it if (cdr(car(dd))) // not end of data string pdf_split.cumulate(get_c_int(car(cdr(car(dd))))); } } if (pdf_split.samples() > 0) ent_split = pdf_split.entropy(); /* find entropy of old state minus trans into it */ tostate = trans->state(); // Actually only need to do this once per state for (dd = data[tostate]; dd; dd = cdr(dd)) pdf_remain.cumulate(get_c_int(car(car(dd)))); // Subtract the bit thats split for (i=pdf_split.item_start(); !pdf_split.item_end(i); i = pdf_split.item_next(i)) { pdf_split.item_freq(i,sname,sfreq); pdf_remain.cumulate(i,-1*sfreq); } if (pdf_remain.samples() > 0) ent_remain = pdf_remain.entropy(); if ((pdf_remain.samples() == 0) || (pdf_split.samples() == 0)) return -1; score = (ent_remain * pdf_remain.samples()) + (ent_split * pdf_split.samples()); // printf("tostate %d remain %g %d split %g %d score %g\n", // tostate, ent_remain, (int)pdf_remain.samples(), // ent_split, (int)pdf_split.samples(), score); return score; } #if 0 static void split_state(EST_WFST &wfst, EST_WFST_Transition *trans) { /* Split off a new state for given trans. Add transitions */ /* to this new state for all transitions in (old) state trans */ /* goes to */ EST_Litem *tp; int nstate = wfst.add_state(wfst_final); int ostate = trans->state(); // printf("state %d entropy %g\n",ostate,entropy(wfst.state(ostate))); /* must be done before adding the new transitions to nstate */ trans->set_state(nstate); for (tp=wfst.state(ostate)->transitions.head(); tp != 0; tp = tp->next()) { wfst.state_non_const(nstate)-> add_transition(0.0, /* weight will be filled in later*/ wfst.state(ostate)->transitions(tp)->state(), wfst.state(ostate)->transitions(tp)->in_symbol(), wfst.state(ostate)->transitions(tp)->out_symbol()); } // printf(" nstate %d entropy %g\n",nstate,entropy(wfst.state(nstate))); // printf(" ostate %d entropy %g\n",ostate,entropy(wfst.state(ostate))); } #endif static void split_state(EST_WFST &wfst, LISP trans_list, int ostate) { /* Split off a new state for given trans. Add transitions */ /* to this new state for all transitions in (old) state trans */ /* goes to */ EST_Litem *tp; int nstate = wfst.add_state(wfst_final); LISP t; /* must be done before adding the new transitions to nstate */ for (t=trans_list; t; t=cdr(t)) trans(car(t))->set_state(nstate); for (tp=wfst.state(ostate)->transitions.head(); tp != 0; tp = tp->next()) { wfst.state_non_const(nstate)-> add_transition(0.0, /* weight will be filled in later*/ wfst.state(ostate)->transitions(tp)->state(), wfst.state(ostate)->transitions(tp)->in_symbol(), wfst.state(ostate)->transitions(tp)->out_symbol()); } } speech_tools/grammar/wfst/wfst_aux.h0000644000076400007640000000764410044502523016311 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* */ /* Some internal classes for Weighted Finite State Transducers */ /* */ /*=======================================================================*/ #ifndef __WFST_AUX_H__ #define __WFST_AUX_H__ // Used in minimization class wfst_marks { private: int p_x; char **p_mark_table; // triangular matrix char val(int p,int q) { if (p < q) return p_mark_table[q][p]; else return p_mark_table[p][q]; } void set_val(int p,int q,char e) { if (p < q) p_mark_table[q][p] = e; else p_mark_table[p][q] = e; } public: wfst_marks(int x); ~wfst_marks(); int distinguished(int p, int q) { return val(p,q) == 'd'; } int undistinguished(int p, int q) { return val(p,q) == 'u'; } void distinguish(int p, int q) { set_val(p,q,'d'); } void undistinguish(int p, int q) { set_val(p,q,'u'); } void find_state_map(EST_IVector &state_map,int &num_new_states); }; typedef EST_TKVL wfst_assumes; void mark_undistinguished(wfst_marks &marks,wfst_assumes &assumptions); int equivalent_to(int y,int z,wfst_assumes &assumptions); void add_assumption(int y,int z,wfst_assumes &assumptions); #endif speech_tools/grammar/wfst/Makefile0000644000076400007640000000564307354134361015750 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for weighted finite state transducer classes # #=========================================================================# TOP=../.. DIRNAME=grammar/wfst H = wfst_aux.h CSRCS = TSRCS = EST_WFST.cc wfst_regex.cc wfst_ops.cc wfst_transduce.cc kkcompile.cc CPPSRCS = $(TSRCS) wfst_aux.cc ltscompile.cc rgcompile.cc tlcompile.cc \ wfst_train.cc SRCS = $(CPPSRCS) $(CSRCS) OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) FILES = $(SRCS) $(H) Makefile wfst.mak ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/grammar/wfst/wfst.mak0000644000076400007640000000701607515024365015762 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Definitions for including WFST system. ## ## ## ########################################################################### INCLUDE_WFST=1 MOD_DESC_WFST=Weighted finite state transducers # add sub directory to grammar directory ifeq ($(DIRNAME),grammar) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) wfst endif # add extra programs to main ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) \ wfst_build_main.cc wfst_run_main.cc wfst_train_main.cc endif # check scheme is available. ifndef INCLUDE_SIOD .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include SIOD to use wfst" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/intonation/Makefile0000644000076400007640000000543507262605664015527 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for intonation # # # #=========================================================================# TOP=.. DIRNAME=intonation LIB_BUILD_DIRS = tilt BUILD_DIRS = $(LIB_BUILD_DIRS) ALL_DIRS = $(BUILD_DIRS) FILES = Makefile ALL = $(BUILD_DIRS) include $(TOP)/config/common_make_rules speech_tools/intonation/tilt/tilt_analysis.cc0000644000076400007640000006545011465017155020224 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : March 1998 */ /*-----------------------------------------------------------------------*/ /* Tilt Analysis */ /* */ /*=======================================================================*/ #include #include "EST_math.h" #include "EST_tilt.h" #include "tilt.h" #include "EST_Track.h" #include "EST_track_aux.h" #include "EST_Features.h" #include "EST_error.h" static int match_rf_point(EST_Track &fz, int b_start, int b_stop, int e_start, int e_stop, int &mi, int &mj); static void make_int_item(EST_Item &e, const EST_String name, float end, float start_pos, float start_f0, float peak_pos, float peak_f0); //void rfc_segment_features_only(EST_Relation &ev); //void convert_to_event(EST_Relation &ev); static int rf_match(EST_Track &fz, EST_Item &ev, float range); static int zero_cross(EST_Track &fz); static int comp_extract(EST_Track &fz, EST_Track &part, float &start, float &end, float min); //void segment_to_event(EST_Relation &ev); //void event_to_segment(EST_Relation &ev, float min_length = 0.01); void int_segment_to_unit(EST_Relation &a, EST_Relation &ev); static void convert_to_local(EST_Relation &ev); static void silence_f0(EST_Relation &ev, EST_Track &fz); static void add_phrases(EST_Relation &ev); // find event portions of fz in contour, cut out, and send one by one // to individual labeller. // This routine takes an Fz contour and a list of potential events, // and peforms RFC matching on them. It returns a list of events with RFC // parameters marked. // // The algorithm works as follows: // // make a list of events, with start and stop times. // // for every event // { // find start and stop times. // call comp_extract() to get best section of contour that // falls between these times. If no suitable contour is found the // event is deleted and not labelled. // call rf_match to determine the optimal start and end times for // that section // } // // Now add connections between non-overlapping events. Overlapping events // get readjusted to make them simply adjacent void default_rfc_params(EST_Features &op) { op.set("start_limit", 0.1); op.set("stop_limit", 0.1); op.set("range", 0.3); op.set("min_event_duration", 0.03); } void print_event(EST_Item &ev); void rfc_analysis(EST_Track &fz, EST_Relation &ev, EST_Features &op) { EST_Item *e, *tmp, *n; float start_search, end_search; EST_Track part; EST_Relation eva; if (op.present("debug")) { cout << "rfc_recognise\n"; cout << ev; } int_segment_to_unit(ev, eva); if (op.present("debug")) { cout << "rfc_recognise\n"; cout << ev; } // fill values in event labels using matching algorithms for (e = ev.head(); e != 0; e = n) { n = e->next(); // cout << endl << endl; if (!event_item(*e)) continue; end_search = e->F("end") + op.F("stop_limit"); start_search = e->F("start") - op.F("start_limit"); if (op.present("debug")) { cout << "start = " << e->F("start") << " End " << e->F("end")<< endl; cout << "s start = " << start_search << " sEnd " << end_search << endl; cout << *e << endl;; } if (comp_extract(fz, part, start_search, end_search, op.F("min_event_duration"))) rf_match(part, *e, op.F("range")); else ev.remove_item(e); } // hack to deal with cases where no events exist if (ev.head() == 0) { tmp = ev.append(); make_int_item(*tmp, "sil", fz.t(0), fz.t(fz.num_frames() - 1), 0.0, 0.0, 0.0); } silence_f0(ev, fz); add_phrases(ev); // cout << endl << endl << ev; convert_to_local(ev); // make sure events don't overlap // adjust_overlaps(ev); ev.f.set("intonation_style", "rfc"); if (op.present("debug")) { cout << "After RFC analysis\n"; cout << ev; } } // convert intonation stream from segment type to event type description. // Note this has to be done in 2 loops. // Create a section of fz contour, bounded by times "start" and "end". // The created contour is defined to be the largest single continuous // section of contour bounded by the two times. If no fz contour exits within // the limits an error is returned. static void convert_to_local(EST_Item *e) { if (e->S("rfc.type", "0") == "RISEFALL") { e->set("rfc.rise_amp", (e->F("rfc.peak_f0") - e->F("ev.start_f0"))); e->set("rfc.rise_dur", (e->F("rfc.peak_pos") - e->F("start"))); e->set("rfc.fall_amp", (e->F("rfc.end_f0") - e->F("rfc.peak_f0"))); e->set("rfc.fall_dur", (e->F("end") - e->F("rfc.peak_pos"))); e->set("ev.f0", e->F("rfc.peak_f0")); // e->set("ev.f0", e->F("rfc.peak_f0") - e->F("rfc.rise_amp")); e->A("rfc").remove("peak_f0"); e->A("rfc").remove("peak_pos"); e->A("rfc").remove("end_f0"); e->A("rfc").remove("type"); e->A("ev").remove("start_f0"); } else if (e->S("rfc.type", "0") == "RISE") { e->set("rfc.rise_amp", (e->F("rfc.end_f0") - e->F("ev.start_f0"))); e->set("rfc.rise_dur", (e->F("end") - e->F("start"))); e->set("rfc.fall_amp", 0.0); e->set("rfc.fall_dur", 0.0); e->set("ev.f0", e->F("rfc.end_f0")); // e->set("ev.f0", e->F("rfc.end_f0") - e->F("rfc.rise_amp")); e->A("rfc").remove("peak_f0"); e->A("rfc").remove("peak_pos"); e->A("rfc").remove("end_f0"); e->A("rfc").remove("type"); e->A("ev").remove("start_f0"); } else if (e->S("rfc.type", "0") == "FALL") { e->set("rfc.rise_amp", 0.0); e->set("rfc.rise_dur", 0.0); e->set("rfc.fall_amp", (e->F("rfc.end_f0") - e->F("ev.start_f0"))); e->set("rfc.fall_dur", (e->F("end") - e->F("start"))); e->set("ev.f0", e->F("ev.start_f0")); e->A("rfc").remove("peak_f0"); e->A("rfc").remove("peak_pos"); e->A("rfc").remove("end_f0"); e->A("rfc").remove("type"); e->A("ev").remove("start_f0"); } if (!e->f_present("time")) e->set("time", (e->F("end") - e->F("rfc.fall_dur"))); } void convert_to_local(EST_Relation &ev) { EST_Item *e; for (e = ev.head(); e; e = e->next()) convert_to_local(e); // cout << "c to l \n\n\n" << ev << endl << endl; // ev.remove_item_feature("rfc.peak_f0"); // ev.remove_item_feature("rfc.peak_pos"); ev.remove_item_feature("ev.start_f0"); ev.remove_item_feature("start"); // ev.remove_item_feature("rfc.end_f0"); ev.remove_item_feature("end"); // remove_item_feature(ev, "int_event"); ev.f.set("timing_style", "event"); } void extract2(EST_Track &orig, float start, float end, EST_Track &ret); static int comp_extract(EST_Track &fz, EST_Track &part, float &start, float &end, float min_length) { int i; int continuous = 1; cout.precision(6); EST_Track tr_tmp, tmp2; if (start > end) EST_error("Illegal start and end times: %f %f\n", start, end); // int from = fz.index(start); // int to = fz.index_below(end); // cout << "full f0 = " << fz.num_frames() << endl; // fz.copy_sub_track(tr_tmp, from, to, 0, EST_ALL); // cout << "sub_track: " << tr_tmp; extract2(fz, start, end, tr_tmp); // cout << "tr_tmp 1\n" << tr_tmp; tr_tmp.rm_trailing_breaks(); // cout << "tr_tmp 2\n" << tr_tmp; // cout << "end " << tr_tmp.end() << " start "<< tr_tmp.start() << endl; // i = tr_tmp.num_frames(); // cout << "starting i = " << tr_tmp.num_frames() << endl; // cout << "starting i = " << tr_tmp.num_channels() << endl; // cout << "found end at " << i << tr_tmp.t(i) << endl; // cout << "tr_tmp 1\n" << tr_tmp; if ((tr_tmp.end() - tr_tmp.start()) < min_length) { cout << "Contour too small for analysis\n"; return 0; } for (i = 0; i < tr_tmp.num_frames(); ++i) if (tr_tmp.track_break(i)) continuous = 0; // if no breaks are found in this section return. if (continuous) { part = tr_tmp; return 1; } // tracks can legitimately have breaks in them due to the // search region overlapping a silence. In this case we find // the longest single section // cout << "tilt_analysis: This contour has a break in it\n"; int longest, s_c, s_l; longest = s_c = s_l = 0; for (i = 0; i < tr_tmp.num_frames(); ++i) if (tr_tmp.track_break(i)) { if ((i - s_c) > longest) { longest = i - s_c - 1; s_l = s_c; } // skip to next real values for (;(i < tr_tmp.num_frames()) && (tr_tmp.track_break(i)); ++i) s_c = i; } if ((i - s_c) > longest) { longest = i - s_c - 1; s_l = s_c; } // cout << "Longest fragment is " << longest << " starting at " << s_l <= 0.0) && (fz.a(i + 1) < 0.0)) return i; return -1; } // 1. There should be a more sophisticated decision about whether there // should be a risefall analysis, and if so, where the peak (zero cross) // region should be. // 2. There should be minimum endforced distances for rises and falls. static int rf_match(EST_Track &fz, EST_Item &ev, float range) { int n; EST_Track diff; int start, stop; int b_start, b_stop, e_start, e_stop, region; EST_Features empty; if (fz.num_frames() <= 0) { ev.set("start", 0.0); ev.set("ev", empty); ev.set("rfc", empty); ev.set("ev.start_f0", 0.0); ev.set("rfc.peak_f0", 0.0); ev.set("rfc.peak_pos", 0.0); } diff = differentiate(fz); // cout << "Extracted Contour:\n"; // cout << fz; n = zero_cross(diff); if (n >= 0) // rise + fall combination { // cout << "zero crossing at point " << n << " time " << fz.t(n) << endl; b_start = 0; stop = n; // find rise part region = (int)(range * float(stop - b_start)); // ensure region is bigger than 0 region = region > 0 ? region : 1; b_stop = b_start + region; e_start = stop - region; e_stop = stop + region; // ensure regions are separate e_start = (e_start < b_stop)? b_stop : e_start; //printf("rise: b_start %d, b_stop %d, end %d, end stop%d\n", b_start, // b_stop, e_start, e_stop); match_rf_point(fz, b_start, b_stop, e_start, e_stop, start, stop); // cout << "Rise is at start: " << start << " Stop = " << stop << endl; ev.set("ev.start_f0", fz.a(start)); ev.set("start", fz.t(start)); // find fall part. The start of the search is FIXED by the position // of where the rise stopped b_start = n; b_stop = n + 1; e_stop = fz.num_frames() - 1; region = (int)(range * float(e_stop - b_start)); region = region > 0 ? region : 1; e_start = e_stop - region; // printf("fall: b_start %d, b_stop %d, end %d, end stop%d\n", b_start, // b_stop, e_start, e_stop); match_rf_point(fz, b_start, b_stop, e_start, e_stop, start, stop); // cout << "Fall is at start: " << start << " Stop = " << stop << endl; // cout << "region: " << region << endl; // cout << "stop could be " << e_stop << " value " << fz.t(e_stop) << endl; // cout << "start could be " << e_start << " value " << fz.t(e_start) << endl; ev.set("rfc.peak_f0", fz.a(start)); ev.set("rfc.peak_pos", fz.t(start)); ev.set("rfc.end_f0", fz.a(stop)); ev.set("end", fz.t(stop)); ev.set("rfc.type", "RISEFALL"); /* ev.set("rfc.setpeak_f0", fz.a(start)); ev.fA("rfc").set("peak_pos", fz.t(start)); ev.fA("rfc",1).set("end_f0", fz.a(stop)); ev.set("end", fz.t(stop)); ev.fA("rfc").set("type", "RISEFALL"); */ // cout << "peak pos: " << ev.F("rfc.peak_pos") << endl; // cout << "peak pos: " << ev.A("rfc").F("peak_pos") << endl; // cout << "rfc:\n" << ev.A("rfc") << endl; // cout << "labelled event: " << ev << endl; } else // separate rise or fall { b_start = 0; e_stop = fz.num_frames() - 1; region = (int)(range * float(e_stop - b_start)); region = region > 0 ? region : 1; b_stop = b_start + region; e_start = e_stop - region; // printf("b_start %d, b_stop %d, end start %d, end stop%d\n", b_start, // b_stop, e_start, e_stop); match_rf_point(fz, b_start, b_stop, e_start, e_stop, start, stop); ev.set("start", fz.t(start)); ev.set("ev.start_f0", fz.a(start)); ev.set("rfc.peak_f0", 0.0); ev.set("rfc.peak_pos", 0.0); ev.set("rfc.end_f0", fz.a(stop)); ev.set("end", fz.t(stop)); // cout << "start " << fz.t(start) << " end " << fz.t(stop) << endl; if (fz.a(fz.index(fz.start())) < fz.a(fz.index(fz.end()))) ev.set("rfc.type", "RISE"); else ev.set("rfc.type", "FALL"); // cout << "labelled event: " << ev << endl; } return 0; } static void silence_f0(EST_Relation &ev, EST_Track &fz) { EST_Item * e; int i; for (e = ev.head(); e; e = e->next()) if (sil_item(*e)) { i = fz.prev_non_break(fz.index(e->F("start"))); e->set("ev.start_f0", fz.a(i)); i = fz.next_non_break(fz.index(e->F("end"))); e->set("ev.end_f0", fz.a(i)); } } static void add_phrases(EST_Relation &ev) { EST_Item *e, *n, *s; // cout << "phrase edges: " << endl; // cout << ev; for (e = ev.head(); e; e = n) { n = e->next(); if (sil_item(*e)) { if (e != ev.head()) { s = e->insert_before(); s->set("name", "phrase_end"); s->set("ev.f0", e->F("ev.start_f0")); s->set("time", e->F("start")); } if (e != ev.tail()) { s = e->insert_after(); s->set("name", "phrase_start"); s->set("ev.f0", e->F("ev.end_f0")); s->set("time", e->F("end")); } } } for (e = ev.head(); e; e = n) { n = e->next(); if (sil_item(*e)) ev.remove_item(e); } } /* static void add_phrases(EST_Relation &ev, bool phrase_edges) { EST_Item *e, *n, *s, *p; float min_duration = 0.02; cout << "phrase edges: " << phrase_edges << endl; cout << ev; for (e = ev.head(); next(e); e = n) { n = e->next(); p = e->prev(); if (!sil_item(*e)) continue; s = 0; if ((e != ev.head()) && (phrase_edges || (p &&(e->F("start") - p->F("end")) > min_duration))) { s = e->insert_before(); s->set("name", "phrase_end"); s->set("ev.f0", e->F("ev.start_f0", 1)); s->set("position", e->F("start")); } if (phrase_edges || (n &&((n->F("start")- e->F("end")) >min_duration))) { s = e->insert_after(); s->set("name", "phrase_start"); s->set("ev.f0", e->F("ev.end_f0",1)); s->set("position", e->F("end")); } if (s == 0) { s = e->insert_before(); s->set("name", "pause"); s->set("position", e->F("start")); } } s = e->insert_after(); s->set("name", "phrase_end"); s->set("ev.f0", e->F("ev.start_f0", 1)); s->set("position", e->F("end")); for (e = ev.head(); e; e = n) { n = e->next(); if (sil_item(*e)) ev.remove_item(e); } cout << "end phrase edges\n"; } */ static void make_int_item(EST_Item &tmp, const EST_String name, float end, float start, float start_f0, float peak_pos, float peak_f0) { tmp.set_name(name); EST_Features dummy; tmp.set("start", start); tmp.set("end", end); tmp.set("ev", dummy); tmp.set("ev.start_f0", start_f0); if ((name != "sil") && (name != "c")) { tmp.set("rfc", dummy); tmp.set("rfc.peak_pos", peak_pos); tmp.set("rfc.peak_f0", peak_f0); tmp.set("rfc.pos", 1); } } static float distance(EST_Track &fz, int pos, EST_Track &new_fz, int num_points) { int i; float distance = 0.0; float diff; for (i = 0; i < num_points; ++i) { diff = fz.a(i + pos) - new_fz.a(i); /* dprintf("o = %f, n = %f\n", old_contour[i + pos], new_contour[i]); */ distance += (diff * diff); } return (distance); } static float weight(float duration) { (void)duration; /* return ((MAX_DUR + 0.7) - duration); */ return(1.0); } // Return indexs in fz to best fitting region of monomial curve to // fz contour. The search is bounded by the b/e_start an b/e_stop // values. The contour fz, should have no breaks in it. static int match_rf_point(EST_Track &fz, int b_start, int b_stop, int e_start, int e_stop, int &mi, int &mj) { int i, j, k; float s_pos, e_pos, s_freq, e_freq, t; float amp, duration, dist, ndist; float min_dist = MAXFLOAT; int length; EST_Track new_fz(fz.num_frames(), 1); float f_shift; mi = mj = 0; // set values to zero for safety if ((b_start >= b_stop) || (b_start < 0)) { cerr << "Illegal beginning search region in match_rf_point:" << b_start << "-" << b_stop << endl; return -1; } if ((e_start >= e_stop) || (e_stop > fz.num_frames())) { cerr << "Illegal ending search region in match_rf_point:" << e_start << "-" << e_stop << endl; return -1; } f_shift = fz.shift(); duration = 0.0; for (i = b_start; i < b_stop; ++i) for (j = e_start; j < e_stop; ++j) { s_pos = fz.t(i); s_freq = fz.a(i); e_pos = fz.t(j); e_freq = fz.a(j); duration = e_pos - s_pos; amp = e_freq - s_freq; length = j - i; for (k = 0; k < length + 1; ++k) { t = ((float) k) * f_shift; new_fz.a(k) = (amp * fncurve(duration, t, 2.0)) + s_freq; } dist = distance(fz, i, new_fz, length); ndist = dist / (duration * 100.0); ndist *= weight(duration); if (ndist < min_dist) { min_dist = ndist; mi = i; mj = j; } } return 0; } /* #if 0 static void fill_f0_values(EST_Track &fz, EST_Relation &ev) { EST_Item *e; float start_a; int pos; float prev = 0.0; for (e = ev.head(); e != 0; e = e->next()) { if (e->name() == "sil") { pos = fz.index(prev); pos = fz.prev_non_break(pos); start_a = pos > 0 ? fz.a(pos) : 0.0; } else if (e->name() == "c") { pos = fz.index(prev);; pos = fz.next_non_break(pos); start_a = fz.a(pos); } else start_a = fz.a(prev); e->set("ev:start_f0", start_a); e->set("start", prev); // cout << "setting start to be " << start_a << " at pos " << pos << endl; // cout << *e << " " << *RFCS(*e) << endl; if (e->f("rfc:type") == "RISEFALL") { start_a = fz.a(e->F("rfc:peak_pos")); e->set("rfc:peak_f0", start_a); } prev = e->f("end"); } } static void insert_silence(EST_Item *n, EST_Track &fz, int i, int j) { EST_Item *prev_item, *new_sil; float min_length = 0.015; float sil_start, sil_end, start_f0; sil_start = i > 0 ? fz.t(i - 1) : 0.0; sil_end = fz.t(j); if ((sil_end - sil_start) < min_length) return; // add silence start_f0 = (i > 0) ? fz.a(i -1) : fz.a(i); new_sil = n->insert_after(); make_int_item(*new_sil, "sil", sil_end, sil_start, start_f0, 0.0, 0.0); new_sil->set("rfc:type", "SIL"); // if silence leaves a gap, make a new element before it if ((sil_start - n->F("start")) < min_length) return; // make new element, setting end time to silence start time. prev_item = n->prev()->insert_before(); make_int_item(*prev_item, n->name(), sil_start, 0.0, n->f("ev:start_f0"), 0.0,0.0); // now tidy up values of existing element n->set("ev:start_f0", fz.a(j)); n->set("start", sil_end); } static void add_phrases_old(EST_Relation &ev, EST_Track &fz) { int i; EST_Item *e, *n, *s; bool sil = false; float start, end; for (e = ev.head(); next(e); e = n) { n = e->next(); start = e->F("end"); end = n->F("start"); sil = false; cout << endl << endl; cout << *e << endl; cout << *n << endl; cout << "start = " << start << endl; cout << "end = " << end << endl; for (i = fz.index(start); i < fz.index(end); ++i) { cout << i << endl; cout << fz.val(i) << endl; if ((!sil) &&(!fz.val(i))) { cout << "phrase_end\n"; sil = true; s = e->insert_after(); s->set("name", "phrase_end"); s->set("position", fz.t(i - 1)); if (i > (fz.index(start) + 1)) s->set("ev:f0", fz.a(i - 1)); e = s; } if (sil && fz.val(i)) // just come out of silence { cout << "phrase_start\n"; sil = false; s = e->insert_after(); s->set("name", "phrase_start"); s->set("position", fz.t(i)); s->set("ev:f0", fz.a(i)); } } } } static void add_silences(EST_Track &fz, EST_Relation &ev, float end_sil_length) { int i, j; EST_Item *e; for (i = 0; i < fz.num_frames(); ++i) if (fz.track_break(i)) { for (j = i; j < fz.num_frames(); ++j) if (fz.val(j)) break; if (j == fz.num_frames()) // off end of array break; cout << "silence between " <next()) if (e->F("end") >= fz.t(j)) break; insert_silence(e, fz, i, j); // for (e = ev.head(); e != 0; e = e->next()) // cout << *e << " : " << *RFCS(*e) << endl; i = j; } if (sil_item(*ev.tail())) return; float start_f0 = fz.a(fz.end()); e = ev.append(); make_int_item(*e, "sil", fz.end() + end_sil_length, fz.end(), start_f0, 0.0, 0.0); e->set("rfc:type", "SIL"); } */ /*static void minimum_duration(EST_Relation &ev, float min_dur) { EST_Item *e, *n; for (e = ev.head(); e != 0; e = n) { n = e->next(); if (dur(*e) < min_dur) ev.remove_item(e); } } static void adjust_overlaps(EST_Relation &ev) { EST_Item *e, *n; float pos=0.0; for (e = ev.head(); next(e) != 0; e = e->next()) { n = e->next(); if (e->F("end") > n->F("start")) { */ /* cout << "Overlapping events " << *e <<":" << *n << endl; // case a: genuine overlap if (n->F("end") > e->F("end")) { cout << "case A\n"; // pos = (e->F("end") + start(n)) / 2.0; } // case b: second element is enclosed by first else if (n->F("end") <= e->F("end")) { cout << "case A\n"; // pos = start(n); } // case c: second element is before first * else if ((n->F("end") < e->F("end")) && (start(n) < start(e))) { cout << "case A\n"; pos = (n->F("end") + start(e)) / 2.0; } else cout << "No overlap conditions met\n"; // cout << "pos =" << pos << endl; */ /* e->set("end", pos); n->set("start", pos); cout << endl << endl; } } // The overlap adjustments may cause the peak position to lie outside // the start and end points. This checks for this and makes an // arbitrary adjustment for (e = ev.head(); next(e) != 0; e = e->next()) if ((e->f("rfc:type") == "RISEFALL") && (e->F("rfc:peak_pos") < e->F("start"))) e->set("rfc:peak_pos", (e->F("start") + e->F("end") / 2.0)); } static void conn_ends(EST_Track &fz, EST_Relation &ev, float min_length) { EST_Item *e, *n, *tmp; float t, f0; const float ARB_DISTANCE = 0.1; cout << min_length << endl; for (e = ev.head(); next(e) != 0; e = e->next()) { n = e->next(); cout << *e << ":"; cout << "n: " << n->F("start") << " e "<< e->F("end") << endl; if ((n->F("start") - e->F("end")) > min_length) { cout << "making connection\n"; tmp = n->insert_before(); make_int_item(*tmp, "c", n->f("start"), e->f("start"), e->f("rfc:end_f0"), 0.0, 0.0); e = e->next(); // advance after new connection } else { t = (n->F("start") + e->F("end")) /2.0; n->set("start", t); e->set("end", t); } } t = (ev.head())->f("start"); // store time of start of first event // insert silence at beginning if contour doesn't start at near time 0 // if (fz.start() > fz.shift()) // { // tmp = make_int_item("sil", fz.start(), 0.0, 0.0, 0.0, 0.0); // ev.prepend(tmp); // } // add connection between silence and first event tmp = ev.head()->insert_after(); make_int_item(*tmp, "c", t, 0.0, fz.a(fz.start()), 0.0, 0.0); if ((ev.tail()->F("end") + min_length) < fz.end()) { f0 = fz.a(ev.tail()->F("end")); // add connection after last event. //ev.insert_after(ev.tail(), tmp); tmp = ev.append(); make_int_item(*tmp, "c", fz.end(), 0.0, f0, 0.0, 0.0); } // add silence, an arbitrary distance after end - what a hack! // ev.insert_after(ev.tail(), tmp); tmp = ev.append(); make_int_item(*tmp, "sil", fz.end() + ARB_DISTANCE, 0.0, fz.a(fz.end()), 0.0, 0.0); } */ speech_tools/intonation/tilt/tilt_synthesis.cc0000644000076400007640000003335211465017155020426 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1996 - August 98 */ /* RFC Synthesis */ /* */ /*=======================================================================*/ #include "tilt.h" #include "EST_unix.h" #include "EST_math.h" #include "EST_tilt.h" #include "EST_Track.h" #include "EST_error.h" void tilt_synthesis(EST_Track &fz, EST_Relation &ev, float f_shift, int no_conn) { tilt_to_rfc(ev); rfc_synthesis(fz, ev, f_shift, no_conn); ev.remove_item_feature("rfc"); } void synthesize_rf_event(EST_Track &fz, EST_Features &ev, float peak_f0) { float t, amp, f_shift, a=0, start_f0; float dur=0; // for egcs int j; f_shift = fz.shift(); dur = ev.F("rise_dur"); amp = ev.F("rise_amp"); start_f0 = peak_f0 - amp; for (j = 0, t = 0.0; t < dur; t += f_shift, ++j) { a = unit_curve(amp, dur, t) + start_f0; if (a > fz.a(j)) // overlap check fz.a(j) = a; fz.set_value(j); } dur = ev.F("fall_dur"); amp = ev.F("fall_amp"); for (t = 0.0; t < dur; t += f_shift, ++j) { a = unit_curve(amp, dur, t) + peak_f0; if (a > fz.a(j)) // overlap check fz.a(j) = a; fz.set_value(j); } // hack to fill final values because of timing rounding errors for (; j < fz.num_frames(); ++j) fz.a(j) = a; } void fill_connection_values(EST_Track &fz, float start_f0, float start_pos, float end_f0, float end_pos) { float f_shift, m; int j; f_shift = fz.shift(); if ((end_pos - start_pos) == 0) m = 0.0; else m = (end_f0 - start_f0) / (end_pos - start_pos); for (j = 0; j < fz.num_frames()-1; ++j) { fz.a(j) = (m * (float) j * f_shift) + start_f0; fz.set_value(j); } fz.a(fz.num_frames()-1) = end_f0; fz.set_value(fz.num_frames()-1); // hack to fill final values because of timing rounding errors //a = fz.a(j -1); // I Think this is ezafi //for (; j < fz.num_frames(); ++j) //fz.a(j) = a; } void rfc_synthesis(EST_Track &fz, EST_Relation &ev, float f_shift, int no_conn) { EST_Item *e,*nn; EST_Track sub; float start_pos=0, start_f0=0; int start_index, end_index; float end_pos, end_f0; int n; if (event_item(*ev.tail())) n = (int)(ceil((ev.tail()->F("time") + ev.tail()->F("rfc.fall_dur",0)) / f_shift)) + 1; else n = (int)(ceil(ev.tail()->F("time")/ f_shift)) + 1; fz.resize(n, 1); fz.set_equal_space(true); fz.fill(0.0); fz.fill_time(f_shift); // set default to be break (silence) for (int i = 0; i < fz.num_frames(); ++i) fz.set_break(i); // synthesize events for (e = ev.head(); e != 0; e = e->next()) { if (event_item(*e)) { start_pos = e->F("time") - e->F("rfc.rise_dur"); end_pos = e->F("time") + e->F("rfc.fall_dur"); if ((start_pos / f_shift-(int)start_pos / f_shift)>.5) start_index=int(start_pos / f_shift+1); else start_index = (int) start_pos / f_shift; if(end_pos / f_shift-(int)end_pos / f_shift>.5) end_index = int( end_pos / f_shift+1); else end_index = (int) end_pos / f_shift; // cout << "a: " << fz.equal_space() << endl; fz.sub_track(sub, start_index, (end_index - start_index) + 1, 0, EST_ALL); // cout << "a: " << fz.equal_space() << endl; // cout << "b: " << sub.equal_space() << endl; synthesize_rf_event(sub, e->A("rfc"), e->F("ev.f0")); } } if (no_conn) return; // synthesize connections for (e = ev.head(); e->next() != 0; e = e->next()) { if (e->S("name") == "phrase_end") continue; nn = e->next(); // calculate start and stop times, with additional // optional adjustment for rise and falls on events start_f0 = e->F("ev.f0") + e->F("rfc.fall_amp", 0.0); start_pos= e->F("time") + e->F("rfc.fall_dur", 0.0); end_f0 = nn->F("ev.f0") - nn->F("rfc.rise_amp", 0.0); end_pos = nn->F("time") - nn->F("rfc.rise_dur", 0.0); if ((start_pos / f_shift-(int)start_pos / f_shift)>.5) start_index=int(start_pos / f_shift+1); else start_index = (int) start_pos / f_shift; if(end_pos / f_shift-(int)end_pos / f_shift>.5) end_index = int( end_pos / f_shift+1); else end_index = (int) end_pos / f_shift; if (start_index >= end_index) // no connection needed continue; fz.sub_track(sub, start_index, end_index - start_index+1 , 0, EST_ALL); fill_connection_values(sub, start_f0, start_pos, end_f0, end_pos); } } /* // find event portions of fz in contour, cut out, and send one by one // to individual labeller. void fill_rise_fall_values(EST_Track &fz, float amp, float dur, float start_f0, float start_pos, float f_shift, EST_String type, int nframes) { float t, a; // this ensures rounding errors don't multiply int j = (int) rint(start_pos / f_shift); int n = 0; // for (t = 0.0; t < (dur + (f_shift /2.0)); t += f_shift, ++j, ++n) for (t = 0.0; n < nframes; t += f_shift, ++j, ++n) { a = unit_curve(type, amp, dur, t) + start_f0; if (a > fz.a(j)) // overlap check fz.a(j) = a; fz.set_value(j); } cout << "curve frames: " << n << endl; } void fill_connection_values(EST_Track &fz, float start_f0, float start_pos, float end_f0, float end_pos, float f_shift) { // this ensures rounding errors don't multiply int j = (int) rint(start_pos / f_shift); float m = (end_f0 - start_f0) / (end_pos - start_pos); if (!finite(m)) m = 0.0; int pos = fz.index(start_pos); for (j = pos; j < (fz.index(end_pos) + 1); ++j) { fz.a(j) = (m * (float) (j -pos) * f_shift) + start_f0; fz.set_value(j); } } void fill_rise_fall_values(EST_Track &fz, float amp, float start_f0) { float t, a; int j; float f_shift = fz.shift(); float dur = fz.num_frames() * f_shift; for (j = 0, t = 0.0; j < fz.num_frames(); t += f_shift, ++j) { a = unit_curve("RISE", amp, dur, t) + start_f0; if (a > fz.a(j)) // overlap check fz.a(j) = a; fz.set_value(j); } } void fill_connection_values(EST_Track &fz, float start_f0, float end_f0) { // this ensures rounding errors don't multiply int j; float f_shift = fz.shift(); float dur = fz.num_frames() * f_shift; float m = (end_f0 - start_f0) / dur; if (!finite(m)) m = 0.0; for (j = 0 j < fz.num_frames(); ++j) { fz.a(j) = (m * (float)j * f_shift) + start_f0; fz.set_value(j); } } #if 0 void start_f0_pos(EST_Item *e, const EST_String &type, float &start_f0, float &start_pos) { if (type == "RISE") { start_f0 = e->F("ev.f0"); start_pos = e->F("position") - e->F("rfc.rise_dur"); } else { start_f0 = e->F("ev.f0") + e->F("rfc.rise_amp"); start_pos = e->F("position"); } } #endif static float find_start_pos(EST_Item *e, const EST_String &type) { //cout << "find start position for " << *e << endl; if (type == "RISE") return e->F("position") - e->F("rfc.rise_dur"); else return e->F("position"); } static float find_start_f0(EST_Item *e, const EST_String &type) { //cout << "find start f0 for " << *e<< endl; if (type == "RISE") return e->F("ev.f0"); else return e->F("ev.f0") + e->F("rfc.rise_amp"); } float rfc_dur(EST_Item *e) { return e->F("rfc.rise_dur") + e->F("rfc.fall_dur"); } float rfc_amp(EST_Item *e) { return e->F("rfc.rise_amp") + e->F("rfc.fall_amp"); } int rfc_synthesis_ld(EST_Track &fz, EST_Relation &ev, float f_shift, int no_conn) { EST_Item *e,*nn; EST_Track sub; float start_pos=0, start_f0=0; EST_String type; (void)no_conn; int start_index, nframes, end_index; float length, end_pos; float last_time = ev.tail()->F("position") + rfc_dur(ev.tail()); int n = (int)(2 + (last_time / f_shift)); fz.resize(n, 1); fz.fill(0.0); fz.fill_time(f_shift); fill_rfc_types(ev); // set default to be break (silence) for (int i = 0; i < fz.num_frames(); ++i) fz.set_break(i); for (e = ev.head(); e != 0; e = e->next()) { // cout << "\ntype: " << e->fS("rfc.type") << endl; //cout << "\ntype: " << *e << endl; if (e->f("rfc.type",1) == "RISEFALL") { start_f0 = find_start_f0(e,"RISE"); start_pos = find_start_pos(e,"RISE"); start_index = (int) rint(start_pos / f_shift); nframes = (int)((e->F("rfc.rise_dur")+ (f_shift /2.0))/f_shift); fz.sub_track(sub, start_index, nframes, 0, EST_ALL); fill_rise_fall_values(sub, e->F("rfc.rise_amp"), start_f0); cout << "rise subtrack: " << sub; start_index = (int) rint(find_start_pos(e, "FALL") / f_shift); nframes = (int)((e->F("rfc.fall_dur") +(f_shift /2.0))/f_shift); fz.sub_track(sub, start_index, nframes, 0, EST_ALL); fill_rise_fall_values(sub, e->F("rfc.fall_amp"), find_start_f0(e,"FALL")); cout << "fall subtrack: " << sub; fill_rise_fall_values(sub, e->F("rfc.fall_amp"), e->F("rfc.fall_dur"), find_start_f0(e,"FALL"), find_start_pos(e,"FALL"), f_shift, "FALL", nframes); } else if (e->f("rfc.type",1) == "RISE") { start_f0 = find_start_f0(e,"RISE"); start_pos = find_start_pos(e,"RISE"); start_index = (int) rint(start_pos / f_shift); nframes = (int)((e->F("rfc.rise_dur")+ (f_shift /2.0))/f_shift); fz.sub_track(sub, start_index, nframes, 0, EST_ALL); fill_rise_fall_values(sub, e->F("rfc.rise_amp"), start_f0); fill_rise_fall_values(fz, e->F("rfc.rise_amp"), e->F("rfc.rise_dur"), start_f0, start_pos, f_shift, "RISE", nframes); } else if (e->f("rfc.type",1) == "FALL") { start_f0 = find_start_f0(e, "FALL"); start_pos = find_start_pos(e, "FALL"); nframes = (int)((e->F("rfc.fall_dur")+ (f_shift /2.0))/f_shift); start_index = (int) rint(find_start_pos(e, "FALL") / f_shift); fz.sub_track(sub, start_index, nframes, 0, EST_ALL); fill_rise_fall_values(fz, e->F("rfc.fall_amp"), e->F("ev.f0")); fill_rise_fall_values(fz, e->F("rfc.fall_amp"), e->F("rfc.fall_dur"), e->F("ev.f0"), e->F("position"), f_shift, "FALL", nframes); } else { EST_Item *nn,*pp; if (no_conn) continue; if (e->f("name",1) == "phrase_end") { if (e->f_present("ev.f0")) { pp = e->prev(); fill_connection_values(fz, start_f0 + rfc_amp(pp), start_pos + rfc_dur(pp), e->F("ev.f0"), e->F("position"), f_shift); } } else if (e->f("name", 1) == "phrase_start") { //cout << "phrase start:\n" << *e << endl; if ((nn = e->next()) == 0) EST_error("phrase start command occurs as last item " "in rfc synthesis\n"); else if (event_item(*nn)) { start_f0 = find_start_f0(nn,"RISE"); start_pos = find_start_pos(nn,"RISE"); } else { start_f0 = nn->F("ev.f0"); start_pos = nn->F("position"); } fill_connection_values(fz, e->F("ev.f0"), e->F("position"), start_f0,start_pos, f_shift); } else if (e->f("name") == "pause") {} else EST_error("Unable to synthesis intonation element %s\n", (const char *)(e->fS("name"))); continue; } if (((nn = e->next()) != 0) && (event_item(*nn))) { float f0 = start_f0+rfc_amp(e); float pos = start_pos + rfc_dur(e); float end_f0 = find_start_f0(nn,"RISE"); float end_pos = find_start_pos(nn,"RISE"); fill_connection_values(fz, f0, pos, end_f0, end_pos, f_shift); } } } */ speech_tools/intonation/tilt/tilt_utils.cc0000644000076400007640000002547611465017155017545 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1996 */ /*-----------------------------------------------------------------------*/ /* Event RFC Utilities */ /* */ /*=======================================================================*/ #include #include "EST_math.h" #include "tilt.h" #include "EST_error.h" void validate_rfc_stream(EST_Relation &ev); /* float rfc_to_tilt_amp(EST_Item *e) { return fabs(e->F("rfc.rise_amp")) + fabs(e->F("rfc.fall_amp")); } float rfc_to_tilt_dur(EST_Item *e) { return e->F("rfc.rise_dur") + e->F("rfc.fall_dur"); } float rfc_to_a_tilt(EST_Item *e) { return (float)(fabs(e->F("rfc.rise_amp")) - fabs(e->F("rfc.fall_amp"))) / (float)(fabs(e->F("rfc.rise_amp")) + fabs(e->F("rfc.fall_amp"))); } float rfc_to_d_tilt(EST_Item *e) { return (float)(fabs(e->F("rfc.rise_dur")) - fabs(e->F("rfc.fall_dur"))) / (float)(e->F("rfc.rise_dur") + e->F("rfc.fall_dur")); } float rfc_to_t_tilt(EST_Item *e) { float t_tilt; t_tilt = (rfc_to_a_tilt(e) + rfc_to_d_tilt(e)) / 2; if (isnan(t_tilt)) t_tilt = 0.0; return t_tilt; } float tilt_to_rise_amp(EST_Item *e) { return e->F("tilt.amp") * (1 + e->F("tilt.tilt")) / 2.0; } float tilt_to_rise_dur(EST_Item *e) { return e->F("tilt.dur") * (1 + e->F("tilt.tilt")) / 2.0; } float tilt_to_fall_amp(EST_Item *e) { return -e->F("tilt.amp") * (1 - e->F("tilt.tilt")) / 2.0; } float tilt_to_fall_dur(EST_Item *e) { return e->F("tilt.dur") * (1 - e->F("tilt.tilt")) / 2.0; } float tilt_to_peak_f0(EST_Item *e) { return e->F("ev:start_f0") + tilt_to_rise_amp(e); } float tilt_to_peak_pos(EST_Item *e) { return e->F("start") + tilt_to_rise_dur(e); } */ float rfc_to_tilt_amp(EST_Features &e) { return fabs(e.F("rise_amp")) + fabs(e.F("fall_amp")); } float rfc_to_tilt_dur(EST_Features &e) { return e.F("rise_dur") + e.F("fall_dur"); } float rfc_to_a_tilt(EST_Features &e) { return (float)(fabs(e.F("rise_amp")) - fabs(e.F("fall_amp"))) / (float)(fabs(e.F("rise_amp")) + fabs(e.F("fall_amp"))); } float rfc_to_d_tilt(EST_Features &e) { return (float)(fabs(e.F("rise_dur")) - fabs(e.F("fall_dur"))) / (float)(e.F("rise_dur") + e.F("fall_dur")); } float rfc_to_t_tilt(EST_Features &e) { float t_tilt; t_tilt = (rfc_to_a_tilt(e) + rfc_to_d_tilt(e)) / 2; if (isnanf(t_tilt)) t_tilt = 0.0; return t_tilt; } float tilt_to_rise_amp(EST_Features &e) { return e.F("amp") * (1 + e.F("tilt")) / 2.0; } float tilt_to_rise_dur(EST_Features &e) { return e.F("dur") * (1 + e.F("tilt")) / 2.0; } float tilt_to_fall_amp(EST_Features &e) { return -e.F("amp") * (1 - e.F("tilt")) / 2.0; } float tilt_to_fall_dur(EST_Features &e) { return e.F("dur") * (1 - e.F("tilt")) / 2.0; } float tilt_to_peak_f0(EST_Item *e) { return e->F("ev:start_f0") + tilt_to_rise_amp(e->A("tilt")); } float tilt_to_peak_pos(EST_Item *e) { return e->F("start") + tilt_to_rise_dur(e->A("tilt")); } void rfc_to_tilt(EST_Features &rfc, EST_Features &tilt) { tilt.set("amp", rfc_to_tilt_amp(rfc)); tilt.set("dur", rfc_to_tilt_dur(rfc)); tilt.set("tilt", rfc_to_t_tilt(rfc)); } void rfc_to_tilt(EST_Relation &ev) { EST_Item *e; EST_Features f; if (ev.f("intonation_style") != "rfc") EST_error("Can't create Tilt parameters from intonation style: %s\n", (const char *)ev.f.S("intonation_style")); for (e = ev.head(); e != 0; e = e->next()) if (event_item(*e)) { e->set("tilt", f); rfc_to_tilt(e->A("rfc"), e->A("tilt")); } ev.f.set("intonation_style", "tilt"); } void tilt_to_rfc(EST_Features &tilt, EST_Features &rfc) { rfc.set("rise_amp", tilt_to_rise_amp(tilt)); rfc.set("rise_dur", tilt_to_rise_dur(tilt)); rfc.set("fall_amp", tilt_to_fall_amp(tilt)); rfc.set("fall_dur", tilt_to_fall_dur(tilt)); } void tilt_to_rfc(EST_Relation &ev) { EST_Item *e; EST_Features f; if (ev.f("intonation_style") != "tilt") EST_error("Can't create RFC parameters for intonation_style: %s\n", (const char *)ev.f.S("intonation_style")); for (e = ev.head(); e ; e = e->next()) if (event_item(*e)) { e->set("rfc", f); tilt_to_rfc(e->A("tilt"), e->A("rfc")); } ev.f.set("intonation_style", "rfc"); // say that this now contains rfc } void scale_tilt(EST_Relation &ev, float shift, float scale) { EST_Item *e; for (e = ev.head(); e; e = e->next()) { e->set("ev.f0", (e->F("ev.f0") + shift)); if (e->f_present("int_event")) e->set("tilt.amp", (e->F("tilt.amp") * scale)); } } void fill_rfc_types(EST_Relation &ev) { EST_Item *e; for (e = ev.head(); e; e = e->next()) { if (event_item(*e)) { if ((e->F("rfc.rise_amp") > 0.0) && (e->F("rfc.fall_amp") < 0.0)) e->set("rfc.type", "RISEFALL"); else if (e->F("rfc.rise_amp") > 0.0) e->set("rfc.type", "RISE"); else e->set("rfc.type", "FALL"); } else e->set("rfc.type", "SIL"); } } void int_segment_to_unit(EST_Relation &int_lab, EST_Relation &ev_lab) { EST_Item *e, *inext; (void)ev_lab; float start = 0.0; if (int_lab.f("timing_style") != "segment") EST_error("Undefined timing style:%s in relation\n", (const char *)int_lab.f.S("timing_style")); for (e = int_lab.head(); e != 0; e = e->next()) { e->set("start", start); start = e->F("end"); } for (e = int_lab.head(); e != 0; e = inext) { inext = e->next(); if (event_item(*e) || sil_item(*e)) continue; int_lab.remove_item(e); } /* for (e = int_lab.head(); e != 0; e = inext) { if (event_item(*e)) ev_lab.append(e); } */ int_lab.f.set("timing_style", "unit"); } void fn_start_to_real_start(EST_Relation &ev) { for (EST_Item *e = ev.head(); e; e = e->next()) e->set("start", e->F("start")); } void set_fn_start(EST_Relation &ev) { for (EST_Item *e = ev.head(); e; e = e->next()) e->set_function("start", "standard+start"); } // this should move to EST_Relation_aux.cc after REORG. This // adds a dummy stream_item with no name. void event_to_segment(EST_Relation &ev, float min_length) { EST_Item *e, *n; EST_Item *dummy; // REORG - replace by stream feature if (ev.f.S("timing_style") != "event") return; for (e = ev.head(); e->next() != 0; e = e->next()) { n = e->next(); if ((n->F("start") - e->F("end")) > min_length) { dummy = e->insert_after(); // dummy->set("end", 19.0); dummy->set("end", n->F("start")); // cout << n->F("start") << endl; // sleep(2); // dummy->set("start", e->F("end")); // cout << *n << endl; // cout << *dummy << endl; // cout << dummy << endl; // sleep(1); } /* else // make sure starts and ends are now properly contiguous { float pos = (n->F("start") - e->F("end")) / 2.0; // cout << "balanced pos = " << pos << endl; e->set("end", pos); n->set("start", pos); } */ } // cout << "Event to segment\n"; // cout << ev; set_fn_start(ev); // REORG - replace by stream feature ev.f.set("timing_style", "segment"); // cout << "Event to segment\n"; // cout << ev; } void remove_rfc_features(EST_Relation &ev) { for (EST_Item *e = ev.head(); e != 0; e = e->next()) { e->f_remove("rfc.rise_amp"); e->f_remove("rfc.rise_dur"); e->f_remove("rfc.fall_amp"); e->f_remove("rfc.fall_dur"); e->f_remove("rfc.type"); } } void remove_tilt_features(EST_Relation &ev) { for (EST_Item *e = ev.head(); e != 0; e = e->next()) { e->f_remove("tilt.amp"); e->f_remove("tilt.dur"); e->f_remove("tilt.tilt"); } } float unit_curve(float amp, float dur, float t) { float val; float x; x = (t / (dur)) * 2.0; if (x < 1.0) val = pow(x, float(2.0)); else val = 2 - pow((float(2.0) - x), float(2.0)); val = (val / 2.0); val *= amp; val += 0; // vert dist. return val; } float fncurve(float length, float t, float curve) { float val; float x; x = (t / length) * 2.0; if (x < 1.0) val = pow(x, curve); else val = 2 - pow((2 - x), curve); val = val / 2.0; return val; } int event_item(EST_Item &e) { return e.I("int_event", 0); } int sil_item(EST_Item &e) { return ((e.name() == "sil") || (e.name() == "SIL")); } int connection_item(EST_Item &e) { return ((e.name() == "c") || (e.name() == "C")); } speech_tools/intonation/tilt/tilt.h0000644000076400007640000000746507262605664016175 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1996 */ /*-----------------------------------------------------------------------*/ /* Internal tilt functions */ /* */ /*=======================================================================*/ #ifndef __TILT_H__ #define __TILT_H__ #include "ling_class/EST_Relation.h" /*float rise_amp(EST_Item *e); float fall_amp(EST_Item *e); float gen_amp(EST_Item *e); float rise_dur(EST_Item *e); float fall_dur(EST_Item *e); float gen_dur(EST_Item *e); float rfc_to_tilt_amp(EST_Item *e); float rfc_to_tilt_dur(EST_Item *e); float rfc_to_a_tilt(EST_Item *e); float rfc_to_d_tilt(EST_Item *e); float rfc_to_t_tilt(EST_Item *e); float tilt_to_rise_amp(EST_Item *e); float tilt_to_rise_dur(EST_Item *e); float tilt_to_peak_f0(EST_Item *e); float tilt_to_peak_pos(EST_Item *e); */ float fncurve(float length, float t, float curve); float unit_curve(float amp, float dur, float t); int event_item(EST_Item &e); int sil_item(EST_Item &e); int connection_item(EST_Item &e); void fill_rfc_types(EST_Relation &ev); /* void print_rfc2_events(EST_Relation &ev); */ void set_fn_start(EST_Relation &ev); /* inline float dur(EST_Item &e) { return e.fF("end") - e.fF("start"); } */ #endif /* TILT_UTILS */ speech_tools/intonation/tilt/Makefile0000644000076400007640000000556207262605664016504 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Intonational Event Routines Makefile # # # #=========================================================================# TOP=../.. DIRNAME=intonation/tilt H = tilt.h NOOPTSRCS = tilt_utils.cc CPPSRCS = tilt_analysis.cc tilt_synthesis.cc $(NOOPTSRCS) CSRCS = SRCS = $(CPPSRCS) OBJS = $(CPPSRCS:.cc=.o) FILES = $(SRCS) $(H) Makefile ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/lib/Makefile0000644000076400007640000001022707262605664014106 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # library directory # #========================================================================## TOP=.. DIRNAME=lib SKELETONS = est_program_makefile-in est_mainline-in FILES = Makefile cstrutt.dtd $(SKELETONS) VCLocalRules BUILT_LIBRARIES = $(PROJECT_LIBRARIES:%=lib%.a) SHARED_LIBRARIES = $(PROJECT_SHARED_LIBRARIES:%=lib%.so*) ALL_DIRS = example_data siod LOCAL_CLEAN = $(BUILT_LIBRARIES) $(SHARED_LIBRARIES) est.jar $(SKELETONS:%-in=%) INSTALL = libfile ALL = $(SKELETONS:%-in=%) .libraries include $(TOP)/config/common_make_rules libfile: $(INSTALL_PROG) libestools.a libeststring.a $(LIBDIR)/ CXX_COMMAND_ABS=$(subst $(TOP),$$(EST_HOME),$(CXX_COMMAND)) CC_COMMAND_ABS=$(subst $(TOP),$$(EST_HOME),$(CXX_COMMAND)) LINK_COMMAND_ABS=$(subst $(TOP),$$(EST_HOME),$(LINK_COMMAND)) INCLUDES_ABS=$(subst $(TOP),$$(EST_HOME),$(INCLUDES)) LIBS_ABS=$(subst $(TOP),$$(EST_HOME),$(LIBS)) skeletons: $(SKELETONS:%-in=%) $(SKELETONS:%-in=%): $(TOP)/config/config $(SKELETONS:%-in=%) : %: %-in @echo make $* from $*-in @- if [ -f $* ] ; then chmod +w $* ; fi @$(NAWK) -f "$(EST)/config/rules/script_process.awk" \ project='$(PROJECT_NAME)' \ version='$(PROJECT_VERSION)' \ systemtype='$(MACHINETYPE)_$(OSTYPE)$(OSREV)' \ topdir='$($(PROJECT_PREFIX)_HOME)' \ lib='$($(PROJECT_PREFIX)_HOME)/$(PROJECT_LIBRARY_DIR)' \ includes='$(INCLUDES_ABS)' \ defines='$(DEFINES)' \ libs='$(LIBS_ABS)' \ est='$(EST_HOME)' \ classpath='$(SYSTEM_JAVA_CLASSPATH)' \ perl='$(PERL)' \ javahome='$(JAVA_HOME)' \ java='$(JAVA)' \ javac='$(JAVAC)' \ ldpath='$(SYSTEM_LD_LIBRARY_PATH)' \ cccommand='$(CC_COMMAND_ABS)' \ cxxcommand='$(CXX_COMMAND_ABS)' \ linkcommand='$(LINK_COMMAND_ABS)' \ $*-in > $* @-chmod -w $* speech_tools/lib/cstrutt.dtd0000644000076400007640000000237407262616577014664 0ustar awbawb speech_tools/lib/est_program_makefile-in0000644000076400007640000000115207262605664017151 0ustar awbawb ########################################################################### # # # Makefile for use with __PROJECT__ # # ########################################################################### EST_HOME=__EST__ EXECS = all: $(EXECS) ## PROGRAMS ## RULES $(EXECS) : % : %.o $(%_OBJ) __LINK_COMMAND__ -o $* $($*_OBJ) $($*_LIBS) __LIBS__ %.o: %.cc __CXX_COMMAND__ $($*_INCLUDES) $($*_DEFINES) $*.cc %.o: %.c __CC_COMMAND__ $($*_INCLUDES) $($*_DEFINES) $*.c speech_tools/lib/est_mainline-in0000644000076400007640000000116507262605664015445 0ustar awbawb #include #include "EST.h" #include "EST_types.h" #include "EST_error.h" int main(int argc, char *argv[]) { EST_StrList files; EST_Option cmd_line; parse_command_line (argc, argv, EST_String("[OPTIONS] [files...]\n")+ "Summary; <>\n"+ "-o Ouptut file\n", files, cmd_line); EST_String out_file; if (cmd_line.present("-o")) out_file = cmd_line.val("-o"); else EST_error("No output file specified"); EST_StrList::Entries fs; for(fs.begin(files); fs; ++fs) { EST_String file = *fs; // Process file } return 0; } speech_tools/lib/VCLocalRules0000644000076400007640000000016607262605664014670 0ustar awbawbest_program_makefile: @echo no template makefile built for VC++ est_mainline: @echo no template main built for VC++speech_tools/lib/example_data/Makefile0000644000076400007640000000710707262605664016535 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## This directory contains data used in tests and anything else which ## ## might be useful to users trying things out. ## ## ## ########################################################################### TOP=../.. DIRNAME=lib/example_data VITFILES = vit.B.ngram vit.observes vit.vocab CH_WAVE_FILES = ch_wave.wav key.lab CH_TRACK_FILES = ch_track.htk LPC_FILES = kdt_001.wav kdt_001.pm WAGON_FILES = wagon.data wagon.desc wagon.tree TEXT_FILES = alice options.file MAP_FILES = colours.map colours_translation.map channel_names.map XML_FILES = eg.xml eg.dtd UTT_FILES = ked_wr1_012.utt TILT_FILES = kdt_001.il kdt_001.tilt TESTFILES = $(VITFILES) $(CH_WAVE_FILES) $(CH_TRACK_FILES) $(TEXT_FILES) \ $(MAP_FILES) $(LPC_FILES) $(WAGON_FILES) $(XML_FILES) $(UTT_FILES) \ $(TILT_FILES) FILES = Makefile $(TESTFILES) include $(TOP)/config/common_make_rules speech_tools/lib/example_data/vit.B.ngram0000644000076400007640000000114307262605664017077 0ustar awbawbNgram_2 5 B NB B NB B B B B B : 0.25 B B B B NB : 0.25 B B B NB B : 4 B B B NB NB : 3 B B NB B B : 0.25 B B NB B NB : 12 B B NB NB B : 39 B B NB NB NB : 106 B NB B B B : 2 B NB B B NB : 13 B NB B NB B : 121 B NB B NB NB : 593 B NB NB B B : 35 B NB NB B NB : 1059 B NB NB NB B : 1217 B NB NB NB NB : 3143 NB B B B B : 0.25 NB B B B NB : 4 NB B B NB B : 11 NB B B NB NB : 142 NB B NB B B : 15 NB B NB B NB : 702 NB B NB NB B : 1055 NB B NB NB NB : 4254 NB NB B B B : 2 NB NB B B NB : 140 NB NB B NB B : 596 NB NB B NB NB : 4715 NB NB NB B B : 107 NB NB NB B NB : 4252 NB NB NB NB B : 3143 NB NB NB NB NB : 5843 speech_tools/lib/example_data/vit.observes0000644000076400007640000000012007262605664017435 0ustar awbawb0.1 0.9 0.1 0.9 0.1 0.9 0.1 0.9 0.8 0.2 0.8 0.2 0.1 0.9 0.1 0.9 0.1 0.9 0.1 0.9 speech_tools/lib/example_data/vit.vocab0000644000076400007640000000000507262605664016701 0ustar awbawbB NB speech_tools/lib/example_data/ch_wave.wav0000644000076400007640000010104407262605664017223 0ustar awbawbNIST_1A 1024 channel_count -i 1 sample_count -i 16146 sample_rate -i 8000 sample_coding -s3 pcm sample_n_bytes -i 2 sample_byte_format -s2 10 end_head                                                " !,(!'*:A@:5Sjs`><=LRD2io 12$$.* !,(!'*:A@:5Sjs`><=LRD2io 12$$.* !-(!&*:@@94Qis_=;=LSE2 ]!TgS=\r[B~b0=yAmV\uc#$R]8zs{s! [p zP+^,NB71tTm>YFx a `yV6ri&xI,(nKN{ U;[x#N< [slCOHMuc~Q%+ 3Am?St:I>G@i&kF']B{cjZ=Dhm3/l||dVs@ R+pq+(@H Ae 4|H)@&- ~!ymi2%$Ap!%a)K:r=d5]7$x:7 orxt]Jn  pFU(Hi{ sr4t`1uobB90,,wWK%(Tux gWsf4%Zd <Us#YR% R3tibI!hJb?-g$.^ZNv{o"aNPk^L[qzcUT@sxu0$m ei-t|::N{ir#y-5K#!N'}W}j?T@,?sC]PEAy11|#g!NYJ &MPHiH'I`FiiDzzK!P+iy2u%(G=Hi`m/V4lDGGR@tx08roa"$ZKxX};lbBol;'js " L *\a[H=s;h!QV5j .C5NE-ubb)Ua[`'("s~'HYiLy4uGac''b4>}IGpxAPEK#]l QVU@s l{ !R9X!}{DhC|6F7f x[0AjqXC4Z\>5 ph_ c " V 9as2H&*NXgydI'o*c 7'Wz<,E^rU  >(Ayy o#B+4&iUofpxyT Ha V_~j9=ep` iM-PNZ +_?0oG9fn*|BU jU)@ s I;=5/eW{~ -  9H((%%Ri.r n 3PIW /* e;_<.=A;".&g ; V  }K)0SWgz;i+K = RiW |o.EUt? ' 4 =.T*'qB5e=U$`Q}W-6g^ d -?: Ac  Cuyh ?w+fJ   ~ W f  1,,>oU{5 :,/<7=0 "+uG4Lo?t^Z-=s9 I%s S I)EU'ex*@  <nPy s\-j|DfFhC B '  5plK(mT3S| B UZ2YS&:  jA w } -ZF/ 0S-p]8OGZX[w>$rn & " vr$Ku*9%Mf,T8/:Jaoa;t &! } G X%Uzx,\'w yi`-v5&S:kfRMa9BL%0~ k Zr&:D|2@kQH7:kjAz\MYO\L(Z=r#USTa"9b:`zveUC90+&## -<KSWWRK@5( ||  )2;EOZemqtogYH10?Ndv}hUB-{{d~c8-oe&bU:aVp5  FD;l"JR/OOiJzQN(8SrSr<}Pp)V,1*1YC"Y?S>F}|(=6BR4CBa. v!fD; F )-9;CZL-Uc{I\#>#OeYvRmt1Ya) kE AT qQMUA Oat-zT6U]S\9oX{wf61ZJ7 d ]} 3KUt <W0hP.{z]P4=RBE_o :3hHp , 1/vj)e9 |u*@P UnzQ (X XD0U;^h62F}_o@'qJl Y^x`}m ^ o h/~Vrgf.OF. p{|Q1[@ wSU Je_ z 06 9 ! s }&7=V T;:V/m(k6~A#_Ds]2f%`fU~DkJZ/T+i[ nl]U[MB\+)C(mXc4E>#~u V{c* 8~IJO--GND(`3w1&U P"b !) orfCXmJ8-<=TccS5rCeOwqnmr.{y3g<IyqOk*\v0qJ e+ l-gYX.T[wG.h QKA1a*[X@MJX iNe%|l<*sEMF4hyJQ-1Z@avh5;rg~P7t!%|VsO4lr0x}$ MpO!VrQ#uMwJH}(4@a2NO2une%mU\LX%F'L4nM~Qi19+8myA8E(=#.3("H)V\xy[\Y c|Xv_"L 50y8ozYT2BLX-.v%J(C)t>fN){C^|uY9J@pBUw .4IQI%r+ -!mn*9^'<^Pe ,|  O } O TFm.  #F9>wAfGOcEi;MXvk g  w haG:/7(yI6z,C:q,]@Yz |n}$UebI zl F3*X n ] - 4]x*NyH<jgr5O]b Uw{=,Z Z v| YnW&)G&X 968+X73.%SWeP+ar T(@5 M dn> Z&}9NF`1nDp=q]O&JV\B@^&.\r/  p Ke2 v ; ,IrXE, %L5 5   P ~R=ZL1moHm,R 4 <(r DX rCD N CD "Q4wG5 lu J M; 8EHh1u2}! K  %W,n\4Ueo# }3x 4 Lq6 G-c'ol&+EKj n;v 6!0"c'cGI >YEEZIw4 s z"P($Y#79\ 7 > VIb @ $<# cQxJ`5Z 4 b |dA9BVXO%U"Cw^* ~ 1} { egJ=J<  Fl() K8_GH8~0^ @x{   X ucmTk4 6~qN  bQgTl3 2sd,"RS{J8\ % ~U-_ o.F[4B&RK OAj`0N/|zY*j_ : $81d=b= +>BXAjS (p*:7I! 50 x9%I_r<q2mF>y $ q 6>.BQhdA.P38U1$l2}5_kk112" T 3sh_8:W[&_vjB$" ^,u( iCFO@-9Ln@ hO-*W Ai0B|SO\Ag +@MXUQG=/+M/ =$UK)fD:u/XRqjK~<EW3 r[7T!LA=X: j@&&aSPw`>[-@#!%$N-#8CEa[]1_0`_ms4y] eq Q' , J &FQ, & }ygs&!wBbX-7%k`a_S<[[i'N?>e\;V_4mH$2xfF?HL\T!?N~k0ngZ#gQC"2RSZF -(P 8(C9RG0:-Uirfc-=z(1A $% ?4YthlDr Ilq\'n,GP(`9sL5zRT>90kJG& BOC#ElNx LD@@OE"_]W9~R}>}3EEo-(8s 7z ^m n LGv1=  G[NEk)`D)a.6/'|GtS6. DXqX!u7e<*@T)9z*~#Xbf& "SZ+? l"<PHlM3}b- Nj7;QOX[g2;e {,d(u ,  wfo+$#lKfYuu=_SU_Bj+5H"6?  1 tys(*sJ"arK[M)m0`YUIV35lTn( K A 0->m}Ml@sQJNWiu/#;_81 \  Se[sc`A3pKq7(Mpx~fCN.v[R p00usZ xy F ] N9U>.^|;y;1-)u5; s jpQ7;rI0S! y  1  xdIk;NFR}>-!x"KS?amil{&=H.ote $ % XJN+Ww);84z~Z$ ?a@'ccN ; fN`> ,,> J   A$`t 1&L_*:(xZcu B,Heoy|w. ZV|4k [ : ?~zTWeh  AQBIIR TK<%J| %]jgY *SC` y^ %% E> /\ ( LYLH  qOyp : L4J6p(0dFX+h$>m H [ L/@  LK#Ik}f % /{5(.W@C[<' T(2Q%DE ? 7 D X i#v  c * , eo#@,)[ICb Cp* W dg5y eT:!Pp0w{  NPkC;yh< % 7lbZ3Q6*8Y1=%c@h( n<O]y= :uzl.pjc$P,6z6Wwpc= r S v vc|gLrffTT*7D{g} 8=-~v.Gb%P  *}> hC\Rwk;N?h<S#Qt6 D c 0aK#~IF`(wT }i o  /WO>Vg4RV.tWKj4]zkIM$Hn3 & mV) A!M_,vA/vk=F;t|b3J3 j.Z*yn/_RA^TPj @ L2& H=C^`?/8H !*2 7guG+@\MB\ cHWhv~fz5J9yq@){f.VEN61'JQ[N/"  12KEm?#On2[OqOH(Mrk0a~jf^g/1KTW_{(fI_! DTs$hV5f2-Y {5<Kpc\x?,9s IW`_8}qW ' [&u@ &=Z&\1aX: BURv?e`%[-1kpwohFzIb+H{,OnIL#b HL,EzA Pnk* F*a<yrwr!(.@YLJ|HpS?ait/:wQuVYx|s6LpAjjVHu"f~4EahS4}~vu.s;8.X=z6>7{5Ua`=d98 !8 ABM {N,B`\-5]F 6<^T?O,JM&,?*#VTJN +"CS^5EI:wWs:f_ .t/$,-G 1Sqy %/If>/;5k2O)9X6psIC,1(OTY&U5e3:)Y%' & :$ hi|+]R#H# %MpVvs:@Zz "-E\/],)X Ke5f&%;/h= eL,zZ">[e 6w& ba\XW)_Kbq Ox[96D+QF */L!*V. 0>/!{*2yW=hW^IU7}=#{3?I-Z; $=W_Lj!Q@h]M}4!|B!G1=lL65'HVM^1QfTb5! 3?9*&",%'u!Y=}hCC}E1!;ol5` T ? k BdMmco1b b{2SDD3Uw* I;tQv1&u  7 Q `]r0Z  =z n@2nLGR^]e<wMUfk&N#(%2By"XR%PY Br  Z7vi h X",E.n*I4  qV qu~Nz]Cޖ@N^=""  * zO; |  =9Q X>@Yki qLq W '9 1ua-6'SqcVs83O"$" O4M >/_0 O YL<OI7"i:""``/_)=agV2$=(ulN # # y T a f / `  n08)Nn yGGqVL#< rr 1 @ <)ELyC5Ka(  L g  B    <g_NbUkU<T 2,Lz_r LO4.^j9TI|=b1ur9Ei$ F  p J( =xbs26 C *T'$2b"w*p=WrJbW7q\h,9K Cye 2 p  ~ h' X  W80XII$o!{7'< $mh75Au)V #)I0r$y@<6i 5 `  { 0bYYC7p=u?1B=Ɇ>* [N>uP>>fS->U>(w=ۃc?S ީ^X>0|?>c>TT>,!|>0AY>heW=z^r顀>>*?UQsvy?ƥ?|{WG>Ya-<h?M^?Pd긿B@?ȟ[õwƽ>H<9>T?`D(?$5|aǿWZ@ `?ƿ?v/fW>]>ʤe?k?"P`5`@?>hə3?`v>?\9 ?&Hg+A@3J?T:2$PL? ޾L?z|G?$ISד=M>@#q?Oy?>>!TQY?i.?!A\U-:Z@ L?C@7? }8>$HWˁ?m W?Yn@O7Z?(%`?~As?>ؿ{\̿45!n`L>w?#>w?м/r>d1V?<ܿY7;Oj @=LtOgj?fM>ŧei`>a1{^1`>;]AX>K?vk=E?L <!??2^"N?#mֻmyHо%p0?]us\c> YT>hv>׌׿/z,?nUt-bQ>RKN8?ݽw澦N >Ϛž+,jo?rFbо؏LX'lA>+ ȿ=^ڽ:?zk0zlT0)>oQ/H<7sȜ `>,?|"yhfFPT;¾=>$WF==)?{}(y9Q(} ľ[>ZA6*>#E>;]==?{:?r ˭AL>>>==ýڽ[>?^?{#$9濝R ǿ:!谿#>v>>)?|Z䲵ZxG꾙 >2˽JarC'!?z3m(D<#= x𾂗;<]>L>L?' += 7 ?}Dۊ쿖X<1|B'PL0?|vJC |5=75澔!>m)?z$?}ʰ Axm潷JhC}>R_?=O&=ś> ?~ӳ:`쿘LĿ)RLw2¾,·^J?~ ([ātf? %>2?|U?|o޻aBr; $0 $Wr]>>S=߯=?zJ\ȭ!@((/>>>= >z?y踤nd ɿ-ȿ-=} #?Y?{bt=qտ>l ?U:=?>ic?L'󿏢M2DӾfV+7y>9>0b?.?~Ŀ<[%ͦ2g+w=o@cG?}jfs־ο3 C%ƽ?zjɿ( I fQ;>SZ4T㩽?zȿm\Ra%3mQ>oF>=_n?{+X:.?ye Kw<UsK>x>N"4%1>+Q0K=30?'HCн̧Ku?}cm;P )jẺM>2F=m? [.,>|?|ħ{h{kg̾]>I7o.[뮺c(>?| ` g?0<€>--zW? "w?}%03Ŀ|I>B3p>>"E?{Fݿ"lGXtTNyNw<(ƿ;eᾤ52yYq2?|O k-˿;PaƼ}ӼJ59ӿ#l?z ſÿ;c|c>9Vz!>9 >4׽~?{FG-v5VBZ1{>m>~>&>?>F?xVCT.6 1>@x>>>?;8Ch?x+vq&ߕ ޻m7>>b! =(;;!3?{0!}Y=@w$鈬,=g=vz?}>`qsaο,ɿ nͿ6=1>~q<,Ra?|ZJo.B^3>=p҆>>f|WDO?~vտӾľQs>ko=pͼ<> ۽ }?ֿ{ھ>=A"~ӾrI^ d?z&5U"RbI>2>Ѩ2?[b?{8/A0Ls*j4N9j֐={*>'|?|̄Ul=VΨܞ:VF>_«d>?0?}Kq$sjؾq꡿ ǿrY;l1*?},Ҿ 6"ՠ@O|=g섾~|?| J@2>Q >[?E=KVþ;h >?|; [?kn3}v>^b?! ?>S=bkwT?}SV,aօn= pԑ< Ԅ_½t=r?}2V<ǽ^?jK;o +οD/?}=j˿|׿_#b|>| >6B= >:3/5?| / %B /߰hguq jN•y6?~[ܵ u( ~MX@L>$=cq )>t_ ?}vyrX==ȩ? OM=pߍX=#=<)?}۝ȿW鿓UrQC9"nXX??}bFPYUjھeXFk?|j[f&Z/&$tjG—{?>-??yT]r=ӿ#~:61w>K ?J=հվ ?v趍B^_s-ݼP/(\8>>?zr =Už>jHG%3>H>4?zWcq࿞2;΍*<5XW><?x fEY⣾ 5>?>I}pUܿ2ݾ=#=i=Ov?zVѿv^:g཯&+=y疾8Ec=($=(M?|`hnubʿj]B$孾f2>gXj;L>ν !j?}-fe'C9쒿 z2_Ϡ&->wuA1>)F?~ؿiQVLHCoZ><;A>%?|A'V>l Ttʽ;{>邒>v?{WF1k&R9'K,DH\|Jp>܂A3A?yՀV2#Nb]#=-c=M4m?m~>8?yEg괿ƾ] 茶^`!>o==>jS>>R>.n?y#c䋪։HSxb>>?ܹ?Q=?ypDܿd 뺿|[e۽ɻ~D1R?zE@Fo疿5f>w+<>ۼ$?yf4DԿ3q> rW>Ll>[^ ɳq.?{@yc00LW<l =N>>m>[:=@Jc?k?zFэP>Ikd',U?> D?<>ٙ=?z3زɿ_(p=P;oH y>}?yuRп2>߾=K>y~>fJ>>=?x|6ܿꁿ $J>{G>Z p>A&\<h5 A ?yQڗ?fv"dE +NK; Q/ 3?x젿$#l[Kd Q=>>>\%?}OĿ6ɿQ(b ir Y&:` <>q%=nP?|Xx^?*mįhShb@jxܽܭ=?{Ot6')࿛w[=gkWS\ܿz4<=If?y&*ƿ\=0e]zUn=%_4X?|Uv3kܿI6{>!2?3>d>C>1qH?|`W/xϦ2'j2>5սA,=?~][־_> :>)szii>8̠FɽuIU=?~91o\nw[>=C= =:?~Ki<,HG{w6=*ڽKj?TJ=ŴIOJ?}JCkK3=c?]>!Dá>@T{>׾5)?yJޖTzzճg=P> >!f}`?zG؋]Ytc* >-#&@Jle?{@nO*HDܚjXZi@rQʾ՝>7>?{=J Nfm>znΕ%3`Ǿܚ>ʘ>u=?|=庋 ͮß#/c$)>>ieٽ>W.>?~@!׿ ;l0]tbҾ5eܾ?~45F pXϿ&2C" q׾LB)?~3eο/iyV8Ѿ-gW{R=fC>e<H?~D]Ѭ>e۾8UBǾZew>]&>!}?|i*z;RbMJƃ׾=H?Q>>ψ?{< ] AҾ7M޾ =׷=G=XCg?{Mnw^jE+qu.Y=$#ǽ>%"$ !2?| Gοɠٿ&^  ?|`3ξPio!`1ud=>{䨾6߿80'H?|B`dM?LOп1#StͿEͽCm= >(Sz>KR(?}3+=r3eFql ? HQ=u+>z1>ab?d¿%꿏8w wv`VI-=0N-?~:Ěȿ9BK(fٿ>2=+&$-E??r}즿QͱJJAm{>i>Sý?tgXھdhHW4?4CFc,_b1>q>BX?sP UJb@H>ەf;E~޾.y޸ ?7?u~R[F! t=T>ŏ> $:?N?vMؗuGD>9ۿ$B%<0=CSx> щ=$?uǠqTV+cOŢ>4ҿ؆erþ.6>]>w?v%0=߽ZB>.9&9ɾCEE,n]Sx?zV{`ѿ=_Lʟ̾TW..07w>*?~%ޗpMK;>v)ƛ x j?zjUXe>Yy=ɼ%d?5Jľc?{ɦK(~f?-h j=U>>?)ow ,V<&.?}t@?ǾcFK>?N4 qD,>AN?~M@1r+ @c)%>'&3׾#>j?| RVɿ?@>yݾ4o >j>GLm>B?zچ>p %JjhY=>F<ͷ>Z>v>.?yw %JLSҾ?>)>?kt>>Nf`n?{ j]U1Pr5>':h!Կ!^1?xM~81S%Eپ ;!>5)?xzBWEGso+8b_kg+d?xӚk}0BGӿ+>>> \uz?yϸؿ`h־$+#>n%>^k6'>%?|& }ve>{>=>̌V>>S'PVdkD?}Trп)~x˾}WǾE>l`*P?|g:P[YQŽlRYKgZgyWA>L?NQ?y2AEƾ"CȿQ Bz=Z"i= ]>U?vf}+ӿml0Ξ@# ۼMl"v}?|zjroU[f+Se=aeMP="K?{W&Er/=1Ab| ^FϿkwu@w;_P^4=m?o>=ۏr?k<*C4r>c;:mZ>@?I}>ZlB?/ǭT cJL ԾJ :9?Eཿ0_>x)zٿ:nd ?Hjy:c> "Y>P-?I0`G?J柽os_`ycryRu^6>Y]?H-='R?7=_Cs|翽>b:>?O?H^*1>s'kֿqwhƿ?i_ ?Ft0ӿI >EP嬿VFYe߿I<]X?H߶_KYe?,WVf5T#:!>3\?I)=~ᯗ?[\CY6Tο{-߿);3]?G=EO?>ľ 5pԿ*MnM?H!¥>wPk"VhaBʾ_i?Hc>?# Ii~6X_<=QrB?HG=q!ݭ?g|asw=R{kS-w> ?G>U2?OYc|AMÞRPIܽ?Ei%뿒9~>qܼM㿠 e3ÿ8q̾|D<;?Hlۿa>㟽%_M+׿T J$+ݾw=m+?I%3Ʉ?F车oac v>P¶?H>{b3?m+=95WCjY餾7<8D>E?KZ!=G ?l%T.˿B.2ܜp??*h?K<>3ؗn#?fBF>4ԾT?+ ?20?G>9HP$Sg?r*.zdXXk>܏l?&H?H,~ ?N8bǿ,͕ *\ݾް>T0?!Q?HٳYw?q))^ȿXU6Qx²7>?9l?H=\HJ?]BB#'Gnj??ML?H`>wʿ{{?qP6s:;=9Uh>???F<5Ϣم?"*?H̠@/ν ?vBȾhZ̿ba>@'ZQqؾ >)?-.^?E-=_+}3?i܇l1Prr;G(?"?1H?G>zT)Uw?lltп\ۿ9}[a?+]?(Ղ?G*>EDdҦR^ ?w3tlupj+>??HӼ\ۼ0?s]<ȿQ~ľp{?>ځY?]?H`_ ׿ ?p(X2rw1+%qlӧ??&k?H#>A s?d((!k Cu۾?/`?7??BV$D,>M?tzK%Iȹf_,¿^U=[r>?6Jspeech_tools/lib/example_data/alice0000644000076400007640000005515307262605664016101 0ustar awbawb ALICE'S ADVENTURES IN WONDERLAND Lewis Carroll THE MILLENNIUM FULCRUM EDITION 2.9 CHAPTER I Down the Rabbit-Hole Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?' So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT- POCKET, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge. In another moment down went Alice after it, never once considering how in the world she was to get out again. The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down, so suddenly that Alice had not a moment to think about stopping herself before she found herself falling down a very deep well. Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled `ORANGE MARMALADE', but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it. `Well!' thought Alice to herself, `after such a fall as this, I shall think nothing of tumbling down stairs! How brave they'll all think me at home! Why, I wouldn't say anything about it, even if I fell off the top of the house!' (Which was very likely true.) Down, down, down. Would the fall NEVER come to an end! `I wonder how many miles I've fallen by this time?' she said aloud. `I must be getting somewhere near the centre of the earth. Let me see: that would be four thousand miles down, I think--' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a VERY good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) `--yes, that's about the right distance--but then I wonder what Latitude or Longitude I've got to?' (Alice had no idea what Latitude was, or Longitude either, but thought they were nice grand words to say.) Presently she began again. `I wonder if I shall fall right THROUGH the earth! How funny it'll seem to come out among the people that walk with their heads downward! The Antipathies, I think--' (she was rather glad there WAS no one listening, this time, as it didn't sound at all the right word) `--but I shall have to ask them what the name of the country is, you know. Please, Ma'am, is this New Zealand or Australia?' (and she tried to curtsey as she spoke--fancy CURTSEYING as you're falling through the air! Do you think you could manage it?) `And what an ignorant little girl she'll think me for asking! No, it'll never do to ask: perhaps I shall see it written up somewhere.' Down, down, down. There was nothing else to do, so Alice soon began talking again. `Dinah'll miss me very much to-night, I should think!' (Dinah was the cat.) `I hope they'll remember her saucer of milk at tea-time. Dinah my dear! I wish you were down here with me! There are no mice in the air, I'm afraid, but you might catch a bat, and that's very like a mouse, you know. But do cats eat bats, I wonder?' And here Alice began to get rather sleepy, and went on saying to herself, in a dreamy sort of way, `Do cats eat bats? Do cats eat bats?' and sometimes, `Do bats eat cats?' for, you see, as she couldn't answer either question, it didn't much matter which way she put it. She felt that she was dozing off, and had just begun to dream that she was walking hand in hand with Dinah, and saying to her very earnestly, `Now, Dinah, tell me the truth: did you ever eat a bat?' when suddenly, thump! thump! down she came upon a heap of sticks and dry leaves, and the fall was over. Alice was not a bit hurt, and she jumped up on to her feet in a moment: she looked up, but it was all dark overhead; before her was another long passage, and the White Rabbit was still in sight, hurrying down it. There was not a moment to be lost: away went Alice like the wind, and was just in time to hear it say, as it turned a corner, `Oh my ears and whiskers, how late it's getting!' She was close behind it when she turned the corner, but the Rabbit was no longer to be seen: she found herself in a long, low hall, which was lit up by a row of lamps hanging from the roof. There were doors all round the hall, but they were all locked; and when Alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again. Suddenly she came upon a little three-legged table, all made of solid glass; there was nothing on it except a tiny golden key, and Alice's first thought was that it might belong to one of the doors of the hall; but, alas! either the locks were too large, or the key was too small, but at any rate it would not open any of them. However, on the second time round, she came upon a low curtain she had not noticed before, and behind it was a little door about fifteen inches high: she tried the little golden key in the lock, and to her great delight it fitted! Alice opened the door and found that it led into a small passage, not much larger than a rat-hole: she knelt down and looked along the passage into the loveliest garden you ever saw. How she longed to get out of that dark hall, and wander about among those beds of bright flowers and those cool fountains, but she could not even get her head though the doorway; `and even if my head would go through,' thought poor Alice, `it would be of very little use without my shoulders. Oh, how I wish I could shut up like a telescope! I think I could, if I only know how to begin.' For, you see, so many out-of-the-way things had happened lately, that Alice had begun to think that very few things indeed were really impossible. There seemed to be no use in waiting by the little door, so she went back to the table, half hoping she might find another key on it, or at any rate a book of rules for shutting people up like telescopes: this time she found a little bottle on it, (`which certainly was not here before,' said Alice,) and round the neck of the bottle was a paper label, with the words `DRINK ME' beautifully printed on it in large letters. It was all very well to say `Drink me,' but the wise little Alice was not going to do THAT in a hurry. `No, I'll look first,' she said, `and see whether it's marked "poison" or not'; for she had read several nice little histories about children who had got burnt, and eaten up by wild beasts and other unpleasant things, all because they WOULD not remember the simple rules their friends had taught them: such as, that a red-hot poker will burn you if you hold it too long; and that if you cut your finger VERY deeply with a knife, it usually bleeds; and she had never forgotten that, if you drink much from a bottle marked `poison,' it is almost certain to disagree with you, sooner or later. However, this bottle was NOT marked `poison,' so Alice ventured to taste it, and finding it very nice, (it had, in fact, a sort of mixed flavour of cherry-tart, custard, pine-apple, roast turkey, toffee, and hot buttered toast,) she very soon finished it off. * * * * * * * * * * * * * * * * * * * * `What a curious feeling!' said Alice; `I must be shutting up like a telescope.' And so it was indeed: she was now only ten inches high, and her face brightened up at the thought that she was now the right size for going though the little door into that lovely garden. First, however, she waited for a few minutes to see if she was going to shrink any further: she felt a little nervous about this; `for it might end, you know,' said Alice to herself, `in my going out altogether, like a candle. I wonder what I should be like then?' And she tried to fancy what the flame of a candle is like after the candle is blown out, for she could not remember ever having seen such a thing. After a while, finding that nothing more happened, she decided on going into the garden at once; but, alas for poor Alice! when she got to the door, she found he had forgotten the little golden key, and when she went back to the table for it, she found she could not possibly reach it: she could see it quite plainly through the glass, and she tried her best to climb up one of the legs of the table, but it was too slippery; and when she had tired herself out with trying, the poor little thing sat down and cried. `Come, there's no use in crying like that!' said Alice to herself, rather sharply; `I advise you to leave off this minute!' She generally gave herself very good advice, (though she very seldom followed it), and sometimes she scolded herself so severely as to bring tears into her eyes; and once she remembered trying to box her own ears for having cheated herself in a game of croquet she was playing against herself, for this curious child was very fond of pretending to be two people. `But it's no use now,' thought poor Alice, `to pretend to be two people! Why, there's hardly enough of me left to make ONE respectable person!' Soon her eye fell on a little glass box that was lying under the table: she opened it, and found in it a very small cake, on which the words `EAT ME' were beautifully marked in currants. `Well, I'll eat it,' said Alice, `and if it makes me grow larger, I can reach the key; and if it makes me grow smaller, I can creep under the door; so either way I'll get into the garden, and I don't care which happens!' She ate a little bit, and said anxiously to herself, `Which way? Which way?', holding her hand on the top of her head to feel which way it was growing, and she was quite surprised to find that she remained the same size: to be sure, this generally happens when one eats cake, but Alice had got so much into the way of expecting nothing but out-of-the-way things to happen, that it seemed quite dull and stupid for life to go on in the common way. So she set to work, and very soon finished off the cake. * * * * * * * * * * * * * * * * * * * * CHAPTER II The Pool of Tears `Curiouser and curiouser!' cried Alice (she was so much surprised, that for the moment she quite forgot how to speak good English); `now I'm opening out like the largest telescope that ever was! Good-bye, feet!' (for when she looked down at her feet, they seemed to be almost out of sight, they were getting so far off). `Oh, my poor little feet, I wonder who will put on your shoes and stockings for you now, dears? I'm sure _I_ shan't be able! I shall be a great deal too far off to trouble myself about you: you must manage the best way you can; --but I must be kind to them,' thought Alice, `or perhaps they won't walk the way I want to go! Let me see: I'll give them a new pair of boots every Christmas.' And she went on planning to herself how she would manage it. `They must go by the carrier,' she thought; `and how funny it'll seem, sending presents to one's own feet! And how odd the directions will look! ALICE'S RIGHT FOOT, ESQ. HEARTHRUG, NEAR THE FENDER, (WITH ALICE'S LOVE). Oh dear, what nonsense I'm talking!' Just then her head struck against the roof of the hall: in fact she was now more than nine feet high, and she at once took up the little golden key and hurried off to the garden door. Poor Alice! It was as much as she could do, lying down on one side, to look through into the garden with one eye; but to get through was more hopeless than ever: she sat down and began to cry again. `You ought to be ashamed of yourself,' said Alice, `a great girl like you,' (she might well say this), `to go on crying in this way! Stop this moment, I tell you!' But she went on all the same, shedding gallons of tears, until there was a large pool all round her, about four inches deep and reaching half down the hall. After a time she heard a little pattering of feet in the distance, and she hastily dried her eyes to see what was coming. It was the White Rabbit returning, splendidly dressed, with a pair of white kid gloves in one hand and a large fan in the other: he came trotting along in a great hurry, muttering to himself as he came, `Oh! the Duchess, the Duchess! Oh! won't she be savage if I've kept her waiting!' Alice felt so desperate that she was ready to ask help of any one; so, when the Rabbit came near her, she began, in a low, timid voice, `If you please, sir--' The Rabbit started violently, dropped the white kid gloves and the fan, and skurried away into the darkness as hard as he could go. Alice took up the fan and gloves, and, as the hall was very hot, she kept fanning herself all the time she went on talking: `Dear, dear! How queer everything is to-day! And yesterday things went on just as usual. I wonder if I've been changed in the night? Let me think: was I the same when I got up this morning? I almost think I can remember feeling a little different. But if I'm not the same, the next question is, Who in the world am I? Ah, THAT'S the great puzzle!' And she began thinking over all the children she knew that were of the same age as herself, to see if she could have been changed for any of them. `I'm sure I'm not Ada,' she said, `for her hair goes in such long ringlets, and mine doesn't go in ringlets at all; and I'm sure I can't be Mabel, for I know all sorts of things, and she, oh! she knows such a very little! Besides, SHE'S she, and I'm I, and--oh dear, how puzzling it all is! I'll try if I know all the things I used to know. Let me see: four times five is twelve, and four times six is thirteen, and four times seven is--oh dear! I shall never get to twenty at that rate! However, the Multiplication Table doesn't signify: let's try Geography. London is the capital of Paris, and Paris is the capital of Rome, and Rome--no, THAT'S all wrong, I'm certain! I must have been changed for Mabel! I'll try and say "How doth the little--"' and she crossed her hands on her lap as if she were saying lessons, and began to repeat it, but her voice sounded hoarse and strange, and the words did not come the same as they used to do:-- `How doth the little crocodile Improve his shining tail, And pour the waters of the Nile On every golden scale! `How cheerfully he seems to grin, How neatly spread his claws, And welcome little fishes in With gently smiling jaws!' `I'm sure those are not the right words,' said poor Alice, and her eyes filled with tears again as she went on, `I must be Mabel after all, and I shall have to go and live in that poky little house, and have next to no toys to play with, and oh! ever so many lessons to learn! No, I've made up my mind about it; if I'm Mabel, I'll stay down here! It'll be no use their putting their heads down and saying "Come up again, dear!" I shall only look up and say "Who am I then? Tell me that first, and then, if I like being that person, I'll come up: if not, I'll stay down here till I'm somebody else"--but, oh dear!' cried Alice, with a sudden burst of tears, `I do wish they WOULD put their heads down! I am so VERY tired of being all alone here!' As she said this she looked down at her hands, and was surprised to see that she had put on one of the Rabbit's little white kid gloves while she was talking. `How CAN I have done that?' she thought. `I must be growing small again.' She got up and went to the table to measure herself by it, and found that, as nearly as she could guess, she was now about two feet high, and was going on shrinking rapidly: she soon found out that the cause of this was the fan she was holding, and she dropped it hastily, just in time to avoid shrinking away altogether. `That WAS a narrow escape!' said Alice, a good deal frightened at the sudden change, but very glad to find herself still in existence; `and now for the garden!' and she ran with all speed back to the little door: but, alas! the little door was shut again, and the little golden key was lying on the glass table as before, `and things are worse than ever,' thought the poor child, `for I never was so small as this before, never! And I declare it's too bad, that it is!' As she said these words her foot slipped, and in another moment, splash! she was up to her chin in salt water. He first idea was that she had somehow fallen into the sea, `and in that case I can go back by railway,' she said to herself. (Alice had been to the seaside once in her life, and had come to the general conclusion, that wherever you go to on the English coast you find a number of bathing machines in the sea, some children digging in the sand with wooden spades, then a row of lodging houses, and behind them a railway station.) However, she soon made out that she was in the pool of tears which she had wept when she was nine feet high. `I wish I hadn't cried so much!' said Alice, as she swam about, trying to find her way out. `I shall be punished for it now, I suppose, by being drowned in my own tears! That WILL be a queer thing, to be sure! However, everything is queer to-day.' Just then she heard something splashing about in the pool a little way off, and she swam nearer to make out what it was: at first she thought it must be a walrus or hippopotamus, but then she remembered how small she was now, and she soon made out that it was only a mouse that had slipped in like herself. `Would it be of any use, now,' thought Alice, `to speak to this mouse? Everything is so out-of-the-way down here, that I should think very likely it can talk: at any rate, there's no harm in trying.' So she began: `O Mouse, do you know the way out of this pool? I am very tired of swimming about here, O Mouse!' (Alice thought this must be the right way of speaking to a mouse: she had never done such a thing before, but she remembered having seen in her brother's Latin Grammar, `A mouse--of a mouse--to a mouse--a mouse--O mouse!' The Mouse looked at her rather inquisitively, and seemed to her to wink with one of its little eyes, but it said nothing. `Perhaps it doesn't understand English,' thought Alice; `I daresay it's a French mouse, come over with William the Conqueror.' (For, with all her knowledge of history, Alice had no very clear notion how long ago anything had happened.) So she began again: `Ou est ma chatte?' which was the first sentence in her French lesson-book. The Mouse gave a sudden leap out of the water, and seemed to quiver all over with fright. `Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt the poor animal's feelings. `I quite forgot you didn't like cats.' `Not like cats!' cried the Mouse, in a shrill, passionate voice. `Would YOU like cats if you were me?' `Well, perhaps not,' said Alice in a soothing tone: `don't be angry about it. And yet I wish I could show you our cat Dinah: I think you'd take a fancy to cats if you could only see her. She is such a dear quiet thing,' Alice went on, half to herself, as she swam lazily about in the pool, `and she sits purring so nicely by the fire, licking her paws and washing her face--and she is such a nice soft thing to nurse--and she's such a capital one for catching mice--oh, I beg your pardon!' cried Alice again, for this time the Mouse was bristling all over, and she felt certain it must be really offended. `We won't talk about her any more if you'd rather not.' `We indeed!' cried the Mouse, who was trembling down to the end of his tail. `As if I would talk on such a subject! Our family always HATED cats: nasty, low, vulgar things! Don't let me hear the name again!' `I won't indeed!' said Alice, in a great hurry to change the subject of conversation. `Are you--are you fond--of--of dogs?' The Mouse did not answer, so Alice went on eagerly: `There is such a nice little dog near our house I should like to show you! A little bright-eyed terrier, you know, with oh, such long curly brown hair! And it'll fetch things when you throw them, and it'll sit up and beg for its dinner, and all sorts of things--I can't remember half of them--and it belongs to a farmer, you know, and he says it's so useful, it's worth a hundred pounds! He says it kills all the rats and--oh dear!' cried Alice in a sorrowful tone, `I'm afraid I've offended it again!' For the Mouse was swimming away from her as hard as it could go, and making quite a commotion in the pool as it went. So she called softly after it, `Mouse dear! Do come back again, and we won't talk about cats or dogs either, if you don't like them!' When the Mouse heard this, it turned round and swam slowly back to her: its face was quite pale (with passion, Alice thought), and it said in a low trembling voice, `Let us get to the shore, and then I'll tell you my history, and you'll understand why it is I hate cats and dogs.' It was high time to go, for the pool was getting quite crowded with the birds and animals that had fallen into it: there were a Duck and a Dodo, a Lory and an Eaglet, and several other curious creatures. Alice led the way, and the whole party swam to the shore. speech_tools/lib/example_data/options.file0000644000076400007640000000007507262605664017426 0ustar awbawbCountry Scotland Street South Bridge Number 80 Height 23.45 speech_tools/lib/example_data/colours.map0000644000076400007640000000013407262605664017253 0ustar awbawbquote=" unknown=666 number=2 =2 "loaded blue" blue "sky blue" =1 "loaded red" red "postbox" speech_tools/lib/example_data/colours_translation.map0000644000076400007640000000012507262605664021671 0ustar awbawbquote=" unknown=666 number=2 "blue" "loaded azul" piscina "red" "loaded rojo" sangre speech_tools/lib/example_data/channel_names.map0000644000076400007640000000006707262605664020365 0ustar awbawbquote=" unknown=0 number=2 "Power" E "Coefficient0" c1 speech_tools/lib/example_data/kdt_001.wav0000644000076400007640000033564207262605664016766 0ustar awbawbNIST_1A 1024 channel_count -i 1 sample_count -i 56273 sample_rate -i 16000 sample_coding -s3 pcm sample_n_bytes -i 2 sample_byte_format -s2 10 end_head         ! %6-    !0"   $,.'"&$%  &"  "     ! $("'/+"      "!    %  "      &( "    $     ' !      +)%!    '& "%  "2%  '%$.$ !#'         $         '%  ((      '74.12     # )8'"  03$ )93.)#  /- $ )0$'%     $       %    " %!    !254( % "0+!>3+'!($&'31*<5-! "(! ,2"    -<  67'$ 4( )"""  !0/!"*  %!#')+8CDJF8/  "! );=)!!   !*0   !%"   . &       1M>)   -D7 %73,7<2%%083*(!'+25+*+>G4)  %52$ 4AB?5/3;@4%,BSJ."0*!,-"&'50)&*;<01>:#-) *. (89:863,/=, '' #6-"(''52#&(&:3(&.146<G=&%+-9F=.%,89AE2! !"5<-0E: "0H87C8+,=G<2,/0&&($-+ "%#%#*-+!"'#)( !'##'&/7- )569834B@8.+&' ,/," !($!# ! !! 3:) $&! &     *"       !'          &    (#  %%%5DC?860/0%!3:0/80( " &$   **$ -62%)459:/%,-+'! &,##/87,(6AGQRG3&'-,)'%!&  -'$/-""(0/%%)(--",773.+'"+)  '$#)+&'+-/0*,7932*(0- '30,,&!-7</' $,&"% #""$)3*1AB=1*+' (  $.!-2*(""+,,202* !! !"   *+  %)" %$ %   %#"                                                                                                              "$   "$/&  65*-.,=H@%>?-.]C 6K5#3 ix&==VR. s$Y Q</jZ/iQ6{X>g:l1$ I7 HaTc3E[ /X]FVFzrL`A9%T#)E/x|;K=!C6qU: =@DPzeal*t p ])/(a>o}Lz;`aR@K4=|]FuF2> S@B9k!7Sp8MKcT] c+qb- @3| q.R!79=lz"Otf~-~9zAh zu+=$*g7&9, 5<!<@3(=hYu%L  ~5hE\C27%^(JythtBg|L,)LKfH/u1{ r H7 \TH)sxDUmmh. Bw Z6)TJC`/x-1d':l#8qP4~n71\d-|vBQJ:8'z4eON>|'$sISL 4z%9%+;_Ov6n?^AR$C~$ \ a|;4Mlj!J'.3C}V2xm I.7 r>[/bncA:D$\[6Eg|j1I(46I$]4hbS7/^b 4brcbh*{Gs1\u.g+ 1$gD` Sff0'd8wg6wD:\?R{3n:,~Adp[ey}FgMyuK2r0E_ZNr3:,,Rk!,HidK J\1)8[2 Y>i"Mbc9Ql MGvQ 7g]?/i ~ -;q-we Yh :P7IvJX! C5/\No;|p8`[k /JCBUOT6AX 0!u9 HWE=2|`Q^|.) 5Z`jyxykz:3hXjRu_'g!$%O5Ne0ON)d7u5RFz?ov(BskZo[nyGOH?tab zQEer%XXWv!%Ff~? ]FL &~E7j7T]#"1%\t.`A/^ja?|h`dSjBLndN$]ww^ G   9\WgL>b`G! gOE q l  A &[kQ mVC Ug!FaesL  seI>it?BC9)D59P@LoDgLCNfVc=d5 /   T  b 6 Jzf'?KK@D C y  3 >~zE;lHtvt!4f/MQ-l7356 GId- R O R i   5  /y BW>kE> TE(2o{ ,x9z8n15[B IcKe=KT;k{Q<\'(.\p?#wV<;MX(e@v4xaT,6q5ne9uROwbqZNiC\aks,EER$ \w 3-Of_b/T u2s9I5P 1]Jhc$76}i|j^^$[2e3H\W=KeaNyA27 >AU`9]--7   a7#ip]>^m=:+g5}nZ(hZ"be*Lo}scTvtu#gDGikE | N |  G B/szaR^'4 xpW@R%cyJ?8 ".dxwg@K&IoelOBNu,_#x* O/ S(!)"w/ Oh ' -sgYE%7w )I'^.,j"c1psGe[B vLuMJr!H3 @;]9bK.a ?  D~,uKqbFm&[>%ei!(]Xw; 1%_MX i"N  "ݫ=q&W# yzB}_GTE  = , 3 bOwna;`Uj 'u#" -zVFuf<B$,< Z B qP_P(^WC K=PVjc73-X 2t+6{+!FUB&.{!5y + c4%~,\nH - #n q .z;DO$h   z j U{v}Cl-R:U{gJox|X]J OB- qQ* ;-~v4O 1Y^Fd :K/ V Et X1UJica= 6KZ:R)Bu KtHDR5x~TolikQ/]; 6mBpSsP<qg  ; ^}fO93C_JEFSR%0]AVWh!NO}x*l:ac=}ti)X B&(L69\X4g3dc' iG zmi!tZ\?sP_?x C^]5*A=O? 15X i5)WCeK8Pdbh `W(VmeX|/)4dT?ePB\He n)(]>_~AA<P5wuY +yPwL9`D"( 4 7-;Eb lQNe2BBU B?Y?5R }Q(`HqmUIbDB`$E/^ b=j/ _[t2SA2q@HgH _R7)T \w l& 8 *Jl/")H{~FX3Boi.r]g [jJVG nJ2_`"j C[Z{E<&8QU  xS1LJ+ {IVH`rtDLIpbftzVa7aS2059>=T,'Ua^7b{qWG<C:,j%zfBD-AQ`hMW* QP#3]T]'.kth00<-lhg[jWnVPrS&HsB_ZGxzZPcV3QY$Ta$f+E6M T@z2+\*RnHD&9RT9t4Z_BqL4f#aZ{Ale1AdAt/ :|)}v+oNi$DgBlkITs /.338% 9LL~MoJAZb&ojv`k2HK_gP]p DOMH! ow=DEs+1ZTw(H]^ $tN-KQtsUA?@>}4v9~^k!|2J\(W*E~5(~{Hl-xe64/zuYi],  ,  M a Ll}n:_nrab8}A/}Lv{k43i/:Cav`8Z$d}5<m)y<#;?#?IUp Q WhZs> ' 7O  l ? sRbi:&sl_3U# ~ ,uWzWq+2TdZ@, 5r\v /Bue |Kn1^.w&~ 6#H}M* j 1 4YB/5( L ^ S d hhvO,=UeAaLSSQ ^&0)XbF`SmR<D+xLf,kCI 4 2 d9 yl_lS3` J;q*1KEV e ) s Y \ ? )wCc,F I18je0j h K  {q"D|j1DMK58e5.S:;[~  , J ?j e=A2<{-AfQ;OB pz|UCAThdH#'187/( zcP@90! #%'&)'$,18;;@BKRU^gp}'3CP\jw}vk\H2)*+!   ~rqmqwroghb`b`YQNKOPOIHHFIMQVXZcmuz $+.38:@GNTW_dfkmpqqwyxyyvrrqnkhge`^_YWZXVVXWWUTVTPPKHD>822&   $(+0,/0,.-,))((' "#&+,245ACPXew~Vnk kRdg2+h%/#nQX'ip.|5tLQ&+ y>xtA+kuK+\S i]9n:) (KPPA!>!JtD)i_'!:-]^D(0F0nc e _ q /WAN{fsyUZ) ; t ,'KZId,w IOA+/)[#2^ O01A9O` .? : 6X g}?^@Oc//[ ?M ]\+mmWObjlEZ31sB+ yK<o eX   SfFUypvd]J IWp'@ G$Fcq &t 9jg^T4I{5tO[0s??|ary&R k $!j MB  l0w_#R j_E}{1c (?gVnOK b v b:j  \MGHL|P!+L$4}Ooq5QB;,}(&&%(%\a > 4 +8ZP޼5i(X e\j { xEs+o%, > Fh@5UVos!TR\i%g~FrTi u{*1'!)"'D&N!1cI>zs3$U6}   Z uUkz Of  iOno5`XKx=2Rot>{d[,4'NgN hXY",]'"$R&%c ݄݌)9a ;$y " jMind#Bd p  En E\ X4@p,]  :/K15P3/^uM&*(a'(&!v DNgr*  e b68 f F (Q(^Vl& ! z .bEGtJMC)g8>8 JQ3 M?w$dS=,N.-*4( '4#P ?ڴT>Cw,ZK R 2 kZ s]Ka+O{ ( [7 f @ Z-7&0 Y%=[@r%5|C@'.-*)("k dO vm2 jf2  t b Ff[_Nkh d sVN ]BxH'tMxrmm0FlZQZa]"(l.,)c%in q@co2@uOBNa; '& R_ szG {%P4 .& j Jy\AS"Y`  "fZ=O5ZFgl*%))#'# q,N] RZ4   hwb EW.ccgI c3 k>L;O O<EeJ>vmT *{ 'x'$B `  a4\<-mk9y# H{7= |"u,gi+>SI   3'KTJ[c_ei ET2f $%!-3~ h G/ZhKEIO  _. BoeH,D7w<3 rusKlMw=>$sa '0 =  !de au[; .l/) YQ =%mX~avknP "d ` I<~++t/LR4I|P \ 1H; z{ om\KDB{5& jSo3|;/NP+U CdBP~nU](WULRDTOvT 0HB $vK XpAW'~4HZ[ &Cf\M0%mX-R XtT/9hT$!RI[E? YK Y k 9 8VjbF51VD+m1`?<N`LpBS)9$i +AE? viAB"9H2' 3D  @ ? i~;\M>jqw mtn2Vg[scXt p" W]0U+iT'Zr?!yujTf |[%1,{&4Vb~ %Hq_ 1]eFAkw7R\Z[S5~k\JFQ^jkgW?.1|J`;b#  #@]Z-3dT\q+|~ '8@NZ`_bz~vk[E)"+4=KTQQYVH=3&  "!,3:?FQV_elru|{||vrg\YRHEBA@<<;=DFFJPTRW]_a`_TQKB?7/%#%,4=ALTW^ekorooi^[SKC91)  "%$!#      O'y2 <7vb1LP',@!   |:=5*/4;Jb{mdJ"]Z 3 7^]G_2\|<"ub5u1xFcO A6Fnru)Jd7ll;v$/xx>x MOs<6IUvP8>$xz9AS97Z*[`6Gw p4]:.27Gvz#CbN )iD[lB,QS!Ym HHca. Y|gnX]+D8&,<9L<<v l5>?JCxcOIP3W>a&*% qG!VXE]?Q';UPvg %7?1?D'T]^H%  v]$5,fiU 8o+KN VB! ^[V6V;%@u'n dt3nPT^Eb]dBRK/n >V,w\P2 6mH-8JTP2  [_tN$ /T ='CmL+s\pZ(Dg*q}N,=)<SwJJ#,3 em|n,vFi[_eb N(*A0dgZh 8IS.f]Gid/,0i 6ZunQ4 .'El/mq5wc}3raI.Si ,B/"/VVgBS[L=JP:2)*r8{ C*+c99)G7:,^pFr9pZ4nMzP5NA'2gF-q.|^_=GjX[NY%l3I9AKrDohG ..5\/=FwV#Kr7d k5nxPA^xy ~{w_uyh;fA4&{uMlSf|8 3Mu0cIW{]bF[?~Jf#J+X xB%IN|M'rS/ftkLKxm9+._\_-T!.T|/eD66& bgAn M0 GwbXLz \BsN_Q JBday[Qns9&`"^Fde4%RH!=D4|dCv+z` DUZF1v#.zjp6P'-4bEy;`h&gX,hZhd8ljVqFEQ&53yt8qJR|_'>Rk57Rm*{8 77rX2mq.7- v&r0 PV]TC>uftQC %VCI Q8kCh9Sft7d 8#)H$N^"ozNAse]jZOk[.9TXS:SpbrLU@s}cv>sZY_,=xeC<4 g\]9D'Pu bwRYE5K)Zo74<%! ]jr>GqDa{7C= }SeVJ qL@}nN7N=>S2B=H,LwY}yyZ?PocF(&E/pm3< )6&E"xMAkVYvF>?9.I,4}v%_[53!e2YGJ8_yb<.>` rQ3x;7u[1Ei*Lc7^" `qaMxE_l.=>i(Kgo/o8wfv mr}GYMtL_Tzur-iRdP' ?)2UA@4?Na`4"`-aWOYeTMo{Q-@h+#8eV{_SM  Lf 2  Ld R(-h<hK  W t ]0v W l cvjJt3l6GfB`zGEny  7 yL <kq* !9{X XcHefIDq 5 cK?O r WP-6>)A'#,AeF?D .iA fp J  '7gVPwu8@ XyEi Vu6 Z ) [  HE]>Pk+uHN8" f+.\F @ i; h -d3 -BJDpcK  i  O=  ! l' J"CC18a7 c c " aK  U ' *. | 9Q3`8 a P  i ! c2T ~"A[GUhA-2 [4 B _Iua_ C:bP 1)0S7xL`T4x$G V r o l # !@U38IDU#mr4]h  +   I*u:Sg3 d*jc4#F p.Hb   o  , 3dl,+/06~GCGu}hp*( Q 17 2 ( hn)tJn Z)2=_  5: /A  } QbXplrB '=Z9!%SOK^ y($7@@Z5 % j \ *4ia hfl@#!~d 8^^5E c : N{_1G3H} 0+w]3)f.W,~ ~n  ? N % _; $IC6gEP/lX=F>l  l a 2fUSQs_TT=FZ%5#44JIwe)} B0_wH " ^@ alF`~=V K@EQ!aJ' 9 ) 8  O a q6l^'}~Qn4l3A{j ($%Yj e !S0 c, P  )% 59 Nd^ wE~So?;g< / b P 4 i*M31 wsg wIvc$O^TIa"+5`[_r w q # h  ~,s<wL $F~5W>V q % S ; P"H) Tfh GNA4ClQ Jd!7! j&6+w&q:i  `t]' N2  .P) K6x*! ]C/ q + Q _FI9pMyxi_c!:#@v-9-P LL (B S11 Pw_ | U  \q@6}*0(8r2'FK?: H M uDLpTp,|YC> hS hp\SYM)A\!gzQDdt# a&! j 0)= N  5 7aP@6UA%0f:E YH J ' mAuh%kCXL]aQTD9c:NfpO1{HN:4.< 'a # +^_vB|%]MQ .; g]h0U^)d i:~~CVMKRM\pwfwL6Fxg`fuB2sRR0 -W],Cl soERwkjnibkXMcwoviW| @s}eXi+. +C;k?&#spyt__t|_NM_oxxmkq}~q]Vl7A;35D]s| '5>=0 ~^7 |W:+&)0+   "9Q\[bl}U*=.'SrGLJjeFp\d~VfPY< r5g+)hlWNze0a~8 HEL& D+-#:aW>E\p@UKg:u }tC9.SvdwnG^0s}9.htT_C<2*A=[05.BR s.%? Da~jL iIa?MeZr=_Z7tcpo Jt|P'0{7HM( I`E He_U_aZTWfc%52qdmM3It"0002-&0J`ks|}wffv~tcOHA>80,,73  #3+$&/${I~G:)8+RMCEd 1jO,YP* vN@5+5NA'Ir@/AWPffO>KL!F5k1H%c(3 {|# > " ,Nl1cnjR%fR> L(UBftLDD Y>3KMv^"nB.MTtWQ l"~wQ AZ F6x#UNc?A]k#{Z7xC+Sc[cXil Lm\7y0hWnW3Jh|dS K]es$T7o',\/  K G  `ZW.d\Js -'scGr#C{-T C vc(_/DxA!:g>G.:mJ:gRF ^8;qBDdnT[  _Ur@& M4ml@ m1n!N= dA (+*==UJt{A1Mucb J.nXc\B=&0&:G +EWPm/.73/&0yt99w$ PpZ bvL ZE 2aW>Di|vQ;+7mlqJz;*_KB0tn_>  ;dlR6''('W4' drV-6pZ<J(YL=^w^/V/1Q|f!';mg'L.\D+ xPL3}kfHD:  7YyzO55330 V";"N(gZQq".rq7<$1?SRW:QYnCbu `vxd>mO%}VA|\O+(6'cO>&u I>xNe+cBCN7%25 8K=Da_GG?*05 eOGc@I+ Uq+LA~n 6xP$qw[- 'T+3&B?6Z\r?CzgI[NY@\zs_YP<2-FK5""-' %  5J)5F2A>21&!!~y ."$@/D@/3;6:H?'CR?+9?A:DPG>BNPD5:BKE614,5B>>A<:[E?\E7<62NI94 0%'%,.70362'$+"   #08ITYaltyrfP38`QOMHO.X_!^Z..~5Q:?Js i1+sxke*[)C{g< }>:z~Y!915X%ko'DZg(C. Q_;3DF/=di9,D@7=v}`WT8&8EKEAgvbZ_E9FJC8_^42@=(":WbL+&0'C1 "#w^\cspXgog "(3 . #' '=.  {W)"e|`K]Y/ &hb1>f e]/(Y 3-ZetP1?v}aM y+7 58X s;8ZLaYI6.kICK' 9 _tkOys' qfy[}_TM77%t/gW+/6>(# Z')9JnpI:. FeG )8SPj_Z5+bzQMZ7O,7j+i_ }w#4AI bwB1# ,5V>tuFmB9,`H8& YKkKd#-D+?^9 a  Z  9< 4 mnd; jq{qP+sl@xUu  b6/BP:F '<D{Y1}xSn:G] fB{ +: \!:  IQ~i}vP{MLAjdi >gHowqg Da_d <3%ZM(_:/ gA|r01t %s  |>l te . U '% :~vlmC/CL=KGY2] ^hW~We80FR(FWVLiMC a2ax9|7,h|-G66Jd: d*{j 4}I@`=2`v($({ :d~D"}T#$o1v1kcG_,z7*r "3#5>  'f  KHW ftk`=#oj);(]M3R S8V{RMRUg,dqPnhDR"A@h OQ0q w~ !H  =|V9#$adgjK=^#E uq J >[FApRTr>pY^ B g`pm\  t[ 2 UPo< / 7m\> >A?@SV}`: _?& e 5 |Zx#'"D>M]d2LAh#UF(h6'] *% j 6j ZS c ] !b?|)yaW^d$)`iMr{L I  G "WOT'm88g'`zfMH V T``qLT|YR}jA @|~( ! G   K 0< \A>c q0ZW)A! ~x8 *[08rb7&VX@x6J LGt !k;L{  ''^  3 =o f QKVy,pSn-/uC#t_  fK]?yI<Q8A @!I';xR}SV] sn?Qu`A"}"x*\ni}  9 d9Q_ , ;pSw]i<!: ~,-$CU #2 O:rl9-l$A lh4I}DtE:$wSZEE )\/Bsce y %[iLHdB nrW>baA(k[U4[C2x YNSy_ vO]+\ 8SV+h7HrP30]=ft`\6Kr( RMgg{Hb(>)8sK'i}oy"]l =Ff6LU%A0.WL= lTPb>#^'YFm?qpi4=<C,(.>$1"Ch G2~68nQTvH|f4.rMUq$\(Clw@T=M&,4{t'fwMo]l,][5)>-"B|{ oT.G]Bk 0\~z/Pk\lg/w7}`"f61ydkU`{2I Q7) f[A!G*?NQkUPG^TK8jIwaZ1{w5{ @U%Li<$)0}d& Y~|;'_< 0KeGoIgY N%EM>2+'33%14#=zGLfx4gj{g`^u_Bqg<5Spe5gLoM2e{ X 4[QQ3(f85]lp A1L[m?y5{O=j@GYp}kTZI3y*,1$ )Cwu!$ tc+$MXD18^Vv(Eo]PHpoS9Ef}p#7pZG!yT H4)* _zkBC5Esx1,6E | Zhxe1-tuI`quXli=!_.BN<Lo[2(U>N I3Yz5#-nE 3mmH*8Gh^Sc2 w'E4`06 Aqdh>-H4_j0&e? JDK+N~gg*%9njbJfyK94IG }3UA& 8  W ;E   + VvQ*i wV_ .4Z|3~9k7mBzLP'HI H?^WZ%fB z! <r / ;Y~Y b) , dFJj|*(Nk~iYa@*o6e)oUuHCCdlKJ 8F6H ^r0Bh D  JpFO[ kF, f, sT":(?D[&(#P7l*V("G"Ww]v5*V weh.im   B 3 9 Gvt;F 7_2[EZ$E lDJ2 17u)@*9S-8(l1)9 pOTW ?p&f,R~. 0$Hmc3*et W2rJAz4/i:k,T]MQzyb7(37,;Q5\7ieO~_ b h_+rV9Y@RwFBF&>i!hT7=N k=%UC1fz=REj6Bh+^ dU/W$AOhg!F7\/FI7D@KRz/9U%V\N Zov5{B"'{$ x)\ Xudh5fZQ@% u>\' uPV?-G\=}F$DvSLYn|JLP>?&lEAGB/'>TD A#DsA0d,i-nC 4Ow : }*nvJ[s!B|y 3G72rM1B9*lUC FK +#oSsn . h #P DCfD=6"i.wC}sa JRXt^I[V-{t P_'ZDh- 5 l   kp~DTcU)' OT/ ez/ik[Gy-tzVc$4?6hj3'm;\}Jo5YSO]?t a 5c 5 xTT''GNq>~JHP| <Dc zz< W2O/F7`))(K  xA- E 4qXZv1%5eh#J41 B ~ 8 t@J_) 8;9mG?Q:pZbJJ9B'}7|o0 Rtg%  qYln lNlQ{B99    \VQ="obx|/HGG(MZTTX#U3!~'}2 p)pXPq@ Njq*d4 `L;  j &  W 15/(j 'xe\!L <'QgYu! .rS01 %*p|z Ui] P`n R/^"G{Q@_C c ^ DU0Ub$ pY.d22 5KlrT:\Z _^jT]lo^;)>Vn?H@oakm =w\"Rm  h PbM#rTG\ _WeO_y,mbKiPc3o)){a2 7#s'FyO:)wMF "G/ >N)+H{=0H 3uIl=$vxc0Z  {Q~ ugZR>,UBS T  0v0:hof0_y}KtF` vG2'XL.PUTv[ #< F]OWsM][nOF Lm  .3wX J d e -T wL8< gqB:8%i gC{ hRqyC %)$;.8<0h!*k4=#U  ] a $ fa 7`1(`/L9;A  ) ]Oh  #].E i ~JJG.lrh  ,+#A./h+*nn&TQ K: >`x{n"^ j <1B;lRcnr*6 1z"^B($1  $T&.})8  6R!]B #Q o 'gJqy b!vhy N?PvVd_yME"|tV   %l/,"p# Ap}@>&Q`-:# "_# Hf`)A-,US8 D C9?%Y4(E ^a4.A%;bfW1#a8*0J) Gz<\"^ ! U =-g81P5L_ F o&)lj5X-o!$f.gW*T\UTF4#Kwsy3[-qqS dUB&' : x{|2h42 JX\  P2A*uA|e3SJ)/_a)PCGl |"i!Fr1`[kQ{El! 1Qq} e!qCTip= zx2K2Pk&N--"Yn?Ybu67Pd"th(@}f&7}ze m~L auz4engy7&X`]I)$yBC3:9wL EL9CBhz"".'YNGO(wwv n^  d  Pw"sz\76)d;_x;L.ZnJIV?}Nmc"n=eeb o)"?,7y(g4XO"Gu)yA1;3Q&Q1w=f 4=Q~c$%KC+eAHpWK8!/AQt5MqQLxfj}AP.B#[(e+F\i*b8sq~#[vH! -4g!_Z80<>BJ{ EB% Z"_?dvJhk4MEV@I3og[nTBi_aT"$OYJtP-1qg~mux"KPg8EMet:(t|d\yiA,:OVxannOV\"LO' N'\1d'A2]FPcFB"E9<`,G]-z3U9)\YF)oe"\#jy S!FkQ{?wlLE=#@;s"b{|mMu3* hd}gjRS<Ju7"8`iL5QgmVBCdn *e fW,EC#-F,`8;y#"F.?L>|f{aFW@%")G+w;&SSXfG{;iKn|glI:SAKho<djfO/)8/|[\HztJ%Ti6Af%7f$$$qyt%]);QtQh,P+!HQq`PJ~Nk3YTd $7:Rlm@T5#:NML7g8G44Mlgl C]Xm>xGfrKXVL$"RfPi=ACjF?* fZgbR$ "I|GK8:r_W?5 3%k8o_%wzLiuIO}SrB@!vTp{  ?_0sXuv`^n%iGF.2=]D1'd F JwB^bbI$@ddn]M--/+g #vSs[;'Bzu%2 #v>>94!&( 3Db3eU0Pe2)LGvAx3J-AU]852ruCu@m\<hFl!>: c/=@3 A*AsF4|hW^#PXi.$Od5LdebELg'w*(>,SKF"ikb( B( &:{$Z{`.71- 'EN:Zm\ul'%*5 'Xu}rT$uNPt, #ImN:5 %( ('#& 2RQD"-+,+&*+33/(#-ANJFADLPROIJLEIS[`WIB?EF>:6893)   utpmpqowyqhij`PL[lsmke_]\XSJ=-Y+K6k;uEo+ s9K6j/8mR:BGMw.4Tdd^YW>!# }`3Y ;*"\qNKD %)Mjf??3r1|/?T0 O_tD=I >*V' EAO_j r0hUOQVYRHKXaS3! |@%"^0x s  #Kb%vS2n{'A4cx )zG*f|_cs]~F/\Mu:;v;$"N"TtSQ!Mp}O /U4V/kq j + ' { D k*j&'fXPJ9"qx<bQnx  1bp\Rc (9g~(NwEoYk'W0(m4)#N {2pd8a{f*m^ 3 1cY " m2 p'FEQg$c*1 ;>v<o=,bG\}5\"lX,O,w{rilKndyth(q  E` #xx0[7yP_F*. r q '7k&x8#UmP) FR j" Y[p lHj' oyjG[`ZT<`L*Ib:~=mG7c1 V1~@s tP7ekm.N0s9yT&dkSM Y yN% l~c[SF~V$8xA%t;-& [Hl(M mI=1rs&/W0 }#MV6{W:VfoF+X.GYE` N>b ,x%<hr9\T$jVE I HJTfsINV_jB c..qMVo^ nA_|Zy$?BM Z!16 YI \* VY!wIp 6B7xb = \ )PH.h  |gaW31N/lo^g68=1O9WZ*U*j i+{?F/0D~THW;@V`.N#  ga.Q'/ %sV`ylw j2K :Ap4$B="|v*JPQ/Y}(1 AL3HE YCI`..~~A|.+@] L #`(Q".@irny*FdO^3ZB61 A  q- v14s4z ( %@^v"YEDD4Tl6wXPjr x%k<N}P ?RlerKn  P >=#>%  a/YK~k[ aq5   5{{ Je^` u9m7mbY9^1oc%+\IrYa/ofU5v:~z)]S<;S8s?A}|Px] @J Q ' $#'>  ;QQ>p?Cl ?B A> /G~z#,/cyAv#l"iMO[ f5X9HVw=1lKC/iI<+dn;Jg Z - S)kl#Q' z s1]6m:vG^qMg6I:;te(O>>~ip?8&HXn~\4gxE|Tn#tcy k p\.} :!w5ZDWD+a?4wem{]7<!CQ>-jg,S@2'hw6:qxHnAy ")rSRu_V|(*R'tMpM r l c   lVi c'{BhI+9 #2?"N|@z,m!4jx0Yv.2O!F2<XKV*{- Ib"1;, DNiz5uGC Ynn 1 k[x}X8i{UZN,uph6~K5{KcWzME]V-?g/?`O!4H{.f_i5~+)v2=zBXu[:^}D9  ;vo V = zVhYHpf g?f|lm3JN1!W\MA F37"p(7\c+D}w^QG[9UW4c]$E%H9OYS.4`Gz< = QT( A66'4(_lA8]"oi|=d&y;W$k!!!QVOhM )GO-C~@K3 Gg-~P<h`e?>^%8< ~g# m<{lh:nv4+$APLXE{m 9f13dq>nA>&G/rudzV7; i 15*{BfUK@&mF1c0q"z&P) {d * NP5:?tO}~.cD+ ~#6[#dlvb*MjcoXQD0bgy *q'r 9/^V YF Iv>g!gh ' =w  60@?m.@s8b(+u QO<+(& :S =%XAVXR `RzL.upFG| 7R88wsjjSL H!" Gc  :v2U   nQOc[|~p sdM6ksUJ J_H,VP9r]drFf)%Ojhn/dP2;T?5y a^:5. ~`Qd2IeS#Fr(A  4:"I5GsN `t/Nh*@p<   onaY+,=|23kx-I/c~bq& (Y  &hJrd>qldp_,9+p?3:nO i\q)2;y,ed\vm:cgetZ` H>Y%b$8J}%Uq-fiE{J;a H:XZ>p2-! } TXE6wZU=wYb]~Jl(&@BYXI\ &e8~TgO{w`B~l xz)3M\iJ q<eqO y  KRl3^F [>rR >\4H%WaQ \p>k&s =XcYr_LT814gLE7 ( .  rz Y@:]gmT] Y  }<[(})SM}^-:|wM]7b,zL(^? V2iyYd1Tq +d2t`;s/K$- O N g# j  ?[kiT zc 63P~53^.dAc?E;h{W$l (VyOw;8Z#Npu1Z #!m> l:q[],,H ){"OD)B jbG'9Rt!Ej?Lu2pRL7E.}<_LT3&!g+ 3"H=_5H;gk  n 3pkT]Y98y]|a o%SW3 Is:4*2}H5`DpCslmCf~#VP{!G7l <v,/"F9H^o m , P`\nCEF".\Cs47X2z|k.|O8"q'k |!ruKAsIGUq) ?1- 7G A L5#"^C]|{IPR .U^3$Mg97!X 3L)Pp5K#fOH>G |U'Vg#4vp6$lQ?40D, i l  x Z @Q*`YIgQ/R K jxh xdccN Sjn6$K3Re"gA5qXg$6*ngW`^n- rw $} " k I(SPwe*  )QRn7q&3U?"nc2 JExz%mUu=~,(,:_;,"OFyB Ru, tE,& E Tb wM Q /L}j3KLnR.~|d{~fLQ0ntEdQ~er.s{/96qmyOagR\7sfZlw:wF_0{ # M  #mX NcIF.TD ,3e?l-4tKLKH37 Y>*A? L&rSBRQ ]\x{3xv0bmg_tPAf  f M _e, ,?.a$!okq4X<t~ ^!GW~R9 (+5l"-S`XK{jUw1_XjUe+ {  w? dzgk&Qo<J?oa=! sB2F<$c>Oo~@GJ3JG"[n#1Muwm=TS95X A ;}A W xR ^sw 735pwg<Si|D(2&Qz20W;[WDkAG')M^RFgqa\\wz7taHQQAef!v!` N/ HQuYs2\F)V wOL|Y^m@USvu'l%CC9#a.WfuE>2;T6`0s]3> % 1hK0w>4oX`cv|V^]^ Rj2!<|R]LjlKb'_ZlsMCW>_=kLQ jj&<pU_ 1Umb@FI, !D B< yfz0|/tT+`f?ARj{ }(fSMu}c&JrGHO)< %HoFz@$ wGFlN[1$ A0pySu^MPHPk%|Z&zBw5_ &s:(8EP-S?3B:ld&F =Ad%1 ~ .> ?yS0A$~ixr\by[Y)qnMB*CGh6\c{Zj<8 `J ] f6^@:jOU:Xx -q1cI=N?" ]pdpr xN=2[TQmd1b8=GZE=t  }  % `2FNK ^] !X5a"D-%rcrWn9z! [y&tF5 SB,L@;P`%xoO -Boh   V s`)wp_-EG1u9X_aZ 6A|5o35vi w@aIQgb2K~+^' 7OJV rANA3K # P@b!,X.+#+::3wue ,MT x_ Zax~:[:5 ECMBefYZ3"4 +_= F =0^ Tl[tRIb3tk_.P>'^E?V.?1#ncbb"wrf.?@jDtJ"7GxLs M5 :z_V~wqS5  (6]8 }y orq HUSh6 G ^zFs4ktQB8g%14ni|_8Mf[*v%hC}f, hjABELhYR;A DnQv=@E')D`6W#r@pk0+bF$ {1 9r$KU3~?L@X(WrAUd0da$'GS=hz1 Yy( i Y  X?f! MHVMZ4-0PqazX*A41|25;yDF.@p72E^ J$RAJS^rt&4l3 {hK;r L_*nK1^!\k" Szyh l.Jge"^mfVqT8n/m ,0#b[9bH @g : + q M `yS!Ar{^L*yI }Pw]b4^+ss8O]@:IgagX+qE Y6)RU n )2 2M,  % q }-HG'`MHPzs0qOXM.\_s? 2K\vv*2\o}A9?kj5oinP6M~ 3[ LG  GY I +4FT^!H`o2{reFNhE  tj ~m'ax anr^ 7v8bZ?x)^1Hv e )\H3Ieq3xchR3_G=3L ]I/yS\R;jNF v_g  W{ ;i evC=U>j8{G@6 V,(mQ}\]vsBmg,joc?~CF[44 y;PaE#.c!;b_X/g1ey8bp< :@ ' e &PiiCK%iH$5llFQbVnK> WXX!vbK&_#bu{Qe~[9a{|Ke-RiZ-.Y2c1 $d% h< cQM=:PZd@ T 4G a !fD^>v )axC:@1.L+ 9|.{'Vky/_#H ^LgF p!y6Yd UrZTBJV\Dj[p{{+h = R}.bJ1f-xj#!ebVk7{gCQB7AaWdvr}8oe4N<*)#l77?8%O l\z#,k Ewwj]59|/L!KBs/f*_f3 8I:#Cjz m(a[':un?Fw7S#Ga}7c R2d##}9v/ >wE\EW)p8Ela9 {Y'ZwzLna)nN ']S?r^4<m{]`~zhW[JR`/CAUNfK 1P?t461CXU?'|iVV[laT=(AG. /sbLbzrM0sG9AC=j$2}qegk*-D88FU)%]e(. ,YUjSSsj`HG\iU34Yp,YHg Hjs&}Q<*tf\_{}` n;P\A{egF^,8tq  WDYLMgmf75Im?)0I}p}6VX*6ls 0K=uZXYn~n-P wL0+0'*)hd1]s,5+LsDqG^GDFe iPwOh zglG@/@=@/vpstrjq{vU2 w]C:1,DhihjfN^, cFricAV,V@:uw.x xkm FSes^(Y.gV}UI,0:mxE(8b0mm0 NL; K~QX<)i!\)qaj`/K X+ %ZZ6b0$^+VB<H\9z\;56vqytVJPkw[I86A[~pG0'5KavyW!$KesY)#NdqE:p0(\.Z$ *)  '7E>+sMFTkykfucA,%)4Ql~~jS@::Jnk_e~qC&-P_o.KN>p]UZobJ45AO_oiG |nTIITjwlhs~~yo_J,  sc`isz{}pc][chuCU\YWE>J_zs]@.(+F_|meimmpsp`:*Gi{R1,-2:I\k^4  6UpoO!Aj{iC <Ta[;&RnfN7' !)8RfndE*:A0! 5LddS:*.0&.3- ( !/5-)' -=D< $>PbbR9&9JQK9  $.:C5 +<E5 '3,'=B;*+57*"(;@7-#$ !    !#   !  %& #%'+((32&#+*  !                                             ""#                                                                                                                                                                                                                                                  speech_tools/lib/example_data/kdt_001.pm0000644000076400007640000000602007262605664016566 0ustar awbawbEST_File Track DataType ascii NumChannels 0 NumFrames 391 EST_Header_End 0.0039 0.012954 0.022007 0.031061 0.040115 0.049168 0.058222 0.067276 0.076329 0.085383 0.094437 0.10349 0.112544 0.121598 0.130651 0.139705 0.148759 0.157812 0.166866 0.17592 0.184973 0.194027 0.20308 0.212134 0.221188 0.230241 0.239295 0.248349 0.257402 0.266456 0.27551 0.284563 0.293617 0.302671 0.311724 0.320778 0.329832 0.338885 0.347939 0.356993 0.366046 0.3751 0.3847 0.3943 0.4039 0.4135 0.4231 0.4327 0.4423 0.45286 0.46342 0.47398 0.48454 0.4951 0.4989 0.50605 0.51325 0.5211 0.52865 0.53635 0.54415 0.55285 0.5611 0.5695 0.5781 0.58605 0.59405 0.60205 0.60965 0.61755 0.62535 0.63335 0.64135 0.64935 0.65735 0.66605 0.67525 0.68355 0.6918 0.7003 0.70865 0.71725 0.7258 0.7344 0.7431 0.75145 0.75985 0.76775 0.7759 0.78415 0.7926 0.80115 0.8099 0.8188 0.82775 0.83675 0.846 0.85635 0.866 0.8755 0.88625 0.897917 0.909583 0.92125 0.92805 0.936 0.944 0.952 0.95975 0.96765 0.9755 0.9831 0.99075 0.99815 1.00565 1.01295 1.02015 1.02735 1.0344 1.0415 1.04855 1.056 1.06345 1.07075 1.08112 1.09148 1.10185 1.11102 1.12019 1.12936 1.13853 1.14769 1.15686 1.16603 1.1752 1.18437 1.19354 1.20271 1.21188 1.22104 1.23021 1.23938 1.24855 1.2588 1.26905 1.2793 1.2854 1.2916 1.29785 1.30385 1.31025 1.31675 1.32335 1.33015 1.33715 1.34525 1.3528 1.3607 1.3689 1.3766 1.38525 1.39415 1.4029 1.4119 1.42388 1.43585 1.4443 1.45515 1.466 1.47685 1.48585 1.49465 1.5041 1.5136 1.5231 1.5328 1.542 1.55075 1.55975 1.56885 1.57805 1.5873 1.59685 1.6071 1.61668 1.62627 1.63585 1.64603 1.65622 1.6664 1.6745 1.6826 1.69065 1.69915 1.70705 1.715 1.72285 1.7308 1.73875 1.74665 1.75535 1.76305 1.77235 1.7821 1.79185 1.80178 1.81171 1.82164 1.83157 1.84151 1.85144 1.86137 1.8713 1.878 1.8855 1.89325 1.90105 1.9093 1.9168 1.92485 1.93325 1.94065 1.94905 1.95705 1.96505 1.97305 1.9809 1.9888 1.99665 2.0045 2.01235 2.0201 2.0279 2.0354 2.0431 2.0508 2.0584 2.06615 2.07385 2.08165 2.0895 2.09735 2.1053 2.11355 2.1236 2.1321 2.14193 2.15177 2.1616 2.171 2.1804 2.1898 2.1992 2.2086 2.218 2.2274 2.2368 2.2462 2.2556 2.26355 2.2729 2.2826 2.29285 2.3031 2.31355 2.3239 2.33405 2.34435 2.35455 2.3646 2.3746 2.38465 2.3948 2.4051 2.4154 2.4253 2.43535 2.4455 2.45565 2.4659 2.47625 2.48655 2.49685 2.50715 2.51755 2.5278 2.53795 2.5481 2.5581 2.568 2.5776 2.58725 2.59675 2.60625 2.6155 2.62475 2.6338 2.64285 2.65175 2.66105 2.6699 2.6784 2.6871 2.69625 2.7049 2.71365 2.7224 2.73115 2.7399 2.74855 2.75715 2.76575 2.7743 2.78285 2.7915 2.80015 2.809 2.8179 2.8266 2.8359 2.84555 2.8554 2.86555 2.87605 2.8868 2.8976 2.9085 2.919 2.9303 2.9406 2.95135 2.9628 2.97325 2.9844 2.9958 3.00555 3.01486 3.02417 3.03349 3.0428 3.05211 3.06142 3.07073 3.08005 3.08936 3.09867 3.10798 3.11729 3.12661 3.13592 3.14523 3.15454 3.16385 3.17317 3.18248 3.19179 3.2011 3.21041 3.21973 3.22904 3.23835 3.24764 3.25693 3.26622 3.27551 3.2848 3.29409 3.30338 3.31267 3.32196 3.33125 3.34054 3.34983 3.35912 3.36841 3.3777 3.38699 3.39628 3.40557 3.41486 3.42415 3.43344 3.44273 3.45202 3.46131 3.4706 3.47989 3.48918 3.49847 3.50776 3.51705 speech_tools/lib/example_data/wagon.data0000644000076400007640000001242007262605664017035 0ustar awbawb0.274 aa - s 0 0 - f 0 0 single 1 0 0 1 4 0 0 1 0 0.175 aa - n 0 0 - r 0 0 single 0 1 0 1 1 1 0 1 0 0.172 aa - l 0 0 - s 0 0 single 1 0 0 0 1 1 0 1 1 0.138 aa - n 0 0 - f 0 0 single 1 0 0 1 1 1 0 1 0 0.122 aa - n 0 0 - f 0 0 initial 1 0 0 1 0 0 0 1 0 0.177 aa - f 0 0 - n 0 0 initial 1 0 0 1 0 0 0 1 0 0.251 aa - s 0 0 - s 0 0 single 1 0 0 1 1 1 0 1 0 0.151 aa - l 0 0 - a 0 0 initial 1 0 1 1 0 1 0 1 0 0.186 aa - s 0 0 - s 0 0 initial 0 1 0 1 0 1 0 1 0 0.082 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 0 1 1 1 0.175 aa - s 0 0 - s 0 0 single 1 0 0 0 1 1 0 1 1 0.207 aa - s 0 0 - f 0 0 initial 0 1 0 1 0 1 0 1 0 0.131 aa - f 0 0 - s 0 0 initial 1 0 0 0 0 0 0 1 0 0.0879999 aa - s 0 0 - r 0 0 final 1 0 1 0 1 1 0 0 1 0.178 aa - f 0 0 - n 0 0 single 1 0 0 1 1 1 1 1 0 0.072 aa - f 0 0 - l 0 0 single 1 0 0 0 1 1 0 1 1 0.242 aa - s 0 0 - r 0 0 single 1 0 0 1 4 0 0 1 0 0.135 aa - s 0 0 - f 0 0 single 1 0 0 1 1 1 1 1 0 0.168 aa - a 0 0 - l 0 0 single 1 0 0 1 1 0 0 1 1 0.161 aa - n 0 0 + 0 l 1 mid 2 0 0 0 0 1 1 1 0 0.18 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 1 1 1 0 0.18 aa - s 0 0 - s 0 0 mid 0 1 1 0 0 4 1 1 0 0.159 aa - n 0 0 + 0 l 1 initial 0 1 0 1 0 4 0 1 0 0.149 aa - s 0 0 - r 0 0 mid 0 1 0 0 0 4 0 0 0 0.153 aa - s 0 0 - s 0 0 final 0 1 0 0 1 0 0 0 1 0.101 aa - f 0 0 - l 0 0 initial 2 0 0 1 0 1 1 1 0 0.147 aa - f 0 0 - s 0 0 single 1 0 0 1 1 0 1 1 1 0.165 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 1 0 1 0 0.177 aa - a 0 0 - s 0 0 mid 0 1 0 0 0 1 1 1 0 0.246 aa - f 0 0 - s 0 0 single 1 0 0 1 4 0 0 1 0 0.149 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 1 0 1 1 0.127 aa - f 0 0 - l 0 0 single 2 0 0 0 1 1 0 1 0 0.167 aa - a 0 0 - l 0 0 single 1 0 0 1 1 4 0 1 1 0.101 aa - f 0 0 - s 0 0 mid 1 0 0 0 0 1 1 0 0 0.121 aa - s 0 0 - 0 0 0 initial 0 1 0 0 0 0 0 1 0 0.14 aa - n 0 0 - l 0 0 single 2 0 0 1 4 0 0 1 0 0.129 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 0 0 1 1 0.149 aa - s 0 0 - f 0 0 mid 0 1 0 0 0 3 1 0 0 0.167 aa - s 0 0 - n 0 0 initial 0 1 0 1 0 1 1 1 0 0.0929999 aa - f 0 0 + 0 l 1 initial 0 1 0 1 0 1 0 1 0 0.212 aa - f 0 0 - s 0 0 final 1 0 0 0 4 0 1 0 0 0.151 aa - r 0 0 - f 0 0 mid 0 1 0 0 0 4 1 1 0 0.115 aa - f 0 0 + 0 l 3 initial 0 1 0 1 0 1 0 1 0 0.159 aa - f 0 0 - r 0 0 single 2 0 0 1 1 1 0 1 0 0.213 aa - s 0 0 - f 0 0 single 1 0 0 1 1 1 0 1 1 0.154 aa - s 0 0 - s 0 0 single 1 0 0 1 1 0 1 1 1 0.155 aa - n 0 0 - f 0 0 mid 1 0 0 0 0 4 0 1 1 0.154 aa - r 0 0 - 0 0 0 single 0 1 1 0 1 1 0 0 0 0.168 aa - n 0 0 - f 0 0 mid 1 0 0 0 0 4 0 1 1 0.191 aa - f 0 0 - s 0 0 initial 1 0 1 1 0 1 0 1 0 0.152 aa - f 0 0 + 0 d 2 initial 0 1 0 1 0 1 0 1 0 0.206 aa - n 0 0 - f 0 0 initial 1 0 0 1 0 1 0 1 0 0.207 aa - n 0 0 + 0 d 3 initial 0 1 0 1 0 1 1 1 0 0.239 aa - a 0 0 - f 0 0 final 0 1 0 0 4 0 1 0 0 0.277 aa - f 0 0 - f 0 0 final 0 1 0 0 1 1 1 1 1 0.293 aa - f 0 0 - r 0 0 final 0 1 0 0 4 0 1 0 0 0.177 aa - s 0 0 + 0 l 1 initial 0 1 0 1 0 1 0 1 0 0.164 aa - f 0 0 - r 0 0 final 1 0 0 0 4 0 0 0 0 0.188 aa - s 0 0 - f 0 0 mid 0 1 0 0 0 4 1 1 0 0.123 aa - n 0 0 - l 0 0 final 0 1 0 0 1 0 0 0 1 0.159 aa - f 0 0 - r 0 0 final 0 1 0 0 1 1 1 1 0 0.21 aa - s 0 0 + 0 l 1 initial 0 1 0 1 0 1 1 1 0 0.19 aa - f 0 0 - r 0 0 final 1 0 0 0 4 0 0 0 0 0.119 aa - f 0 0 - r 0 0 initial 1 0 0 1 0 1 1 1 0 0.314 aa - f 0 0 - a 0 0 final 0 1 0 0 4 0 0 1 0 0.128 aa - f 0 0 - r 0 0 final 1 0 0 0 1 1 0 0 0 0.131 aa - n 0 0 - f 0 0 initial 0 1 0 1 0 1 0 1 0 0.186 aa - n 0 0 - f 0 0 initial 1 0 0 1 0 4 0 1 0 0.187 aa - s 0 0 - r 0 0 final 1 0 0 0 4 0 1 0 0 0.187 aa - f 0 0 - a 0 0 single 1 0 0 1 1 1 0 1 0 0.12 aa - s 0 0 - s 0 0 mid 0 1 0 0 0 4 1 1 0 0.127 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 1 1 1 1 0.151 aa - f 0 0 + 0 l 1 initial 0 1 0 1 0 0 1 1 0 0.26 aa - s 0 0 - s 0 0 single 1 0 0 1 1 0 0 1 1 0.17 aa - s 0 0 - s 0 0 single 1 0 0 1 1 0 0 1 1 0.213 aa - a 0 0 - a 0 0 single 1 0 0 1 1 1 1 1 0 0.213 aa - s 0 0 - f 0 0 single 1 0 0 1 1 1 0 1 0 0.204 aa - s 0 0 - s 0 0 single 1 0 0 1 1 0 1 1 1 0.179 aa - n 0 0 - f 0 0 initial 1 0 0 1 0 1 0 1 0 0.179 aa - s 0 0 - s 0 0 single 1 0 0 1 4 0 0 1 0 0.141 aa - s 0 0 - s 0 0 mid 0 1 0 0 0 1 1 1 0 0.085 aa - f 0 0 + 0 l 1 initial 0 1 0 1 0 1 0 1 0 0.204 aa - s 0 0 - s 0 0 single 1 0 0 1 1 1 1 1 0 0.179 aa - l 0 0 - s 0 0 initial 1 0 0 1 0 1 1 1 0 0.149 aa - s 0 0 + 0 l 1 initial 0 1 0 1 0 0 1 1 0 0.139 aa - a 0 0 - a 0 0 single 1 0 0 1 1 0 1 1 1 0.193 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 4 0 1 0 0.109 aa - s 0 0 - s 0 0 initial 1 0 1 1 0 1 0 1 0 0.168 aa - s 0 0 - s 0 0 final 0 1 0 0 1 1 1 0 1 0.111 aa - f 0 0 + 0 d 3 initial 0 1 0 1 0 1 1 1 0 0.191 aa - s 0 0 - s 0 0 single 1 0 1 0 1 1 0 1 1 0.259 aa - f 0 0 - l 0 0 single 1 0 0 0 1 1 0 1 1 0.204 aa - n 0 0 - s 0 0 single 1 0 0 1 1 1 1 1 0 0.198 aa - s 0 0 - s 0 0 single 1 0 0 1 4 0 0 1 0 0.24 aa - f 0 0 - s 0 0 single 2 0 0 1 1 1 0 1 1 0.162 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 1 0 1 0 0.176 aa - a 0 0 - l 0 0 single 1 0 0 1 1 0 0 1 1 0.222 aa - f 0 0 - s 0 0 single 1 0 0 1 1 4 1 1 1 0.202 aa - f 0 0 - s 0 0 single 1 0 0 1 1 1 0 1 0 0.23 aa - s 0 0 - s 0 0 initial 1 0 0 1 0 3 1 1 0 0.19 aa - s 0 0 - a 0 0 single 1 0 1 1 1 0 1 1 1 0.179 aa - n 0 0 - a 0 0 initial 1 0 0 1 0 1 0 1 0 0.297 aa - f 0 0 - s 0 0 single 2 0 1 1 1 1 1 1 1 0.165 aa - f 0 0 - l 0 0 single 1 0 0 1 1 1 0 1 1 0.152 aa - a 0 0 - l 0 0 initial 1 0 0 1 0 1 0 1 0 0.217 aa - f 0 0 - r 0 0 single 2 0 0 1 4 0 0 1 0 speech_tools/lib/example_data/wagon.desc0000644000076400007640000000101107262605664017034 0ustar awbawb( ( duration float ) ( name ignore ) ( n.ph_vc 0 + - ) ( n.ph_ctype s f a n l r 0) ( n.ph_vlng s l d a 0 ) ( n.ph_vheight 1 2 3 0 ) ( p.ph_vc 0 + - ) ( p.ph_ctype s f a n l r 0) ( p.ph_vlng s l d a 0 ) ( p.ph_vheight 1 2 3 0 ) ( Syllable.position_type 0 final initial mid single ) ( pos_in_syl 0 1 2 3 4 5 6 7 ) ( syl_initial 0 1) ( syl_final 0 1) ( Syllable.p.syl_break 0 1 3 ) ( Syllable.syl_break 0 1 3 4 ) ( Syllable.n.syl_break 0 1 3 4 ) ( Syllable.p.stress 0 1 ) ( Syllable.stress 0 1 ) ( Syllable.n.stress 0 1 ) ) speech_tools/lib/example_data/wagon.tree0000644000076400007640000000163307467036720017065 0ustar awbawb ((Syllable.syl_break is 4) ((n.ph_ctype is f) ((0.0542117 0.233714)) ((0.0456028 0.208429))) ((Syllable.position_type is single) ((p.ph_ctype is s) ((Syllable.n.syl_break is 0) ((0.0463573 0.187)) ((0.0381861 0.2158))) ((Syllable.n.syl_break is 1) ((n.ph_ctype is f) ((0.0571677 0.163857)) ((0.0358363 0.177286))) ((0.0186414 0.168)))) ((p.ph_ctype is f) ((Syllable.n.syl_break is 1) ((0.0529528 0.2)) ((0.0230754 0.159857))) ((n.ph_ctype is f) ((p.ph_vc is +) ((0.0283437 0.117833)) ((0.0338439 0.138375))) ((Syllable.n.stress is 0) ((Syllable.p.syl_break is 0) ((0.0244024 0.149857)) ((Syllable.p.stress is 0) ((p.ph_ctype is s) ((0.0329773 0.163)) ((0.0135204 0.1636))) ((0.0280204 0.188857)))) ((0.0302511 0.127375))))))) ;; RMSE 0.0346 Correlation is 0.6825 Mean (abs) Error 0.0272 (0.0214) speech_tools/lib/example_data/eg.xml0000644000076400007640000000034007262605664016202 0ustar awbawb This is an example of an XML file speech_tools/lib/example_data/eg.dtd0000644000076400007640000000043407262605664016161 0ustar awbawb speech_tools/lib/example_data/ked_wr1_012.utt0000644000076400007640000024744007262605664017557 0ustar awbawbEST_File utterance DataType ascii version 2 EST_Header_End Features fileroot ked_wr1_012 ; Stream_Items 1 id 1 ; nname i ; phon_ref 1 ; pos_index 12 ; pos_index_score 0 ; pos prp ; phr_pos prp ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 2 id 2 ; name know ; phon_ref 3 ; pos_index 17 ; pos_index_score 0 ; pos vbp ; phr_pos v ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 3 id 3 ; name of ; phon_ref 5 ; pos_index 9 ; pos_index_score 0 ; pos of ; phr_pos of ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 4 id 4 ; name florence ; phon_ref 13 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 5 id 5 ; name south ; phon_ref 16 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue s ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 6 id 6 ; name carolina ; phon_ref 24 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 0 ; pbreak_index_score 0 ; pbreak B ; blevel 3 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 7 id 8 ; name and ; phon_ref 28 ; pos_index 0 ; pos_index_score 0 ; pos cc ; phr_pos cc ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 8 id 9 ; name a ; phon_ref 29 ; pos_index 2 ; pos_index_score 0 ; pos dt ; phr_pos dt ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 9 id 10 ; name florence ; phon_ref 38 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 10 id 11 ; name italy ; phon_ref 44 ; sentence_end 1 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 0 ; pbreak_index_score 0 ; pbreak B ; blevel 3 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 11 id 13 ; name in ; phon_ref 47 ; pos_index 5 ; pos_index_score 0 ; pos in ; phr_pos in ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 12 id 14 ; name florence ; phon_ref 54 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 13 id 15 ; name in ; phon_ref 56 ; pos_index 5 ; pos_index_score 0 ; pos in ; phr_pos in ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 14 id 16 ; name south ; phon_ref 59 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 15 id 17 ; name carolina ; phon_ref 68 ; pos_index 8 ; pos_index_score 0 ; pos nnp ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 16 id 18 ; name today ; phon_ref 74 ; pos_index 8 ; pos_index_score 0 ; pos nn ; phr_pos n ; pbreak_index 0 ; pbreak_index_score 0 ; pbreak B ; blevel 3 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 17 id 19 ; name mostly ; phon_ref 80 ; pos_index 14 ; pos_index_score 0 ; pos rb ; phr_pos r ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 18 id 20 ; name sunny ; phon_ref 84 ; sentence_end 1 ; pos_index 6 ; pos_index_score 0 ; pos jj ; phr_pos j ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 19 id 22 ; name highs ; phon_ref 88 ; pos_index 8 ; pos_index_score 0 ; pos nns ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 20 id 23 ; name upper ; phon_ref 92 ; pos_index 6 ; pos_index_score 0 ; pos jj ; phr_pos j ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 21 id 24 ; name fifties ; phon_ref 99 ; sentence_end 1 ; pos_index 8 ; pos_index_score 0 ; pos nn ; phr_pos n ; pbreak_index 0 ; pbreak_index_score 0 ; pbreak B ; blevel 3 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 22 id 26 ; name tonight ; phon_ref 106 ; pos_index 14 ; pos_index_score 0 ; pos rb ; phr_pos r ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 23 id 27 ; name partly ; phon_ref 114 ; pos_index 14 ; pos_index_score 0 ; pos rb ; phr_pos r ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 24 id 28 ; name cloudy ; phon_ref 120 ; sentence_end 1 ; pos_index 6 ; pos_index_score 0 ; pos jj ; phr_pos j ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 25 id 29 ; name lows ; phon_ref 123 ; pos_index 8 ; pos_index_score 0 ; pos nns ; phr_pos n ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; stress_num 0 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 26 id 30 ; name upper ; phon_ref 127 ; pos_index 6 ; pos_index_score 0 ; pos jj ; phr_pos j ; pbreak_index 1 ; pbreak_index_score 0 ; pbreak NB ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 27 id 31 ; name thirties ; phon_ref 133 ; sentence_end 1 ; pos_index 8 ; pos_index_score 0 ; pos nns ; phr_pos n ; pbreak_index 0 ; pbreak_index_score 0 ; pbreak B ; blevel 3 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 28 id 34 ; end 0.265282 ; name sil ; ref 0 ; start 0 ; 29 id 35 ; end 0.354257 ; name ay ; ref 1 ; start 0.265282 ; 30 id 36 ; end 0.393083 ; name n ; ref 2 ; start 0.354257 ; 31 id 37 ; end 0.546767 ; name ow ; ref 3 ; start 0.393083 ; 32 id 38 ; end 0.613094 ; name ax ; ref 4 ; start 0.546767 ; 33 id 39 ; end 0.647067 ; name v ; ref 5 ; start 0.613094 ; 34 id 40 ; end 0.718249 ; name f ; ref 6 ; start 0.647067 ; 35 id 41 ; end 0.744133 ; name l ; ref 7 ; start 0.718249 ; 36 id 42 ; end 0.836343 ; name ao ; ref 8 ; start 0.744133 ; 37 id 43 ; end 0.888111 ; name r ; ref 9 ; start 0.836343 ; 38 id 44 ; end 0.923701 ; name en ; ref 10 ; start 0.888111 ; 39 id 46 ; end 0.957673 ; name t ; ref 12 ; start 0.923701 ; 40 id 47 ; end 0.994881 ; name s ; ref 13 ; start 0.957673 ; 41 id 48 ; end 1.04988 ; name s ; ref 14 ; start 0.994881 ; 42 id 49 ; end 1.17283 ; name aw ; ref 15 ; start 1.04988 ; 43 id 50 ; end 1.23916 ; name th ; ref 16 ; start 1.17283 ; 44 id 52 ; end 1.31196 ; name k ; ref 18 ; start 1.23916 ; 45 id 53 ; end 1.36696 ; name eh ; ref 19 ; start 1.31196 ; 46 id 54 ; end 1.41226 ; name r ; ref 20 ; start 1.36696 ; 47 id 55 ; end 1.46564 ; name el ; ref 21 ; start 1.41226 ; 48 id 56 ; end 1.60153 ; name ay ; ref 22 ; start 1.46564 ; 49 id 57 ; end 1.6355 ; name n ; ref 23 ; start 1.60153 ; 50 id 58 ; end 1.77463 ; name ax ; ref 24 ; start 1.6355 ; 51 id 59 ; end 1.86361 ; name sil ; ref 25 ; start 1.77463 ; 52 id 60 ; end 1.91376 ; name ax ; ref 26 ; start 1.86361 ; 53 id 61 ; end 1.94611 ; name n ; ref 27 ; start 1.91376 ; 54 id 62 ; end 1.95582 ; name dx ; ref 28 ; start 1.94611 ; 55 id 63 ; end 2.00597 ; name ax ; ref 29 ; start 1.95582 ; 56 id 64 ; end 2.0998 ; name f ; ref 30 ; start 2.00597 ; 57 id 65 ; end 2.13377 ; name l ; ref 31 ; start 2.0998 ; 58 id 66 ; end 2.19524 ; name ao ; ref 32 ; start 2.13377 ; 59 id 67 ; end 2.24863 ; name r ; ref 33 ; start 2.19524 ; 60 id 68 ; end 2.29392 ; name ax ; ref 34 ; start 2.24863 ; 61 id 69 ; end 2.33598 ; name n ; ref 35 ; start 2.29392 ; 62 id 71 ; end 2.35702 ; name t ; ref 37 ; start 2.33598 ; 63 id 72 ; end 2.39908 ; name s ; ref 38 ; start 2.35702 ; 64 id 73 ; end 2.50423 ; name ih ; ref 39 ; start 2.39908 ; 65 id 75 ; end 2.53335 ; name t ; ref 41 ; start 2.50423 ; 66 id 76 ; end 2.57541 ; name ax ; ref 42 ; start 2.53335 ; 67 id 77 ; end 2.64012 ; name l ; ref 43 ; start 2.57541 ; 68 id 78 ; end 2.76145 ; name iy ; ref 44 ; start 2.64012 ; 69 id 79 ; end 3.78326 ; name sil ; ref 45 ; start 2.76145 ; 70 id 80 ; end 3.84031 ; name ax ; ref 46 ; start 3.78326 ; 71 id 81 ; end 3.90254 ; name n ; ref 47 ; start 3.84031 ; 72 id 82 ; end 3.98552 ; name f ; ref 48 ; start 3.90254 ; 73 id 83 ; end 4.03481 ; name l ; ref 49 ; start 3.98552 ; 74 id 84 ; end 4.08407 ; name ao ; ref 50 ; start 4.03481 ; 75 id 85 ; end 4.12556 ; name r ; ref 51 ; start 4.08407 ; 76 id 86 ; end 4.18261 ; name ax ; ref 52 ; start 4.12556 ; 77 id 87 ; end 4.2241 ; name n ; ref 53 ; start 4.18261 ; 78 id 88 ; end 4.29541 ; name s ; ref 54 ; start 4.2241 ; 79 id 89 ; end 4.31616 ; name ax ; ref 55 ; start 4.29541 ; 80 id 90 ; end 4.38747 ; name n ; ref 56 ; start 4.31616 ; 81 id 91 ; end 4.46346 ; name s ; ref 57 ; start 4.38747 ; 82 id 92 ; end 4.58533 ; name aw ; ref 58 ; start 4.46346 ; 83 id 93 ; end 4.64627 ; name th ; ref 59 ; start 4.58533 ; 84 id 95 ; end 4.72017 ; name k ; ref 61 ; start 4.64627 ; 85 id 96 ; end 4.76944 ; name eh ; ref 62 ; start 4.72017 ; 86 id 97 ; end 4.79537 ; name r ; ref 63 ; start 4.76944 ; 87 id 98 ; end 4.82649 ; name ax ; ref 64 ; start 4.79537 ; 88 id 99 ; end 4.87057 ; name l ; ref 65 ; start 4.82649 ; 89 id 100 ; end 4.99763 ; name ay ; ref 66 ; start 4.87057 ; 90 id 101 ; end 5.02226 ; name n ; ref 67 ; start 4.99763 ; 91 id 102 ; end 5.08969 ; name ah ; ref 68 ; start 5.02226 ; 92 id 104 ; end 5.17384 ; name t ; ref 70 ; start 5.08969 ; 93 id 105 ; end 5.20625 ; name ax ; ref 71 ; start 5.17384 ; 94 id 107 ; end 5.26589 ; name d ; ref 73 ; start 5.20625 ; 95 id 108 ; end 5.46815 ; name ey ; ref 74 ; start 5.26589 ; 96 id 109 ; end 5.54076 ; name m ; ref 75 ; start 5.46815 ; 97 id 110 ; end 5.6393 ; name ow ; ref 76 ; start 5.54076 ; 98 id 111 ; end 5.69505 ; name s ; ref 77 ; start 5.6393 ; 99 id 112 ; end 5.73784 ; name t ; ref 78 ; start 5.69505 ; 100 id 113 ; end 5.75728 ; name l ; ref 79 ; start 5.73784 ; 101 id 114 ; end 5.81044 ; name iy ; ref 80 ; start 5.75728 ; 102 id 115 ; end 5.92674 ; name s ; ref 81 ; start 5.81044 ; 103 id 116 ; end 6.00453 ; name ah ; ref 82 ; start 5.92674 ; 104 id 117 ; end 6.03954 ; name n ; ref 83 ; start 6.00453 ; 105 id 118 ; end 6.14197 ; name iy ; ref 84 ; start 6.03954 ; 106 id 119 ; end 6.56702 ; name sil ; ref 85 ; start 6.14197 ; 107 id 120 ; end 6.6098 ; name hh ; ref 86 ; start 6.56702 ; 108 id 121 ; end 6.77446 ; name ay ; ref 87 ; start 6.6098 ; 109 id 122 ; end 6.81984 ; name z ; ref 88 ; start 6.77446 ; 110 id 123 ; end 6.90801 ; name ah ; ref 89 ; start 6.81984 ; 111 id 125 ; end 6.98839 ; name p ; ref 91 ; start 6.90801 ; 112 id 126 ; end 7.04026 ; name er ; ref 92 ; start 6.98839 ; 113 id 127 ; end 7.13843 ; name f ; ref 93 ; start 7.04026 ; 114 id 128 ; end 7.22271 ; name ih ; ref 94 ; start 7.13843 ; 115 id 129 ; end 7.25383 ; name f ; ref 95 ; start 7.22271 ; 116 id 131 ; end 7.31865 ; name t ; ref 97 ; start 7.25383 ; 117 id 132 ; end 7.41849 ; name iy ; ref 98 ; start 7.31865 ; 118 id 133 ; end 7.53388 ; name z ; ref 99 ; start 7.41849 ; 119 id 134 ; end 7.95539 ; name sil ; ref 100 ; start 7.53388 ; 120 id 136 ; end 8.02929 ; name t ; ref 102 ; start 7.95539 ; 121 id 137 ; end 8.05652 ; name ax ; ref 103 ; start 8.02929 ; 122 id 138 ; end 8.10319 ; name n ; ref 104 ; start 8.05652 ; 123 id 139 ; end 8.28471 ; name ay ; ref 105 ; start 8.10319 ; 124 id 140 ; end 8.30805 ; name t ; ref 106 ; start 8.28471 ; 125 id 142 ; end 8.56736 ; name p ; ref 108 ; start 8.30805 ; 126 id 143 ; end 8.61274 ; name aa ; ref 109 ; start 8.56736 ; 127 id 144 ; end 8.64904 ; name r ; ref 110 ; start 8.61274 ; 128 id 146 ; end 8.69571 ; name t ; ref 112 ; start 8.64904 ; 129 id 147 ; end 8.73202 ; name l ; ref 113 ; start 8.69571 ; 130 id 148 ; end 8.79555 ; name iy ; ref 114 ; start 8.73202 ; 131 id 150 ; end 8.89121 ; name k ; ref 116 ; start 8.79555 ; 132 id 151 ; end 8.91585 ; name l ; ref 117 ; start 8.89121 ; 133 id 152 ; end 9.03383 ; name aw ; ref 118 ; start 8.91585 ; 134 id 153 ; end 9.06236 ; name dx ; ref 119 ; start 9.03383 ; 135 id 154 ; end 9.16997 ; name iy ; ref 120 ; start 9.06236 ; 136 id 155 ; end 9.29314 ; name l ; ref 121 ; start 9.16997 ; 137 id 156 ; end 9.47855 ; name ow ; ref 122 ; start 9.29314 ; 138 id 157 ; end 9.5343 ; name z ; ref 123 ; start 9.47855 ; 139 id 158 ; end 9.63 ; name ah ; ref 124 ; start 9.5343 ; 140 id 160 ; end 9.71168 ; name p ; ref 126 ; start 9.63 ; 141 id 161 ; end 9.79206 ; name er ; ref 127 ; start 9.71168 ; 142 id 162 ; end 9.86467 ; name th ; ref 128 ; start 9.79206 ; 143 id 163 ; end 9.96191 ; name er ; ref 129 ; start 9.86467 ; 144 id 165 ; end 10.0164 ; name t ; ref 131 ; start 9.96191 ; 145 id 166 ; end 10.1292 ; name iy ; ref 132 ; start 10.0164 ; 146 id 167 ; end 10.2837 ; name z ; ref 133 ; start 10.1292 ; 147 id 168 ; end 10.3926 ; name sil ; ref 134 ; start 10.2837 ; 148 id 20045 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 149 id 20049 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 150 id 20095 ; stress_num 2 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 151 id 20099 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 152 id 20103 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 153 id 20107 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 154 id 20166 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 155 id 20170 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 156 id 20196 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 157 id 20199 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 158 id 20203 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 159 id 20246 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 160 id 20250 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 161 id 20308 ; stress_num 2 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 162 id 20312 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 163 id 20316 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 164 id 20320 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 165 id 20353 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 166 id 20357 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 167 id 20383 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 168 id 20387 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 169 id 20411 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 170 id 20415 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 171 id 20450 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 172 id 20453 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 173 id 20478 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 174 id 20482 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 175 id 20510 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 176 id 20514 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 177 id 20542 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 178 id 20546 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 179 id 20572 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 180 id 20576 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 181 id 20611 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 182 id 20614 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 183 id 20637 ; stress_num 1 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 184 id 20641 ; stress_num 0 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 185 id 174 ; name NT00 ; prob 1.56332e-11 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 186 id 193 ; name NT00 ; prob 3.7486e-12 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 187 id 208 ; name NT00 ; prob 2.02154e-05 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 188 id 213 ; name NT00 ; prob 1.00169e-08 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 189 id 218 ; name NT00 ; prob 2.02154e-05 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 190 id 220 ; name NT07 ; prob 0.0116955 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 191 id 215 ; name NT17 ; prob 0.00149179 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 192 id 210 ; name NT07 ; prob 0.0116955 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 193 id 194 ; name NT06 ; prob 1.19699e-06 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 194 id 195 ; name NT17 ; prob 0.00149179 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 195 id 196 ; name NT02 ; prob 0.000672937 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 196 id 197 ; name NT12 ; prob 0.00552933 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 197 id 201 ; name NT02 ; prob 0.0180802 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 198 id 202 ; name NT07 ; prob 0.0877729 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 199 MetricalValue w ; id 226 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 200 id 20327 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 201 id 176 ; name NT17 ; prob 4.44852e-08 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 202 id 178 ; name NT08 ; prob 6.62387e-08 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 203 id 179 ; name NT12 ; prob 0.00169157 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 204 id 180 ; name NT09 ; prob 0.000592627 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 205 id 188 ; name NT02 ; prob 0.0393265 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 206 id 190 ; name NT07 ; prob 0.0877729 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 207 MetricalValue s ; id 225 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 208 id 182 ; name NT02 ; prob 0.0180802 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 209 id 183 ; name NT07 ; prob 0.0877729 ; MetricalValue w ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 210 MetricalValue w ; id 224 ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 211 id 20114 ; MetricalValue s ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path MetricalTree ; 212 id 223 ; name pau ; end 0.265282 ; start 0 ; dur F:unisyn_duration ; 213 id 20002 ; name ay ; end "0.354" ; start "0.265" ; dur F:unisyn_duration ; 214 id 20010 ; name n ; end "0.393" ; start "0.354" ; dur F:unisyn_duration ; 215 id 20011 ; name ow ; end "0.547" ; start "0.393" ; dur F:unisyn_duration ; 216 id 20021 ; name ax ; end "0.613" ; start "0.547" ; dur F:unisyn_duration ; 217 id 20022 ; name v ; end "0.647" ; start "0.613" ; dur F:unisyn_duration ; 218 id 20037 ; name f ; end "0.718" ; start "0.647" ; dur F:unisyn_duration ; 219 id 20038 ; name l ; end "0.744" ; start "0.718" ; dur F:unisyn_duration ; 220 id 20039 ; name ao ; end "0.836" ; start "0.744" ; dur F:unisyn_duration ; 221 id 20040 ; name r ; end "0.888" ; start "0.836" ; dur F:unisyn_duration ; 222 id 20041 ; name en ; end "0.924" ; start "0.888" ; dur F:unisyn_duration ; 223 id 20042 ; name t ; end "0.958" ; start "0.924" ; dur F:unisyn_duration ; 224 id 20043 ; name s ; end "0.995" ; start "0.958" ; dur F:unisyn_duration ; 225 id 20067 ; name s ; end "1.050" ; start "0.995" ; dur F:unisyn_duration ; 226 id 20068 ; name aw ; end "1.173" ; start "1.050" ; dur F:unisyn_duration ; 227 id 20069 ; name th ; end "1.239" ; start "1.173" ; dur F:unisyn_duration ; 228 id 20087 ; name k ; end "1.312" ; start "1.239" ; dur F:unisyn_duration ; 229 id 20088 ; name eh ; end "1.367" ; start "1.312" ; dur F:unisyn_duration ; 230 id 20089 ; name r ; end "1.412" ; start "1.367" ; dur F:unisyn_duration ; 231 id 20090 ; name el ; end "1.466" ; start "1.412" ; dur F:unisyn_duration ; 232 id 20091 ; name ay ; end "1.602" ; start "1.466" ; dur F:unisyn_duration ; 233 id 20092 ; name n ; end "1.636" ; start "1.602" ; dur F:unisyn_duration ; 234 id 20093 ; name ax ; end "1.775" ; start "1.636" ; dur F:unisyn_duration ; 235 id 20133 ; name ax ; end "1.914" ; start "1.864" ; dur F:unisyn_duration ; 236 id 20134 ; name n ; end "1.946" ; start "1.914" ; dur F:unisyn_duration ; 237 id 20135 ; name dx ; end "1.956" ; start "1.946" ; dur F:unisyn_duration ; 238 id 20144 ; name ax ; end "2.006" ; start "1.956" ; dur F:unisyn_duration ; 239 id 20157 ; name f ; end "2.100" ; start "2.006" ; dur F:unisyn_duration ; 240 id 20158 ; name l ; end "2.134" ; start "2.100" ; dur F:unisyn_duration ; 241 id 20159 ; name ao ; end "2.195" ; start "2.134" ; dur F:unisyn_duration ; 242 id 20160 ; name r ; end "2.249" ; start "2.195" ; dur F:unisyn_duration ; 243 id 20161 ; name ax ; end "2.294" ; start "2.249" ; dur F:unisyn_duration ; 244 id 20162 ; name n ; end "2.336" ; start "2.294" ; dur F:unisyn_duration ; 245 id 20163 ; name t ; end "2.357" ; start "2.336" ; dur F:unisyn_duration ; 246 id 20164 ; name s ; end "2.399" ; start "2.357" ; dur F:unisyn_duration ; 247 id 20190 ; name ih ; end "2.504" ; start "2.399" ; dur F:unisyn_duration ; 248 id 20191 ; name t ; end "2.533" ; start "2.504" ; dur F:unisyn_duration ; 249 id 20192 ; name ax ; end "2.575" ; start "2.533" ; dur F:unisyn_duration ; 250 id 20193 ; name l ; end "2.640" ; start "2.575" ; dur F:unisyn_duration ; 251 id 20194 ; name iy ; end "2.761" ; start "2.640" ; dur F:unisyn_duration ; 252 id 20222 ; name ax ; end "3.840" ; start "3.783" ; dur F:unisyn_duration ; 253 id 20223 ; name n ; end "3.903" ; start "3.840" ; dur F:unisyn_duration ; 254 id 20238 ; name f ; end "3.986" ; start "3.903" ; dur F:unisyn_duration ; 255 id 20239 ; name l ; end "4.035" ; start "3.986" ; dur F:unisyn_duration ; 256 id 20240 ; name ao ; end "4.084" ; start "4.035" ; dur F:unisyn_duration ; 257 id 20241 ; name r ; end "4.126" ; start "4.084" ; dur F:unisyn_duration ; 258 id 20242 ; name ax ; end "4.183" ; start "4.126" ; dur F:unisyn_duration ; 259 id 20243 ; name n ; end "4.224" ; start "4.183" ; dur F:unisyn_duration ; 260 id 20244 ; name s ; end "4.295" ; start "4.224" ; dur F:unisyn_duration ; 261 id 20267 ; name ax ; end "4.316" ; start "4.295" ; dur F:unisyn_duration ; 262 id 20268 ; name n ; end "4.387" ; start "4.316" ; dur F:unisyn_duration ; 263 id 20279 ; name s ; end "4.463" ; start "4.387" ; dur F:unisyn_duration ; 264 id 20280 ; name aw ; end "4.585" ; start "4.463" ; dur F:unisyn_duration ; 265 id 20281 ; name th ; end "4.646" ; start "4.585" ; dur F:unisyn_duration ; 266 id 20299 ; name k ; end "4.720" ; start "4.646" ; dur F:unisyn_duration ; 267 id 20300 ; name eh ; end "4.769" ; start "4.720" ; dur F:unisyn_duration ; 268 id 20301 ; name r ; end "4.795" ; start "4.769" ; dur F:unisyn_duration ; 269 id 20302 ; name ax ; end "4.826" ; start "4.795" ; dur F:unisyn_duration ; 270 id 20303 ; name l ; end "4.871" ; start "4.826" ; dur F:unisyn_duration ; 271 id 20304 ; name ay ; end "4.998" ; start "4.871" ; dur F:unisyn_duration ; 272 id 20305 ; name n ; end "5.022" ; start "4.998" ; dur F:unisyn_duration ; 273 id 20306 ; name ah ; end "5.090" ; start "5.022" ; dur F:unisyn_duration ; 274 id 20348 ; name t ; end "5.174" ; start "5.090" ; dur F:unisyn_duration ; 275 id 20349 ; name ax ; end "5.206" ; start "5.174" ; dur F:unisyn_duration ; 276 id 20350 ; name d ; end "5.266" ; start "5.206" ; dur F:unisyn_duration ; 277 id 20351 ; name ey ; end "5.468" ; start "5.266" ; dur F:unisyn_duration ; 278 id 20376 ; name m ; end "5.541" ; start "5.468" ; dur F:unisyn_duration ; 279 id 20377 ; name ow ; end "5.639" ; start "5.541" ; dur F:unisyn_duration ; 280 id 20378 ; name s ; end "5.695" ; start "5.639" ; dur F:unisyn_duration ; 281 id 20379 ; name t ; end "5.738" ; start "5.695" ; dur F:unisyn_duration ; 282 id 20380 ; name l ; end "5.757" ; start "5.738" ; dur F:unisyn_duration ; 283 id 20381 ; name iy ; end "5.810" ; start "5.757" ; dur F:unisyn_duration ; 284 id 20406 ; name s ; end "5.927" ; start "5.810" ; dur F:unisyn_duration ; 285 id 20407 ; name ah ; end "6.005" ; start "5.927" ; dur F:unisyn_duration ; 286 id 20408 ; name n ; end "6.040" ; start "6.005" ; dur F:unisyn_duration ; 287 id 20409 ; name iy ; end "6.142" ; start "6.040" ; dur F:unisyn_duration ; 288 id 20431 ; name hh ; end "6.610" ; start "6.567" ; dur F:unisyn_duration ; 289 id 20432 ; name ay ; end "6.774" ; start "6.610" ; dur F:unisyn_duration ; 290 id 20433 ; name z ; end "6.820" ; start "6.774" ; dur F:unisyn_duration ; 291 id 20446 ; name ah ; end "6.908" ; start "6.820" ; dur F:unisyn_duration ; 292 id 20447 ; name p ; end "6.988" ; start "6.908" ; dur F:unisyn_duration ; 293 id 20448 ; name er ; end "7.040" ; start "6.988" ; dur F:unisyn_duration ; 294 id 20471 ; name f ; end "7.138" ; start "7.040" ; dur F:unisyn_duration ; 295 id 20472 ; name ih ; end "7.223" ; start "7.138" ; dur F:unisyn_duration ; 296 id 20473 ; name f ; end "7.254" ; start "7.223" ; dur F:unisyn_duration ; 297 id 20474 ; name t ; end "7.319" ; start "7.254" ; dur F:unisyn_duration ; 298 id 20475 ; name iy ; end "7.418" ; start "7.319" ; dur F:unisyn_duration ; 299 id 20476 ; name z ; end "7.534" ; start "7.418" ; dur F:unisyn_duration ; 300 id 20504 ; name t ; end "8.029" ; start "7.955" ; dur F:unisyn_duration ; 301 id 20505 ; name ax ; end "8.057" ; start "8.029" ; dur F:unisyn_duration ; 302 id 20506 ; name n ; end "8.103" ; start "8.057" ; dur F:unisyn_duration ; 303 id 20507 ; name ay ; end "8.285" ; start "8.103" ; dur F:unisyn_duration ; 304 id 20508 ; name t ; end "8.308" ; start "8.285" ; dur F:unisyn_duration ; 305 id 20535 ; name p ; end "8.567" ; start "8.308" ; dur F:unisyn_duration ; 306 id 20536 ; name aa ; end "8.613" ; start "8.567" ; dur F:unisyn_duration ; 307 id 20537 ; name r ; end "8.649" ; start "8.613" ; dur F:unisyn_duration ; 308 id 20538 ; name t ; end "8.696" ; start "8.649" ; dur F:unisyn_duration ; 309 id 20539 ; name l ; end "8.732" ; start "8.696" ; dur F:unisyn_duration ; 310 id 20540 ; name iy ; end "8.796" ; start "8.732" ; dur F:unisyn_duration ; 311 id 20566 ; name k ; end "8.891" ; start "8.796" ; dur F:unisyn_duration ; 312 id 20567 ; name l ; end "8.916" ; start "8.891" ; dur F:unisyn_duration ; 313 id 20568 ; name aw ; end "9.034" ; start "8.916" ; dur F:unisyn_duration ; 314 id 20569 ; name dx ; end "9.062" ; start "9.034" ; dur F:unisyn_duration ; 315 id 20570 ; name iy ; end "9.170" ; start "9.062" ; dur F:unisyn_duration ; 316 id 20592 ; name l ; end "9.293" ; start "9.170" ; dur F:unisyn_duration ; 317 id 20593 ; name ow ; end "9.479" ; start "9.293" ; dur F:unisyn_duration ; 318 id 20594 ; name z ; end "9.534" ; start "9.479" ; dur F:unisyn_duration ; 319 id 20607 ; name ah ; end "9.630" ; start "9.534" ; dur F:unisyn_duration ; 320 id 20608 ; name p ; end "9.712" ; start "9.630" ; dur F:unisyn_duration ; 321 id 20609 ; name er ; end "9.792" ; start "9.712" ; dur F:unisyn_duration ; 322 id 20631 ; name th ; end "9.865" ; start "9.792" ; dur F:unisyn_duration ; 323 id 20632 ; name er ; end "9.962" ; start "9.865" ; dur F:unisyn_duration ; 324 id 20633 ; name t ; end "10.016" ; start "9.962" ; dur F:unisyn_duration ; 325 id 20634 ; name iy ; end "10.129" ; start "10.016" ; dur F:unisyn_duration ; 326 id 20635 ; name z ; end "10.284" ; start "10.129" ; dur F:unisyn_duration ; 327 id 227 ; name pau ; end 0.265282 ; start 0 ; dur F:unisyn_duration ; 328 id 20001 ; name ay ; stress_num "0" ; end 0.354 ; start 0.265 ; dur F:unisyn_duration ; 329 id 20008 ; name n ; end 0.393 ; start 0.354 ; dur F:unisyn_duration ; 330 id 20009 ; name ow ; stress_num "1" ; end 0.547 ; start 0.393 ; dur F:unisyn_duration ; 331 id 20019 ; name ah ; stress_num "1" ; end 0.613 ; start 0.547 ; dur F:unisyn_duration ; 332 id 20020 ; name v ; end 0.647 ; start 0.613 ; dur F:unisyn_duration ; 333 id 20030 ; name f ; end 0.718 ; start 0.647 ; dur F:unisyn_duration ; 334 id 20031 ; name l ; end 0.744 ; start 0.718 ; dur F:unisyn_duration ; 335 id 20032 ; name ao ; stress_num "1" ; end 0.836 ; start 0.744 ; dur F:unisyn_duration ; 336 id 20033 ; name r ; end 0.888 ; start 0.836 ; dur F:unisyn_duration ; 337 id 20034 ; name ax ; stress_num "0" ; end 0.924 ; start 0.888 ; dur F:unisyn_duration ; 338 id 20035 ; name n ; end 0.958 ; start 0.924 ; dur F:unisyn_duration ; 339 id 20036 ; name s ; end 0.995 ; start 0.958 ; dur F:unisyn_duration ; 340 id 20064 ; name s ; end 1.05 ; start 0.995 ; dur F:unisyn_duration ; 341 id 20065 ; name aw ; stress_num "1" ; end 1.173 ; start 1.05 ; dur F:unisyn_duration ; 342 id 20066 ; name th ; end 1.239 ; start 1.173 ; dur F:unisyn_duration ; 343 id 20079 ; name k ; end 1.312 ; start 1.239 ; dur F:unisyn_duration ; 344 id 20080 ; name eh ; stress_num "2" ; end 1.367 ; start 1.312 ; dur F:unisyn_duration ; 345 id 20081 ; name r ; end 1.412 ; start 1.367 ; dur F:unisyn_duration ; 346 id 20082 ; name ax ; stress_num "0" ; end 1.439 ; start 1.412 ; dur F:unisyn_duration ; 347 id 20083 ; name l ; end 1.466 ; start 1.412 ; dur F:unisyn_duration ; 348 id 20084 ; name ay ; stress_num "1" ; end 1.602 ; start 1.466 ; dur F:unisyn_duration ; 349 id 20085 ; name n ; end 1.636 ; start 1.602 ; dur F:unisyn_duration ; 350 id 20086 ; name ax ; stress_num "0" ; end 1.775 ; start 1.636 ; dur F:unisyn_duration ; 351 id 20130 ; name ae ; stress_num "1" ; end 1.914 ; start 1.864 ; dur F:unisyn_duration ; 352 id 20131 ; name n ; end 1.946 ; start 1.914 ; dur F:unisyn_duration ; 353 id 20132 ; name d ; end 1.956 ; start 1.946 ; dur F:unisyn_duration ; 354 id 20143 ; name ey ; stress_num "0" ; end 2.006 ; start 1.956 ; dur F:unisyn_duration ; 355 id 20150 ; name f ; end 2.1 ; start 2.006 ; dur F:unisyn_duration ; 356 id 20151 ; name l ; end 2.134 ; start 2.1 ; dur F:unisyn_duration ; 357 id 20152 ; name ao ; stress_num "1" ; end 2.195 ; start 2.134 ; dur F:unisyn_duration ; 358 id 20153 ; name r ; end 2.249 ; start 2.195 ; dur F:unisyn_duration ; 359 id 20154 ; name ax ; stress_num "0" ; end 2.294 ; start 2.249 ; dur F:unisyn_duration ; 360 id 20155 ; name n ; end 2.336 ; start 2.294 ; dur F:unisyn_duration ; 361 id 20156 ; name s ; end 2.399 ; start 2.357 ; dur F:unisyn_duration ; 362 id 20185 ; name ih ; stress_num "1" ; end 2.504 ; start 2.399 ; dur F:unisyn_duration ; 363 id 20186 ; name t ; end 2.533 ; start 2.504 ; dur F:unisyn_duration ; 364 id 20187 ; name ax ; stress_num "0" ; end 2.575 ; start 2.533 ; dur F:unisyn_duration ; 365 id 20188 ; name l ; end 2.64 ; start 2.575 ; dur F:unisyn_duration ; 366 id 20189 ; name iy ; stress_num "0" ; end 2.761 ; start 2.64 ; dur F:unisyn_duration ; 367 id 20220 ; name ih ; stress_num "0" ; end 3.84 ; start 3.783 ; dur F:unisyn_duration ; 368 id 20221 ; name n ; end 3.903 ; start 3.84 ; dur F:unisyn_duration ; 369 id 20231 ; name f ; end 3.986 ; start 3.903 ; dur F:unisyn_duration ; 370 id 20232 ; name l ; end 4.035 ; start 3.986 ; dur F:unisyn_duration ; 371 id 20233 ; name ao ; stress_num "1" ; end 4.084 ; start 4.035 ; dur F:unisyn_duration ; 372 id 20234 ; name r ; end 4.126 ; start 4.084 ; dur F:unisyn_duration ; 373 id 20235 ; name ax ; stress_num "0" ; end 4.183 ; start 4.126 ; dur F:unisyn_duration ; 374 id 20236 ; name n ; end 4.224 ; start 4.183 ; dur F:unisyn_duration ; 375 id 20237 ; name s ; end 4.295 ; start 4.224 ; dur F:unisyn_duration ; 376 id 20265 ; name ih ; stress_num "0" ; end 4.316 ; start 4.295 ; dur F:unisyn_duration ; 377 id 20266 ; name n ; end 4.387 ; start 4.316 ; dur F:unisyn_duration ; 378 id 20276 ; name s ; end 4.463 ; start 4.387 ; dur F:unisyn_duration ; 379 id 20277 ; name aw ; stress_num "1" ; end 4.585 ; start 4.463 ; dur F:unisyn_duration ; 380 id 20278 ; name th ; end 4.646 ; start 4.585 ; dur F:unisyn_duration ; 381 id 20291 ; name k ; end 4.72 ; start 4.646 ; dur F:unisyn_duration ; 382 id 20292 ; name eh ; stress_num "2" ; end 4.769 ; start 4.72 ; dur F:unisyn_duration ; 383 id 20293 ; name r ; end 4.795 ; start 4.769 ; dur F:unisyn_duration ; 384 id 20294 ; name ax ; stress_num "0" ; end 4.826 ; start 4.795 ; dur F:unisyn_duration ; 385 id 20295 ; name l ; end 4.871 ; start 4.826 ; dur F:unisyn_duration ; 386 id 20296 ; name ay ; stress_num "1" ; end 4.998 ; start 4.871 ; dur F:unisyn_duration ; 387 id 20297 ; name n ; end 5.022 ; start 4.998 ; dur F:unisyn_duration ; 388 id 20298 ; name ax ; stress_num "0" ; end 5.09 ; start 5.022 ; dur F:unisyn_duration ; 389 id 20344 ; name t ; end 5.174 ; start 5.09 ; dur F:unisyn_duration ; 390 id 20345 ; name ax ; stress_num "0" ; end 5.206 ; start 5.174 ; dur F:unisyn_duration ; 391 id 20346 ; name d ; end 5.266 ; start 5.206 ; dur F:unisyn_duration ; 392 id 20347 ; name ey ; stress_num "1" ; end 5.468 ; start 5.266 ; dur F:unisyn_duration ; 393 id 20370 ; name m ; end 5.541 ; start 5.468 ; dur F:unisyn_duration ; 394 id 20371 ; name ow ; stress_num "1" ; end 5.639 ; start 5.541 ; dur F:unisyn_duration ; 395 id 20372 ; name s ; end 5.695 ; start 5.639 ; dur F:unisyn_duration ; 396 id 20373 ; name t ; end 5.738 ; start 5.695 ; dur F:unisyn_duration ; 397 id 20374 ; name l ; end 5.757 ; start 5.738 ; dur F:unisyn_duration ; 398 id 20375 ; name iy ; stress_num "0" ; end 5.81 ; start 5.757 ; dur F:unisyn_duration ; 399 id 20402 ; name s ; end 5.927 ; start 5.81 ; dur F:unisyn_duration ; 400 id 20403 ; name ah ; stress_num "1" ; end 6.005 ; start 5.927 ; dur F:unisyn_duration ; 401 id 20404 ; name n ; end 6.04 ; start 6.005 ; dur F:unisyn_duration ; 402 id 20405 ; name iy ; stress_num "0" ; end 6.142 ; start 6.04 ; dur F:unisyn_duration ; 403 id 20428 ; name hh ; end 6.61 ; start 6.567 ; dur F:unisyn_duration ; 404 id 20429 ; name ay ; stress_num "1" ; end 6.774 ; start 6.61 ; dur F:unisyn_duration ; 405 id 20430 ; name z ; end 6.82 ; start 6.774 ; dur F:unisyn_duration ; 406 id 20443 ; name ah ; stress_num "1" ; end 6.908 ; start 6.82 ; dur F:unisyn_duration ; 407 id 20444 ; name p ; end 6.988 ; start 6.908 ; dur F:unisyn_duration ; 408 id 20445 ; name er ; stress_num "0" ; end 7.04 ; start 6.988 ; dur F:unisyn_duration ; 409 id 20465 ; name f ; end 7.138 ; start 7.04 ; dur F:unisyn_duration ; 410 id 20466 ; name ih ; stress_num "1" ; end 7.223 ; start 7.138 ; dur F:unisyn_duration ; 411 id 20467 ; name f ; end 7.254 ; start 7.223 ; dur F:unisyn_duration ; 412 id 20468 ; name t ; end 7.319 ; start 7.254 ; dur F:unisyn_duration ; 413 id 20469 ; name iy ; stress_num "0" ; end 7.418 ; start 7.319 ; dur F:unisyn_duration ; 414 id 20470 ; name z ; end 7.534 ; start 7.418 ; dur F:unisyn_duration ; 415 id 20499 ; name t ; end 8.029 ; start 7.955 ; dur F:unisyn_duration ; 416 id 20500 ; name ax ; stress_num "0" ; end 8.057 ; start 8.029 ; dur F:unisyn_duration ; 417 id 20501 ; name n ; end 8.103 ; start 8.057 ; dur F:unisyn_duration ; 418 id 20502 ; name ay ; stress_num "1" ; end 8.285 ; start 8.103 ; dur F:unisyn_duration ; 419 id 20503 ; name t ; end 8.308 ; start 8.285 ; dur F:unisyn_duration ; 420 id 20529 ; name p ; end 8.567 ; start 8.308 ; dur F:unisyn_duration ; 421 id 20530 ; name aa ; stress_num "1" ; end 8.613 ; start 8.567 ; dur F:unisyn_duration ; 422 id 20531 ; name r ; end 8.649 ; start 8.613 ; dur F:unisyn_duration ; 423 id 20532 ; name t ; end 8.696 ; start 8.649 ; dur F:unisyn_duration ; 424 id 20533 ; name l ; end 8.732 ; start 8.696 ; dur F:unisyn_duration ; 425 id 20534 ; name iy ; stress_num "0" ; end 8.796 ; start 8.732 ; dur F:unisyn_duration ; 426 id 20561 ; name k ; end 8.891 ; start 8.796 ; dur F:unisyn_duration ; 427 id 20562 ; name l ; end 8.916 ; start 8.891 ; dur F:unisyn_duration ; 428 id 20563 ; name aw ; stress_num "1" ; end 9.034 ; start 8.916 ; dur F:unisyn_duration ; 429 id 20564 ; name d ; end 9.062 ; start 9.034 ; dur F:unisyn_duration ; 430 id 20565 ; name iy ; stress_num "0" ; end 9.17 ; start 9.062 ; dur F:unisyn_duration ; 431 id 20589 ; name l ; end 9.293 ; start 9.17 ; dur F:unisyn_duration ; 432 id 20590 ; name ow ; stress_num "1" ; end 9.479 ; start 9.293 ; dur F:unisyn_duration ; 433 id 20591 ; name z ; end 9.534 ; start 9.479 ; dur F:unisyn_duration ; 434 id 20604 ; name ah ; stress_num "1" ; end 9.63 ; start 9.534 ; dur F:unisyn_duration ; 435 id 20605 ; name p ; end 9.712 ; start 9.63 ; dur F:unisyn_duration ; 436 id 20606 ; name er ; stress_num "0" ; end 9.792 ; start 9.712 ; dur F:unisyn_duration ; 437 id 20626 ; name th ; end 9.865 ; start 9.792 ; dur F:unisyn_duration ; 438 id 20627 ; name er ; stress_num "1" ; end 9.962 ; start 9.865 ; dur F:unisyn_duration ; 439 id 20628 ; name t ; end 10.016 ; start 9.962 ; dur F:unisyn_duration ; 440 id 20629 ; name iy ; stress_num "0" ; end 10.129 ; start 10.016 ; dur F:unisyn_duration ; 441 id 20630 ; name z ; end 10.284 ; start 10.129 ; dur F:unisyn_duration ; 442 id 169 ; name B ; 443 id 170 ; name B ; 444 id 171 ; name B ; 445 id 172 ; name B ; 446 id 173 ; name B ; 447 id 219 ; name NT07 ; prob 0.856315 ; 448 id 221 ; name NT16 ; prob 0.746857 ; 449 id 222 ; name NT07 ; prob 0.856315 ; 450 id 214 ; name NT06 ; prob 0.00359625 ; 451 id 216 ; name NT04 ; prob 0.144629 ; 452 id 217 ; name NT08 ; prob 0.0169837 ; 453 id 209 ; name NT07 ; prob 0.856315 ; 454 id 211 ; name NT16 ; prob 0.746857 ; 455 id 212 ; name NT07 ; prob 0.856315 ; 456 id 206 ; name NT04 ; prob 0.144629 ; 457 id 207 ; name NT08 ; prob 0.0169837 ; 458 id 200 ; name NT15 ; prob 0.557206 ; 459 id 203 ; name NT07 ; prob 0.856315 ; 460 id 204 ; name NT07 ; prob 0.856315 ; 461 id 205 ; name NT07 ; prob 0.856315 ; 462 id 198 ; name NT01 ; prob 0.00128028 ; 463 id 199 ; name NT07 ; prob 0.856315 ; 464 id 175 ; name NT06 ; prob 0.212966 ; 465 id 177 ; name NT04 ; prob 0.671108 ; 466 id 187 ; name NT15 ; prob 0.0519477 ; 467 id 189 ; name NT01 ; prob 0.524988 ; 468 id 191 ; name NT07 ; prob 0.856315 ; 469 id 192 ; name NT07 ; prob 0.856315 ; 470 id 181 ; name NT15 ; prob 0.170466 ; 471 id 184 ; name NT07 ; prob 0.856315 ; 472 id 185 ; name NT07 ; prob 0.856315 ; 473 id 186 ; name NT07 ; prob 0.856315 ; 474 id 20644 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 475 id 20642 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 476 id 20643 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 477 id 20645 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 478 id 20640 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 479 id 20638 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 480 id 20639 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 481 id 20617 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 482 id 20615 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 483 id 20616 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 484 id 20612 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 485 id 20613 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 486 id 20598 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 487 id 20596 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 488 id 20597 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 489 id 20599 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 490 id 20579 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 491 id 20577 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 492 id 20578 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 493 id 20575 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 494 id 20573 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 495 id 20574 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 496 id 20549 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 497 id 20547 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 498 id 20548 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 499 id 20545 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 500 id 20543 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 501 id 20544 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 502 id 20550 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 503 id 20517 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 504 id 20515 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 505 id 20516 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 506 id 20518 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 507 id 20513 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 508 id 20511 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 509 id 20512 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 510 id 20485 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 511 id 20483 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 512 id 20484 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 513 id 20487 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 514 id 20481 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 515 id 20479 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 516 id 20480 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 517 id 20486 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 518 id 20456 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 519 id 20454 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 520 id 20455 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 521 id 20451 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 522 id 20452 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 523 id 20437 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 524 id 20435 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 525 id 20436 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 526 id 20438 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 527 id 20418 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 528 id 20416 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 529 id 20417 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 530 id 20414 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 531 id 20412 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 532 id 20413 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 533 id 20390 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 534 id 20388 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 535 id 20389 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 536 id 20386 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 537 id 20384 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 538 id 20385 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 539 id 20391 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 540 id 20360 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 541 id 20358 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 542 id 20359 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 543 id 20356 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 544 id 20354 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 545 id 20355 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 546 id 20323 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 547 id 20321 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 548 id 20322 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 549 id 20319 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 550 id 20317 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 551 id 20318 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 552 id 20315 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 553 id 20313 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 554 id 20314 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 555 id 20311 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 556 id 20309 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 557 id 20310 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 558 id 20285 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 559 id 20283 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 560 id 20284 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 561 id 20286 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 562 id 20270 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 563 id 20271 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 564 id 20272 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 565 id 20253 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 566 id 20251 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 567 id 20252 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 568 id 20254 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 569 id 20249 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 570 id 20247 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 571 id 20248 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 572 id 20225 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 573 id 20226 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 574 id 20227 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 575 id 20206 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 576 id 20204 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 577 id 20205 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 578 id 20202 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 579 id 20200 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 580 id 20201 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 581 id 20197 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 582 id 20198 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 583 id 20173 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 584 id 20171 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 585 id 20172 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 586 id 20174 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 587 id 20169 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 588 id 20167 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 589 id 20168 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 590 id 20146 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 591 id 20147 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 592 id 20137 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 593 id 20138 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 594 id 20139 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 595 id 20110 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 596 id 20108 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 597 id 20109 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 598 id 20106 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 599 id 20104 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 600 id 20105 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 601 id 20102 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 602 id 20100 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 603 id 20101 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 604 id 20098 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 605 id 20096 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 606 id 20097 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 607 id 20073 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 608 id 20071 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 609 id 20072 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 610 id 20074 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 611 id 20052 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 612 id 20050 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 613 id 20051 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 614 id 20053 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 615 id 20048 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 616 id 20046 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 617 id 20047 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 618 id 20024 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 619 id 20025 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 620 id 20026 ; sylval Coda ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 621 id 20015 ; sylval Onset ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 622 id 20013 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 623 id 20014 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 624 id 20004 ; sylval Rhyme ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; 625 id 20005 ; sylval Nucleus ; end F:unisyn_leaf_end ; start F:unisyn_leaf_start ; dur F:unisyn_duration ; time_path SylStructure ; End_of_Stream_Items Relations Relation Word ; filename /projects/unisyn/weather/wrd/ked_wr1_012.wrd ; signal ked_wr1_012 ; type "0" ; color "100" ; font -misc-*-bold-*-*-*-15-*-*-*-*-*-*-* ; separator ";" ; nfields "1" ; 27 27 0 0 0 26 26 26 0 0 27 25 25 25 0 0 26 24 24 24 0 0 25 23 23 23 0 0 24 22 22 22 0 0 23 21 21 21 0 0 22 20 20 20 0 0 21 19 19 19 0 0 20 18 18 18 0 0 19 17 17 17 0 0 18 16 16 16 0 0 17 15 15 15 0 0 16 14 14 14 0 0 15 13 13 13 0 0 14 12 12 12 0 0 13 11 11 11 0 0 12 10 10 10 0 0 11 9 9 9 0 0 10 8 8 8 0 0 9 7 7 7 0 0 8 6 6 6 0 0 7 5 5 5 0 0 6 4 4 4 0 0 5 3 3 3 0 0 4 2 2 2 0 0 3 1 1 1 0 0 2 0 End_of_Relation Relation Token ; End_of_Relation Relation LabelSegment ; 120 147 0 0 0 119 119 146 0 0 120 118 118 145 0 0 119 117 117 144 0 0 118 116 116 143 0 0 117 115 115 142 0 0 116 114 114 141 0 0 115 113 113 140 0 0 114 112 112 139 0 0 113 111 111 138 0 0 112 110 110 137 0 0 111 109 109 136 0 0 110 108 108 135 0 0 109 107 107 134 0 0 108 106 106 133 0 0 107 105 105 132 0 0 106 104 104 131 0 0 105 103 103 130 0 0 104 102 102 129 0 0 103 101 101 128 0 0 102 100 100 127 0 0 101 99 99 126 0 0 100 98 98 125 0 0 99 97 97 124 0 0 98 96 96 123 0 0 97 95 95 122 0 0 96 94 94 121 0 0 95 93 93 120 0 0 94 92 92 119 0 0 93 91 91 118 0 0 92 90 90 117 0 0 91 89 89 116 0 0 90 88 88 115 0 0 89 87 87 114 0 0 88 86 86 113 0 0 87 85 85 112 0 0 86 84 84 111 0 0 85 83 83 110 0 0 84 82 82 109 0 0 83 81 81 108 0 0 82 80 80 107 0 0 81 79 79 106 0 0 80 78 78 105 0 0 79 77 77 104 0 0 78 76 76 103 0 0 77 75 75 102 0 0 76 74 74 101 0 0 75 73 73 100 0 0 74 72 72 99 0 0 73 71 71 98 0 0 72 70 70 97 0 0 71 69 69 96 0 0 70 68 68 95 0 0 69 67 67 94 0 0 68 66 66 93 0 0 67 65 65 92 0 0 66 64 64 91 0 0 65 63 63 90 0 0 64 62 62 89 0 0 63 61 61 88 0 0 62 60 60 87 0 0 61 59 59 86 0 0 60 58 58 85 0 0 59 57 57 84 0 0 58 56 56 83 0 0 57 55 55 82 0 0 56 54 54 81 0 0 55 53 53 80 0 0 54 52 52 79 0 0 53 51 51 78 0 0 52 50 50 77 0 0 51 49 49 76 0 0 50 48 48 75 0 0 49 47 47 74 0 0 48 46 46 73 0 0 47 45 45 72 0 0 46 44 44 71 0 0 45 43 43 70 0 0 44 42 42 69 0 0 43 41 41 68 0 0 42 40 40 67 0 0 41 39 39 66 0 0 40 38 38 65 0 0 39 37 37 64 0 0 38 36 36 63 0 0 37 35 35 62 0 0 36 34 34 61 0 0 35 33 33 60 0 0 34 32 32 59 0 0 33 31 31 58 0 0 32 30 30 57 0 0 31 29 29 56 0 0 30 28 28 55 0 0 29 27 27 54 0 0 28 26 26 53 0 0 27 25 25 52 0 0 26 24 24 51 0 0 25 23 23 50 0 0 24 22 22 49 0 0 23 21 21 48 0 0 22 20 20 47 0 0 21 19 19 46 0 0 20 18 18 45 0 0 19 17 17 44 0 0 18 16 16 43 0 0 17 15 15 42 0 0 16 14 14 41 0 0 15 13 13 40 0 0 14 12 12 39 0 0 13 11 11 38 0 0 12 10 10 37 0 0 11 9 9 36 0 0 10 8 8 35 0 0 9 7 7 34 0 0 8 6 6 33 0 0 7 5 5 32 0 0 6 4 4 31 0 0 5 3 3 30 0 0 4 2 2 29 0 0 3 1 1 28 0 0 2 0 End_of_Relation Relation Syllable ; 48 184 0 0 0 47 47 183 0 0 48 46 46 182 0 0 47 45 45 181 0 0 46 44 44 25 0 0 45 43 43 180 0 0 44 42 42 179 0 0 43 41 41 178 0 0 42 40 40 177 0 0 41 39 39 176 0 0 40 38 38 175 0 0 39 37 37 174 0 0 38 36 36 173 0 0 37 35 35 172 0 0 36 34 34 171 0 0 35 33 33 19 0 0 34 32 32 170 0 0 33 31 31 169 0 0 32 30 30 168 0 0 31 29 29 167 0 0 30 28 28 166 0 0 29 27 27 165 0 0 28 26 26 164 0 0 27 25 25 163 0 0 26 24 24 162 0 0 25 23 23 161 0 0 24 22 22 14 0 0 23 21 21 13 0 0 22 20 20 160 0 0 21 19 19 159 0 0 20 18 18 11 0 0 19 17 17 158 0 0 18 16 16 157 0 0 17 15 15 156 0 0 16 14 14 155 0 0 15 13 13 154 0 0 14 12 12 8 0 0 13 11 11 7 0 0 12 10 10 153 0 0 11 9 9 152 0 0 10 8 8 151 0 0 9 7 7 150 0 0 8 6 6 5 0 0 7 5 5 149 0 0 6 4 4 148 0 0 5 3 3 3 0 0 4 2 2 2 0 0 3 1 1 1 0 0 2 0 End_of_Relation Relation MetricalTree ; 11 184 0 0 0 10 10 183 9 0 11 0 9 27 0 10 0 8 13 182 0 0 0 12 12 181 8 0 13 0 8 26 7 12 9 0 7 190 0 8 0 6 6 25 5 0 7 0 5 189 0 6 0 4 19 180 0 0 0 18 18 179 17 0 19 0 17 24 0 18 0 16 21 178 0 0 0 20 20 177 16 0 21 0 16 23 15 20 17 0 15 191 0 16 0 14 23 176 0 0 0 22 22 175 14 0 23 0 14 22 4 22 15 0 4 188 0 14 5 3 29 174 0 0 0 28 28 173 27 0 29 0 27 21 0 28 0 26 31 172 0 0 0 30 30 171 26 0 31 0 26 20 25 30 27 0 25 192 0 26 0 24 24 19 3 0 25 0 3 187 0 24 4 2 37 170 0 0 0 36 36 169 35 0 37 0 35 18 0 36 0 34 39 168 0 0 0 38 38 167 34 0 39 0 34 17 33 38 35 0 33 194 0 34 0 32 47 166 0 0 0 46 46 165 45 0 47 0 45 16 0 46 0 44 53 164 0 0 0 52 52 163 51 0 53 0 51 200 0 52 0 50 55 162 0 0 0 54 54 161 50 0 55 0 50 199 49 54 51 0 49 15 0 50 0 48 48 14 44 0 49 0 44 198 43 48 45 0 43 197 0 44 0 42 42 13 41 0 43 0 41 196 0 42 0 40 59 160 0 0 0 58 58 159 57 0 59 0 57 12 0 58 0 56 56 11 40 0 57 0 40 195 32 56 41 0 32 193 2 40 33 0 2 186 0 32 3 1 73 158 0 0 0 72 75 157 0 0 0 74 74 156 72 0 75 0 72 207 71 74 73 0 71 10 0 72 0 70 77 155 0 0 0 76 76 154 70 0 77 0 70 9 69 76 71 0 69 206 0 70 0 68 68 8 67 0 69 0 67 205 0 68 0 66 66 7 65 0 67 0 65 204 0 66 0 64 85 153 0 0 0 84 84 152 83 0 85 0 83 211 0 84 0 82 87 151 0 0 0 86 86 150 82 0 87 0 82 210 81 86 83 0 81 6 0 82 0 80 89 5 0 0 0 88 91 149 0 0 0 90 90 148 88 0 91 0 88 4 80 90 89 0 80 209 79 88 81 0 79 208 0 80 0 78 78 3 64 0 79 0 64 203 63 78 65 0 63 202 0 64 0 62 62 2 61 0 63 0 61 201 0 62 0 60 60 1 1 0 61 0 1 185 0 60 2 0 End_of_Relation Relation SurfacePhone ; 115 326 0 0 0 114 114 325 0 0 115 113 113 324 0 0 114 112 112 323 0 0 113 111 111 322 0 0 112 110 110 321 0 0 111 109 109 320 0 0 110 108 108 319 0 0 109 107 107 318 0 0 108 106 106 317 0 0 107 105 105 316 0 0 106 104 104 315 0 0 105 103 103 314 0 0 104 102 102 313 0 0 103 101 101 312 0 0 102 100 100 311 0 0 101 99 99 310 0 0 100 98 98 309 0 0 99 97 97 308 0 0 98 96 96 307 0 0 97 95 95 306 0 0 96 94 94 305 0 0 95 93 93 304 0 0 94 92 92 303 0 0 93 91 91 302 0 0 92 90 90 301 0 0 91 89 89 300 0 0 90 88 88 299 0 0 89 87 87 298 0 0 88 86 86 297 0 0 87 85 85 296 0 0 86 84 84 295 0 0 85 83 83 294 0 0 84 82 82 293 0 0 83 81 81 292 0 0 82 80 80 291 0 0 81 79 79 290 0 0 80 78 78 289 0 0 79 77 77 288 0 0 78 76 76 287 0 0 77 75 75 286 0 0 76 74 74 285 0 0 75 73 73 284 0 0 74 72 72 283 0 0 73 71 71 282 0 0 72 70 70 281 0 0 71 69 69 280 0 0 70 68 68 279 0 0 69 67 67 278 0 0 68 66 66 277 0 0 67 65 65 276 0 0 66 64 64 275 0 0 65 63 63 274 0 0 64 62 62 273 0 0 63 61 61 272 0 0 62 60 60 271 0 0 61 59 59 270 0 0 60 58 58 269 0 0 59 57 57 268 0 0 58 56 56 267 0 0 57 55 55 266 0 0 56 54 54 265 0 0 55 53 53 264 0 0 54 52 52 263 0 0 53 51 51 262 0 0 52 50 50 261 0 0 51 49 49 260 0 0 50 48 48 259 0 0 49 47 47 258 0 0 48 46 46 257 0 0 47 45 45 256 0 0 46 44 44 255 0 0 45 43 43 254 0 0 44 42 42 253 0 0 43 41 41 252 0 0 42 40 40 251 0 0 41 39 39 250 0 0 40 38 38 249 0 0 39 37 37 248 0 0 38 36 36 247 0 0 37 35 35 246 0 0 36 34 34 245 0 0 35 33 33 244 0 0 34 32 32 243 0 0 33 31 31 242 0 0 32 30 30 241 0 0 31 29 29 240 0 0 30 28 28 239 0 0 29 27 27 238 0 0 28 26 26 237 0 0 27 25 25 236 0 0 26 24 24 235 0 0 25 23 23 234 0 0 24 22 22 233 0 0 23 21 21 232 0 0 22 20 20 231 0 0 21 19 19 230 0 0 20 18 18 229 0 0 19 17 17 228 0 0 18 16 16 227 0 0 17 15 15 226 0 0 16 14 14 225 0 0 15 13 13 224 0 0 14 12 12 223 0 0 13 11 11 222 0 0 12 10 10 221 0 0 11 9 9 220 0 0 10 8 8 219 0 0 9 7 7 218 0 0 8 6 6 217 0 0 7 5 5 216 0 0 6 4 4 215 0 0 5 3 3 214 0 0 4 2 2 213 0 0 3 1 1 212 0 0 2 0 End_of_Relation Relation Intonation ; End_of_Relation Relation IntonationSyllable ; End_of_Relation Relation Segment ; 115 441 0 0 0 114 114 440 0 0 115 113 113 439 0 0 114 112 112 438 0 0 113 111 111 437 0 0 112 110 110 436 0 0 111 109 109 435 0 0 110 108 108 434 0 0 109 107 107 433 0 0 108 106 106 432 0 0 107 105 105 431 0 0 106 104 104 430 0 0 105 103 103 429 0 0 104 102 102 428 0 0 103 101 101 427 0 0 102 100 100 426 0 0 101 99 99 425 0 0 100 98 98 424 0 0 99 97 97 423 0 0 98 96 96 422 0 0 97 95 95 421 0 0 96 94 94 420 0 0 95 93 93 419 0 0 94 92 92 418 0 0 93 91 91 417 0 0 92 90 90 416 0 0 91 89 89 415 0 0 90 88 88 414 0 0 89 87 87 413 0 0 88 86 86 412 0 0 87 85 85 411 0 0 86 84 84 410 0 0 85 83 83 409 0 0 84 82 82 408 0 0 83 81 81 407 0 0 82 80 80 406 0 0 81 79 79 405 0 0 80 78 78 404 0 0 79 77 77 403 0 0 78 76 76 402 0 0 77 75 75 401 0 0 76 74 74 400 0 0 75 73 73 399 0 0 74 72 72 398 0 0 73 71 71 397 0 0 72 70 70 396 0 0 71 69 69 395 0 0 70 68 68 394 0 0 69 67 67 393 0 0 68 66 66 392 0 0 67 65 65 391 0 0 66 64 64 390 0 0 65 63 63 389 0 0 64 62 62 388 0 0 63 61 61 387 0 0 62 60 60 386 0 0 61 59 59 385 0 0 60 58 58 384 0 0 59 57 57 383 0 0 58 56 56 382 0 0 57 55 55 381 0 0 56 54 54 380 0 0 55 53 53 379 0 0 54 52 52 378 0 0 53 51 51 377 0 0 52 50 50 376 0 0 51 49 49 375 0 0 50 48 48 374 0 0 49 47 47 373 0 0 48 46 46 372 0 0 47 45 45 371 0 0 46 44 44 370 0 0 45 43 43 369 0 0 44 42 42 368 0 0 43 41 41 367 0 0 42 40 40 366 0 0 41 39 39 365 0 0 40 38 38 364 0 0 39 37 37 363 0 0 38 36 36 362 0 0 37 35 35 361 0 0 36 34 34 360 0 0 35 33 33 359 0 0 34 32 32 358 0 0 33 31 31 357 0 0 32 30 30 356 0 0 31 29 29 355 0 0 30 28 28 354 0 0 29 27 27 353 0 0 28 26 26 352 0 0 27 25 25 351 0 0 26 24 24 350 0 0 25 23 23 349 0 0 24 22 22 348 0 0 23 21 21 347 0 0 22 20 20 346 0 0 21 19 19 345 0 0 20 18 18 344 0 0 19 17 17 343 0 0 18 16 16 342 0 0 17 15 15 341 0 0 16 14 14 340 0 0 15 13 13 339 0 0 14 12 12 338 0 0 13 11 11 337 0 0 12 10 10 336 0 0 11 9 9 335 0 0 10 8 8 334 0 0 9 7 7 333 0 0 8 6 6 332 0 0 7 5 5 331 0 0 6 4 4 330 0 0 5 3 3 329 0 0 4 2 2 328 0 0 3 1 1 327 0 0 2 0 End_of_Relation Relation Phrase ; 11 27 0 0 0 10 10 26 0 0 11 9 9 25 0 0 10 8 8 24 0 0 9 7 7 23 0 0 8 6 6 22 5 0 7 0 5 446 0 6 0 4 16 21 0 0 0 15 15 20 0 0 16 14 14 19 0 0 15 13 13 18 0 0 14 12 12 17 4 0 13 0 4 445 0 12 5 3 22 16 0 0 0 21 21 15 0 0 22 20 20 14 0 0 21 19 19 13 0 0 20 18 18 12 0 0 19 17 17 11 3 0 18 0 3 444 0 17 4 2 26 10 0 0 0 25 25 9 0 0 26 24 24 8 0 0 25 23 23 7 2 0 24 0 2 443 0 23 3 1 32 6 0 0 0 31 31 5 0 0 32 30 30 4 0 0 31 29 29 3 0 0 30 28 28 2 0 0 29 27 27 1 1 0 28 0 1 442 0 27 2 0 End_of_Relation Relation Syntax ; 10 27 9 0 0 0 9 449 0 10 0 8 11 26 8 0 0 0 8 448 7 11 9 0 7 190 0 8 0 6 12 25 6 0 0 0 6 447 5 12 7 0 5 189 0 6 0 4 17 24 16 0 0 0 16 452 0 17 0 15 18 23 15 0 0 0 15 451 14 18 16 0 14 191 0 15 0 13 19 22 13 0 0 0 13 450 4 19 14 0 4 188 0 13 5 3 24 21 23 0 0 0 23 455 0 24 0 22 25 20 22 0 0 0 22 454 21 25 23 0 21 192 0 22 0 20 26 19 20 0 0 0 20 453 3 26 21 0 3 187 0 20 4 2 31 18 30 0 0 0 30 457 0 31 0 29 32 17 29 0 0 0 29 456 28 32 30 0 28 194 0 29 0 27 39 16 38 0 0 0 38 459 0 39 0 37 42 15 41 0 0 0 41 461 0 42 0 40 43 14 40 0 0 0 40 460 37 43 41 0 37 198 36 40 38 0 36 197 0 37 0 35 44 13 35 0 0 0 35 458 34 44 36 0 34 196 0 35 0 33 47 12 46 0 0 0 46 463 0 47 0 45 48 11 45 0 0 0 45 462 33 48 46 0 33 195 27 45 34 0 27 193 2 33 28 0 2 186 0 27 3 1 61 10 60 0 0 0 60 469 0 61 0 59 62 9 59 0 0 0 59 468 58 62 60 0 58 206 0 59 0 57 63 8 57 0 0 0 57 467 56 63 58 0 56 205 0 57 0 55 64 7 55 0 0 0 55 466 54 64 56 0 54 204 0 55 0 53 69 6 68 0 0 0 68 471 0 69 0 67 72 5 71 0 0 0 71 473 0 72 0 70 73 4 70 0 0 0 70 472 67 73 71 0 67 209 66 70 68 0 66 208 0 67 0 65 74 3 65 0 0 0 65 470 53 74 66 0 53 203 52 65 54 0 52 202 0 53 0 51 75 2 51 0 0 0 51 465 50 75 52 0 50 201 0 51 0 49 76 1 49 0 0 0 49 464 1 76 50 0 1 185 0 49 2 0 End_of_Relation Relation Match ; 116 326 115 0 0 0 115 441 0 116 0 114 117 325 114 0 0 0 114 440 0 117 115 113 118 324 113 0 0 0 113 439 0 118 114 112 119 323 112 0 0 0 112 438 0 119 113 111 120 322 111 0 0 0 111 437 0 120 112 110 121 321 110 0 0 0 110 436 0 121 111 109 122 320 109 0 0 0 109 435 0 122 110 108 123 319 108 0 0 0 108 434 0 123 109 107 124 318 107 0 0 0 107 433 0 124 108 106 125 317 106 0 0 0 106 432 0 125 107 105 126 316 105 0 0 0 105 431 0 126 106 104 127 315 104 0 0 0 104 430 0 127 105 103 128 314 103 0 0 0 103 429 0 128 104 102 129 313 102 0 0 0 102 428 0 129 103 101 130 312 101 0 0 0 101 427 0 130 102 100 131 311 100 0 0 0 100 426 0 131 101 99 132 310 99 0 0 0 99 425 0 132 100 98 133 309 98 0 0 0 98 424 0 133 99 97 134 308 97 0 0 0 97 423 0 134 98 96 135 307 96 0 0 0 96 422 0 135 97 95 136 306 95 0 0 0 95 421 0 136 96 94 137 305 94 0 0 0 94 420 0 137 95 93 138 304 93 0 0 0 93 419 0 138 94 92 139 303 92 0 0 0 92 418 0 139 93 91 140 302 91 0 0 0 91 417 0 140 92 90 141 301 90 0 0 0 90 416 0 141 91 89 142 300 89 0 0 0 89 415 0 142 90 88 143 299 88 0 0 0 88 414 0 143 89 87 144 298 87 0 0 0 87 413 0 144 88 86 145 297 86 0 0 0 86 412 0 145 87 85 146 296 85 0 0 0 85 411 0 146 86 84 147 295 84 0 0 0 84 410 0 147 85 83 148 294 83 0 0 0 83 409 0 148 84 82 149 293 82 0 0 0 82 408 0 149 83 81 150 292 81 0 0 0 81 407 0 150 82 80 151 291 80 0 0 0 80 406 0 151 81 79 152 290 79 0 0 0 79 405 0 152 80 78 153 289 78 0 0 0 78 404 0 153 79 77 154 288 77 0 0 0 77 403 0 154 78 76 155 287 76 0 0 0 76 402 0 155 77 75 156 286 75 0 0 0 75 401 0 156 76 74 157 285 74 0 0 0 74 400 0 157 75 73 158 284 73 0 0 0 73 399 0 158 74 72 159 283 72 0 0 0 72 398 0 159 73 71 160 282 71 0 0 0 71 397 0 160 72 70 161 281 70 0 0 0 70 396 0 161 71 69 162 280 69 0 0 0 69 395 0 162 70 68 163 279 68 0 0 0 68 394 0 163 69 67 164 278 67 0 0 0 67 393 0 164 68 66 165 277 66 0 0 0 66 392 0 165 67 65 166 276 65 0 0 0 65 391 0 166 66 64 167 275 64 0 0 0 64 390 0 167 65 63 168 274 63 0 0 0 63 389 0 168 64 62 169 273 62 0 0 0 62 388 0 169 63 61 170 272 61 0 0 0 61 387 0 170 62 60 171 271 60 0 0 0 60 386 0 171 61 59 172 270 59 0 0 0 59 385 0 172 60 58 173 269 58 0 0 0 58 384 0 173 59 57 174 268 57 0 0 0 57 383 0 174 58 56 175 267 56 0 0 0 56 382 0 175 57 55 176 266 55 0 0 0 55 381 0 176 56 54 177 265 54 0 0 0 54 380 0 177 55 53 178 264 53 0 0 0 53 379 0 178 54 52 179 263 52 0 0 0 52 378 0 179 53 51 180 262 51 0 0 0 51 377 0 180 52 50 181 261 50 0 0 0 50 376 0 181 51 49 182 260 49 0 0 0 49 375 0 182 50 48 183 259 48 0 0 0 48 374 0 183 49 47 184 258 47 0 0 0 47 373 0 184 48 46 185 257 46 0 0 0 46 372 0 185 47 45 186 256 45 0 0 0 45 371 0 186 46 44 187 255 44 0 0 0 44 370 0 187 45 43 188 254 43 0 0 0 43 369 0 188 44 42 189 253 42 0 0 0 42 368 0 189 43 41 190 252 41 0 0 0 41 367 0 190 42 40 191 251 40 0 0 0 40 366 0 191 41 39 192 250 39 0 0 0 39 365 0 192 40 38 193 249 38 0 0 0 38 364 0 193 39 37 194 248 37 0 0 0 37 363 0 194 38 36 195 247 36 0 0 0 36 362 0 195 37 35 196 246 35 0 0 0 35 361 0 196 36 34 197 244 34 0 0 0 34 360 0 197 35 33 198 243 33 0 0 0 33 359 0 198 34 32 199 242 32 0 0 0 32 358 0 199 33 31 200 241 31 0 0 0 31 357 0 200 32 30 201 240 30 0 0 0 30 356 0 201 31 29 202 239 29 0 0 0 29 355 0 202 30 28 203 238 28 0 0 0 28 354 0 203 29 27 204 237 27 0 0 0 27 353 0 204 28 26 205 236 26 0 0 0 26 352 0 205 27 25 206 235 25 0 0 0 25 351 0 206 26 24 207 234 24 0 0 0 24 350 0 207 25 23 208 233 23 0 0 0 23 349 0 208 24 22 209 232 22 0 0 0 22 348 0 209 23 21 210 231 21 0 0 0 21 347 0 210 22 20 20 346 0 0 21 19 211 230 19 0 0 0 19 345 0 211 20 18 212 229 18 0 0 0 18 344 0 212 19 17 213 228 17 0 0 0 17 343 0 213 18 16 214 227 16 0 0 0 16 342 0 214 17 15 215 226 15 0 0 0 15 341 0 215 16 14 216 225 14 0 0 0 14 340 0 216 15 13 217 224 13 0 0 0 13 339 0 217 14 12 218 223 12 0 0 0 12 338 0 218 13 11 219 222 11 0 0 0 11 337 0 219 12 10 220 221 10 0 0 0 10 336 0 220 11 9 221 220 9 0 0 0 9 335 0 221 10 8 222 219 8 0 0 0 8 334 0 222 9 7 223 218 7 0 0 0 7 333 0 223 8 6 224 217 6 0 0 0 6 332 0 224 7 5 225 216 5 0 0 0 5 331 0 225 6 4 226 215 4 0 0 0 4 330 0 226 5 3 227 214 3 0 0 0 3 329 0 227 4 2 228 213 2 0 0 0 2 328 0 228 3 1 229 212 1 0 0 0 1 327 0 229 2 0 End_of_Relation Relation NewMatch ; End_of_Relation Relation SylStructure ; 53 441 52 0 0 0 52 477 0 53 0 51 54 440 51 0 0 0 51 476 50 54 52 0 50 475 0 51 0 49 55 439 49 0 0 0 49 474 48 55 50 0 48 184 0 49 0 47 59 438 58 0 0 0 58 480 57 59 0 0 57 479 0 58 0 56 60 437 56 0 0 0 56 478 47 60 57 0 47 183 0 56 48 46 64 436 63 0 0 0 63 483 62 64 0 0 62 482 0 63 0 61 65 435 61 0 0 0 61 481 46 65 62 0 46 182 0 61 47 45 68 434 67 0 0 0 67 485 66 68 0 0 66 484 45 67 0 0 45 181 0 66 46 44 73 433 72 0 0 0 72 489 0 73 0 71 74 432 71 0 0 0 71 488 70 74 72 0 70 487 0 71 0 69 75 431 69 0 0 0 69 486 44 75 70 0 44 25 0 69 45 43 79 430 78 0 0 0 78 492 77 79 0 0 77 491 0 78 0 76 80 429 76 0 0 0 76 490 43 80 77 0 43 180 0 76 44 42 84 428 83 0 0 0 83 495 82 84 0 0 82 494 0 83 0 81 86 427 0 0 0 85 85 426 81 0 86 0 81 493 42 85 82 0 42 179 0 81 43 41 90 425 89 0 0 0 89 498 88 90 0 0 88 497 0 89 0 87 91 424 87 0 0 0 87 496 41 91 88 0 41 178 0 87 42 40 97 423 0 0 0 96 96 422 95 0 97 0 95 502 0 96 0 94 98 421 94 0 0 0 94 501 93 98 95 0 93 500 0 94 0 92 99 420 92 0 0 0 92 499 40 99 93 0 40 177 0 92 41 39 104 419 103 0 0 0 103 506 0 104 0 102 105 418 102 0 0 0 102 505 101 105 103 0 101 504 0 102 0 100 106 417 100 0 0 0 100 503 39 106 101 0 39 176 0 100 40 38 110 416 109 0 0 0 109 509 108 110 0 0 108 508 0 109 0 107 111 415 107 0 0 0 107 507 38 111 108 0 38 175 0 107 39 37 116 414 115 0 0 0 115 513 0 116 0 114 117 413 114 0 0 0 114 512 113 117 115 0 113 511 0 114 0 112 118 412 112 0 0 0 112 510 37 118 113 0 37 174 0 112 38 36 123 411 122 0 0 0 122 517 0 123 0 121 124 410 121 0 0 0 121 516 120 124 122 0 120 515 0 121 0 119 125 409 119 0 0 0 119 514 36 125 120 0 36 173 0 119 37 35 129 408 128 0 0 0 128 520 127 129 0 0 127 519 0 128 0 126 130 407 126 0 0 0 126 518 35 130 127 0 35 172 0 126 36 34 133 406 132 0 0 0 132 522 131 133 0 0 131 521 34 132 0 0 34 171 0 131 35 33 138 405 137 0 0 0 137 526 0 138 0 136 139 404 136 0 0 0 136 525 135 139 137 0 135 524 0 136 0 134 140 403 134 0 0 0 134 523 33 140 135 0 33 19 0 134 34 32 144 402 143 0 0 0 143 529 142 144 0 0 142 528 0 143 0 141 145 401 141 0 0 0 141 527 32 145 142 0 32 170 0 141 33 31 149 400 148 0 0 0 148 532 147 149 0 0 147 531 0 148 0 146 150 399 146 0 0 0 146 530 31 150 147 0 31 169 0 146 32 30 154 398 153 0 0 0 153 535 152 154 0 0 152 534 0 153 0 151 155 397 151 0 0 0 151 533 30 155 152 0 30 168 0 151 31 29 161 396 0 0 0 160 160 395 159 0 161 0 159 539 0 160 0 158 162 394 158 0 0 0 158 538 157 162 159 0 157 537 0 158 0 156 163 393 156 0 0 0 156 536 29 163 157 0 29 167 0 156 30 28 167 392 166 0 0 0 166 542 165 167 0 0 165 541 0 166 0 164 168 391 164 0 0 0 164 540 28 168 165 0 28 166 0 164 29 27 172 390 171 0 0 0 171 545 170 172 0 0 170 544 0 171 0 169 173 389 169 0 0 0 169 543 27 173 170 0 27 165 0 169 28 26 177 388 176 0 0 0 176 548 175 177 0 0 175 547 0 176 0 174 178 387 174 0 0 0 174 546 26 178 175 0 26 164 0 174 27 25 182 386 181 0 0 0 181 551 180 182 0 0 180 550 0 181 0 179 183 385 179 0 0 0 179 549 25 183 180 0 25 163 0 179 26 24 187 384 186 0 0 0 186 554 185 187 0 0 185 553 0 186 0 184 188 383 184 0 0 0 184 552 24 188 185 0 24 162 0 184 25 23 192 382 191 0 0 0 191 557 190 192 0 0 190 556 0 191 0 189 193 381 189 0 0 0 189 555 23 193 190 0 23 161 0 189 24 22 198 380 197 0 0 0 197 561 0 198 0 196 199 379 196 0 0 0 196 560 195 199 197 0 195 559 0 196 0 194 200 378 194 0 0 0 194 558 22 200 195 0 22 14 0 194 23 21 204 377 203 0 0 0 203 564 0 204 0 202 205 376 202 0 0 0 202 563 201 205 203 0 201 562 21 202 0 0 21 13 0 201 22 20 211 375 0 0 0 210 210 374 209 0 211 0 209 568 0 210 0 208 212 373 208 0 0 0 208 567 207 212 209 0 207 566 0 208 0 206 213 372 206 0 0 0 206 565 20 213 207 0 20 160 0 206 21 19 217 371 216 0 0 0 216 571 215 217 0 0 215 570 0 216 0 214 219 370 0 0 0 218 218 369 214 0 219 0 214 569 19 218 215 0 19 159 0 214 20 18 223 368 222 0 0 0 222 574 0 223 0 221 224 367 221 0 0 0 221 573 220 224 222 0 220 572 18 221 0 0 18 11 0 220 19 17 228 366 227 0 0 0 227 577 226 228 0 0 226 576 0 227 0 225 229 365 225 0 0 0 225 575 17 229 226 0 17 158 0 225 18 16 233 364 232 0 0 0 232 580 231 233 0 0 231 579 0 232 0 230 234 363 230 0 0 0 230 578 16 234 231 0 16 157 0 230 17 15 237 362 236 0 0 0 236 582 235 237 0 0 235 581 15 236 0 0 15 156 0 235 16 14 243 361 0 0 0 242 242 360 241 0 243 0 241 586 0 242 0 240 244 359 240 0 0 0 240 585 239 244 241 0 239 584 0 240 0 238 245 358 238 0 0 0 238 583 14 245 239 0 14 155 0 238 15 13 249 357 248 0 0 0 248 589 247 249 0 0 247 588 0 248 0 246 251 356 0 0 0 250 250 355 246 0 251 0 246 587 13 250 247 0 13 154 0 246 14 12 254 354 253 0 0 0 253 591 252 254 0 0 252 590 12 253 0 0 12 8 0 252 13 11 259 353 0 0 0 258 258 352 257 0 259 0 257 594 0 258 0 256 260 351 256 0 0 0 256 593 255 260 257 0 255 592 11 256 0 0 11 7 0 255 12 10 264 350 263 0 0 0 263 597 262 264 0 0 262 596 0 263 0 261 265 349 261 0 0 0 261 595 10 265 262 0 10 153 0 261 11 9 269 348 268 0 0 0 268 600 267 269 0 0 267 599 0 268 0 266 270 347 266 0 0 0 266 598 9 270 267 0 9 152 0 266 10 8 274 346 273 0 0 0 273 603 272 274 0 0 272 602 0 273 0 271 275 345 271 0 0 0 271 601 8 275 272 0 8 151 0 271 9 7 279 344 278 0 0 0 278 606 277 279 0 0 277 605 0 278 0 276 280 343 276 0 0 0 276 604 7 280 277 0 7 150 0 276 8 6 285 342 284 0 0 0 284 610 0 285 0 283 286 341 283 0 0 0 283 609 282 286 284 0 282 608 0 283 0 281 287 340 281 0 0 0 281 607 6 287 282 0 6 5 0 281 7 5 293 339 0 0 0 292 292 338 291 0 293 0 291 614 0 292 0 290 294 337 290 0 0 0 290 613 289 294 291 0 289 612 0 290 0 288 295 336 288 0 0 0 288 611 5 295 289 0 5 149 0 288 6 4 299 335 298 0 0 0 298 617 297 299 0 0 297 616 0 298 0 296 301 334 0 0 0 300 300 333 296 0 301 0 296 615 4 300 297 0 4 148 0 296 5 3 305 332 304 0 0 0 304 620 0 305 0 303 306 331 303 0 0 0 303 619 302 306 304 0 302 618 3 303 0 0 3 3 0 302 4 2 310 330 309 0 0 0 309 623 308 310 0 0 308 622 0 309 0 307 311 329 307 0 0 0 307 621 2 311 308 0 2 2 0 307 3 1 314 328 313 0 0 0 313 625 312 314 0 0 312 624 1 313 0 0 1 1 0 312 2 0 End_of_Relation End_of_Relations End_of_Utterance speech_tools/lib/example_data/kdt_001.il0000644000076400007640000000042007262605664016554 0ustar awbawbseparator ; nfields 2 # 0.403097 146 sil 0.870842 146 c 1.068588 146 a 1.266334 146 c 1.414644 146 afb 1.604784 146 c 1.764502 146 a 1.950839 146 c 2.125768 146 a 2.536471 146 c 3.014076 146 afb 3.118300 146 sil speech_tools/lib/example_data/kdt_001.tilt0000644000076400007640000000150507262605664017131 0ustar awbawbseparator ; filename ../lib/example_data/kdt_001.il separator ; nfields 2 name intevents timing_style event intonation_style tilt # 0.40310 26 phrase_start ; ev.f0 120.335 ; time 0.403097 ; 1.00000 26 a ; int_event 1 ; ev.f0 126.04 ; time 0.999999 ; tilt.amp 21.3901 ; tilt.dur 0.29 ; tilt.tilt 0.483891 ; 1.26000 26 afb ; int_event 1 ; ev.f0 120.447 ; time 1.26 ; tilt.amp 11.9286 ; tilt.dur 0.24 ; tilt.tilt -1 ; 1.72000 26 a ; int_event 1 ; ev.f0 125.077 ; time 1.72 ; tilt.amp 18.0792 ; tilt.dur 0.26 ; tilt.tilt 0.567867 ; 2.04000 26 a ; int_event 1 ; ev.f0 128.473 ; time 2.04 ; tilt.amp 19.3316 ; tilt.dur 0.27 ; tilt.tilt -0.21705 ; 2.76000 26 afb ; int_event 1 ; ev.f0 115.2 ; time 2.76 ; tilt.amp 40.8284 ; tilt.dur 0.45 ; tilt.tilt 0.026982 ; 3.01408 26 phrase_end ; ev.f0 89.1348 ; time 3.01408 ; speech_tools/lib/siod/Makefile0000644000076400007640000000606407262605664015050 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Scheme In One Defun library. Some fo this is copied to festival/lib ## ## ## ########################################################################### TOP=../.. DIRNAME=lib/siod SCHEME_FILES=siod.scm init.scm web.scm cstr.scm fringe.scm \ siod_server.scm siod_client.scm FILES = Makefile $(SCHEME_FILES) include $(TOP)/config/common_make_rules speech_tools/lib/siod/siod.scm0000644000076400007640000004231610520671561015040 0ustar awbawb;; SIOD: Scheme In One Defun -*-mode:scheme-*- ;; ;; * COPYRIGHT (c) 1989-1992 BY * ;; * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * ;; * See the source file SLIB.C for more information. * ;; ;; A fair amount of modifications and tidy up was done by AWB, particularly ;; * adding documentation strings to all functions/variable ;; * removing some example functions not relevant to Festival (or siod) ;; * addition of new functions (require provide etc) ;(puts ";; Optional Runtime Library for Release 2.8 ;") (define list (lambda n "(list A0 A1 ...) Return list containing A0 A1 ..." n)) (define (caar x) "(caar X) Return the (car (car X))." (car (car x))) (define (cadr x) "(cadr X) Return the (car (cdr X))." (car (cdr x))) (define (cdar x) "(cdar X) Return the (cdr (car X))." (cdr (car x))) (define (cddr x) "(cddr X) Return the (cdr (cdr X))." (cdr (cdr x))) (define (caddr x) "(caddr X) Return the (car (cdr (cdr X)))." (car (cdr (cdr x)))) (define (cdddr x) "(cdddr X) Return the (cdr (cdr (cdr X)))." (cdr (cdr (cdr x)))) (define consp pair?) (define (replace before after) "(replace BEFORE AFTER) Destructively replace contents of cons cell BEFORE with those of AFTER." (set-car! before (car after)) (set-cdr! before (cdr after)) after) (define (prognify forms) (if (null? (cdr forms)) (car forms) (cons 'begin forms))) (define (defmac-macro form) "(defmac-macro MACRONAME FORM) Define a macro. Macro expand FORM in-line." (let ((sname (car (cadr form))) (argl (cdr (cadr form))) (fname nil) (body (prognify (cddr form)))) (set! fname (symbolconc sname '-macro)) (list 'begin (list 'define (cons fname argl) (list 'replace (car argl) body)) (list 'define sname (list 'quote fname))))) (define defmac 'defmac-macro) (defmac (push form) (list 'set! (caddr form) (list 'cons (cadr form) (caddr form)))) (defmac (pop form) (list 'let (list (list 'tmp (cadr form))) (list 'set! (cadr form) '(cdr tmp)) '(car tmp))) ;;; Have to set var-docstrings to nil first as defvar requires it to be set (set! var-docstrings nil) (define (add-doc-var varname docstring) "(add-doc-var VARNAME DOCSTRING) Add document string DOCSTRING to VARNAME. If DOCSTRING is nil this has no effect. If VARNAME already has a document string replace it with DOCSTRING." (if (null? docstring) t (let ((lpair (assq varname var-docstrings))) (if lpair (set-cdr! lpair docstring) (set! var-docstrings (cons (cons varname docstring) var-docstrings)))))) (set! boundp symbol-bound?) (defmac (defvar form) (begin ;; always add the documentation string (add-doc-var (cadr form) (car (cdddr form))) (list 'or (list 'symbol-bound? (list 'quote (cadr form))) (list 'define (cadr form) (caddr form))))) (defvar var-docstrings nil "var-docstrings An assoc-list of variable names and their documentation strings.") (defmac (defun form) (cons 'define (cons (cons (cadr form) (caddr form)) (cdddr form)))) (defmac (setq form) (let ((l (cdr form)) (result nil)) (define (loop) (if l (begin (push (list 'set! (car l) (cadr l)) result) (set! l (cddr l)) (loop)))) (loop) (prognify (reverse result)))) (define progn begin) (defun atom (x) "(atom X) True if X is not a cons cells, nil otherwise." (not (consp x))) (define eq eq?) (defmac (cond form) (cond-convert (cdr form))) (define null null?) (defun cond-convert (l) (if (null l) () (if (null (cdar l)) (if (null (cdr l)) (caar l) (let ((rest (cond-convert (cdr l)))) (if (and (consp rest) (eq (car rest) 'or)) (cons 'or (cons (caar l) (cdr rest))) (list 'or (caar l) rest)))) (if (or (eq (caar l) 't) (and (consp (caar l)) (eq (car (caar l)) 'quote))) (prognify (cdar l)) (list 'if (caar l) (prognify (cdar l)) (cond-convert (cdr l))))))) (defmac (+internal-comma form) (error 'comma-not-inside-backquote)) (define +internal-comma-atsign +internal-comma) (define +internal-comma-dot +internal-comma) (defmac (+internal-backquote form) (backquotify (cdr form))) (defun backquotify (x) "(backquote FORM) Backquote function for expanding forms in macros." (let (a d aa ad dqp) (cond ((atom x) (list 'quote x)) ((eq (car x) '+internal-comma) (cdr x)) ((or (atom (car x)) (not (or (eq (caar x) '+internal-comma-atsign) (eq (caar x) '+internal-comma-dot)))) (setq a (backquotify (car x)) d (backquotify (cdr x)) ad (atom d) aa (atom a) dqp (and (not ad) (eq (car d) 'quote))) (cond ((and dqp (not (atom a)) (eq (car a) 'quote)) (list 'quote (cons (cadr a) (cadr d)))) ((and dqp (null (cadr d))) (list 'list a)) ((and (not ad) (eq (car d) 'list)) (cons 'list (cons a (cdr d)))) (t (list 'cons a d)))) ((eq (caar x) '+internal-comma-atsign) (list 'append (cdar x) (backquotify (cdr x)))) ((eq (caar x) '+internal-comma-dot) (list 'nconc (cdar x)(backquotify (cdr x))))))) (defun append n "(append L0 L1 ...) Append each list to the first list in turn." (appendl n)) (defun appendl (l) (cond ((null l) nil) ((null (cdr l)) (car l)) ((null (cddr l)) (append2 (car l) (cadr l))) ('else (append2 (car l) (appendl (cdr l)))))) (defun append2 (a b) (if (null a) b (begin (let ((x (reverse a)) (y b)) (while x (set! y (cons (car x) y)) (set! x (cdr x))) y)))) (defun rplacd (a b) "(replacd A B) Destructively replace the cdr of A with B." (set-cdr! a b) a) (defun nconc (a b) "(nconc A B) Destructively append B to A, if A is nil return B." (if (null a) b (rplacd (last a) b))) (defun last (a) "(last A) Last (cdr) element in list A." (cond ((null a) (error'null-arg-to-last)) ((null (cdr a)) a) ((last (cdr a))))) (define (remove i l) "(remove ITEM LIST) (Non-destructively) remove ITEM from LIST." (cond ((null l) nil) ((eq? i (car l)) (cdr l)) (t (cons (car l) (remove i (cdr l)))))) (define (remove-duplicates l) "(remove-duplicates LIST) Remove duplicate items in LIST." (cond ((null l) l) ((member_string (car l) (cdr l)) (remove-duplicates (cdr l))) (t (cons (car l) (remove-duplicates (cdr l)))))) (define (nth n l) "(nth N LIST) Returns nth car of LIST, 0 is car." (if (< n 1) (car l) (nth (- n 1) (cdr l)))) (define (position thing l) "(position thing l) What position is thing in l, -1 if it doesn't exist." (let ((p 0) (m l)) (while (and m (not (equal? thing (car m)))) (set! p (+ 1 p)) (set! m (cdr m))) (if m p nil))) (define (nth_cdr n l) "(nth_cdr N LIST) Returns nth cdr of LIST, 0 is LIST." (if (< n 1) l (nth_cdr (- n 1) (cdr l)))) (define (<= a b) "(<= NUM1 NUM2) Returns t if NUM1 is less than or equal to NUM2, nil otherwise. An error is given is either argument is not a number." (or (< a b) (equal? a b))) (define (>= a b) "(>= NUM1 NUM2) Returns t if NUM1 is greater than or equal to NUM2, nil otherwise. An error is given is either argument is not a number." (or (> a b) (equal? a b))) (define (approx-equal? a b diff) "(approx-equal? a b diff) True is the difference between a b is less than diff. This allows equality between floats which may have been written out and read in and hence have slightly different precision." (< (if (> a b) (- a b) (- b a)) diff)) (define (assoc_string key alist) "(assoc_string key alist) Look up key in alist using string-equal. This allow indexing by string rather than just symbols." (cond ((null alist) nil) ((string-equal key (car (car alist))) (car alist)) (t (assoc_string key (cdr alist)))) ) (defvar *fasdump-hash* t) (defun fasl-open (filename mode) "(fasl-open FILENAME MODE) Open fasl FILENAME as MODE. Returns a fasl-table." (list (fopen filename mode) (if (or (equal? mode "rb") *fasdump-hash*) (cons-array 100)) ;; If this is set NIL, then already hashed symbols will be ;; optimized, and additional ones will not. 0)) (defun fasl-close (table) "(fasl-close TABLE) Close fasl table." (fclose (car table))) (defun fasload args "(fasload FILENAME ARGS) Fast load FILENAME." (let ((filename (car args)) (head (and (cadr args) (cons nil nil)))) (let ((table (fasl-open filename "rb")) (exp) (tail head)) (while (not (eq table (setq exp (fast-read table)))) (cond (head (setq exp (cons exp nil)) (set-cdr! tail exp) (setq tail exp)) ('else (eval exp)))) (fasl-close table) (and head (cdr head))))) (defun fasdump (filename forms) "(fasdump FILENAME FORMS) Fast dump FORMS into FILENAME." (let ((table (fasl-open filename "wb")) (l forms)) (while l (fast-print (car l) table) (set! l (cdr l))) (fasl-close table))) (defun compile-file (filename) "(compile-file FILENAME) Compile lisp forms in FILENAME.scm to FILENAME.bin." (let ((forms (load (string-append filename ".scm") t))) (puts "Saving forms ") (fasdump (string-append filename ".bin") forms))) (defvar *properties* (cons-array 100) "*properties* Array for holding symbol property lists.") (defun get (sym key) "(get SYM KEY) Get property named KEY for SYM." (cdr (assq key (href *properties* sym)))) (defun putprop (sym val key) "(putprop SYM VAL KEY) Put property VAL named KEY for SYM." (let ((alist (href *properties* sym))) (let ((cell (assq key alist))) (cond (cell (set-cdr! cell val)) ('else (hset *properties* sym (cons (cons key val) alist)) val))))) ;;(define (mapcar1 f l1) ;; (and l1 (cons (f (car l1)) (mapcar1 f (cdr l1))))) ;; An iterative version of the above (define (mapcar1 f l1) (let ((l2 l1) (r nil)) (while l2 (set! r (cons (f (car l2)) r)) (set! l2 (cdr l2))) (reverse r))) ;;(define (mapcar2 f l1 l2) ;; (and l1 l2 (cons (f (car l1) (car l2)) (mapcar2 f (cdr l1) (cdr l2))))) ;; An iterative version (define (mapcar2 f l1 l2) (let ((a1 l1) (a2 l2) (r nil)) (while a1 (set! r (cons (f (car a1) (car a2)) r)) (set! a1 (cdr a1)) (set! a2 (cdr a2))) (reverse r))) (define (mapcar . args) "(mapcar FUNCTION ARGS [ARGS2]) Apply FUNCTION to each member of ARGS (and [ARGS2]), returning list of return values." (cond ((null args) (error "too few arguments")) ((null (cdr args)) (error "too few arguments")) ((null (cdr (cdr args))) (mapcar1 (car args) (car (cdr args)))) ((null (cdr (cdr (cdr args)))) (mapcar2 (car args) (car (cdr args)) (car (cdr (cdr args))))) ('else (error "two many arguments")))) ;; will be set automatically on start-up (defvar libdir ' "libdir The pathname of the run-time libary directory. Note reseting is almost definitely not what you want to do. This value is automatically set at start up from the value specifed at compile-time or the value specifed with --libdir on the command line. A number of other variables depend on this value.") (defvar load-path (list libdir) "load-path A list of directories containing .scm files. Used for various functions such as load_library and require. Follows the same use as EMACS. By default it is set up to the compile-time library directory but may be changed by the user at run time, by adding a user's own library directory or even replacing all of the standard library. [see Site initialization]") ;; will be set automatically on start-up (defvar *ostype* 'unknown "*ostype* Contains the name of the operating system type that Festival is running on, e.g. SunOS5, FreeBSD, linux etc. The value is taken from the Makefile variable OSTYPE at compile time.") (defvar etc-path (path-append libdir "etc/" *ostype*) "etc-path A list of directories where binaries specific to Festival may be located. This variable is automatically set to LIBDIR/etc/OSTYPE/ and that path is added to the end of the UNIX PATH environment variable.") (define (library_expand_filename fname) "(library_expand_filename FILENAME) Search for filename by appending FILENAME to each member of load-path. Full expanded pathname is returned. If not found in load-path FILENAME is returned." (let ((p load-path) (found nil)) (while (and p (null? found)) (let ((pot-file (path-append (car p) fname))) (if (probe_file pot-file) (setq found pot-file)) (setq p (cdr p)))) (if (null? found) fname found))) (define (load_library fname) "(load_library FILENAME) Load file from library, appends FILENAME to each path in load-path until a valid file is found. If none found loads name itself" (load (library_expand_filename fname))) (define (fasload_library fname) "(fasload_library FILENAME) Load binary file from library" (fasload (library_expand_filename fname))) (define (member item list) "(member ITEM LIST) Returns subset of LIST whose car is ITEM if it exists, nil otherwise." (if (consp list) (if (equal? item (car list)) list (member item (cdr list))) nil)) (define (member_string item list) "(member_string STRING LIST) Returns subset of LIST whose car is STRING if it exists, nil otherwise." (if (consp list) (if (string-equal item (car list)) list (member_string item (cdr list))) nil)) (defvar provided nil "provided List of file names (omitting .scm) that have been provided. This list is checked by the require function to find out if a file needs to be loaded. If that file is already in this list it is not loaded. Typically a file will have (provide 'MYNAME) at its end so that a call to (require 'MYNAME) will only load MYNAME.scm once.") (define (require fname) "(require FILENAME) Checks if FNAME is already provided (member of variable provided) if not loads it, appending \".scm\" to FILENAME. Uses load_library to find the file." (let ((bname (intern (basename fname)))) (if (null? (member bname provided)) (progn ;;; Compiled files aren't faster, so we don't do this ; (fasload_library (string-append fname ".bin")) (load_library (string-append fname ".scm")) 't) nil))) (define (request fname) "(request FILENAME) Checks if FNAME is already provided (member of variable provided) if not tries to loads it, appending \".scm\" to FILENAME. Uses load_library to find the file. Unlike require, fname isn't found no error occurs" (unwind-protect (require fname))) (define (provide fname) "(provide FILENAME) Adds FNAME to the variable provided (if not already there). This means that future calls to (require FILENAME) will not cause FILENAME to be re-loaded." (if (null? (member fname provided)) (set! provided (cons fname provided)))) (define (apply_hooks hooks obj) "(apply_hooks HOOK OBJ) Apply HOOK(s) to OBJ. HOOK is a function or list of functions that take one argument." (cond ((null? hooks) obj) ((consp hooks) (apply_hooks (cdr hooks) ((car hooks) obj))) (t (hooks obj)))) (define (apply func args) "(apply FUNC ARGS) Call FUNC with ARGS as arguments." (eval (cons func (mapcar (lambda (a) (list 'quote a)) args)))) (defmac (autoload form) "(autoload FUNCTION FILENAME DOCSTRING) Define FUNCTION that when called automatically loads FILENAME and calls FUNCTION (assumed to be defined in FILENAME)." (list 'define (cadr form) (list 'lambda 'n (list 'let (list (list 'me (cadr form))) (list 'require (car (cdr (cdr form)))) (list 'if (list 'eq 'me (cadr form)) (list 'error (list 'string-append "autoload: \"" (car (cdr (cdr form))) ".scm\" does not define " (list 'quote (cadr form))))) (list 'apply (cadr form) 'n))))) (define (:backtrace frame) "(:backtrace [FRAME]) This function called *immediately* after an error will display a backtrace of the functions evaluated before the error. With no arguments it lists all stack frames, with the (possibly shortened) forms that were evaluated at that level. With a numeric argument it displays the form at that level in full. This function only works at top level in the read-eval-print loop (command interpreter). Note that any valid command will leave the backtrace stack empty. Also note that backtrace itself does not reset the backtrace, unless you make an error in calling it." "The function is interpreted specially by the read-eval-interpreter and hence has no body, its actual body is defined in src/arch/siod-3.0/slib.cc." ) (defvar hush_startup nil "hush_startup If set to non-nil, the copyright banner is not displayed at start up.") (defvar editline_histsize 256 "editline_histsize The number of lines to be saved in the users history file when a Festival session ends. The histfile is \".festival_history\" in the users home directory. Note this value is only checked when the command interpreter is started, hence this should be set in a user's \".festivalrc\" or system init file. Reseting it at the command interpreter will have no effect.") (defvar editline_no_echo (getenv "EMACS") "editline_no_echo When running under Emacs as an inferior process, we don't want to echo the content of the line, only the prompt.") (defvar ! nil "! In interactive mode, this variable's value is the return value of the previously evaluated expression.") (provide 'siod) speech_tools/lib/siod/init.scm0000644000076400007640000001146310075606451015045 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Initialisation file -- loaded before anything else ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Basic siod library (need this before load_library or require works) (load (path-append libdir "siod.scm")) (defvar home-directory (or (getenv "HOME") "/") "home-directory Place looked at for .siodrc etc.") ;;; User startup initialization, can be used to override load-path ;;; to allow alternate basic modules to be loaded. (if (probe_file (path-append home-directory ".siodvarsrc")) (load (path-append home-directory ".siodvarsrc"))) ;;; A chance to set various variables to a local setting e.g. ;;; lexdir, voices_dir audio etc etc. (if (probe_file (path-append libdir "sitevars.scm")) (load (path-append libdir "sitevars.scm"))) ;;; CSTR siod extensions. (require 'cstr) ;;; Web related definitions (require 'web) ;;; Set default audio method (cond ((member 'nas *modules*) (Parameter.def 'Audio_Method 'netaudio)) ((member 'sun16audio *modules*) (Parameter.def 'Audio_Method 'sun16audio)) ((member 'freebsd16audio *modules*) (Parameter.def 'Audio_Method 'freebsd16audio)) ((member 'linux16audio *modules*) (Parameter.def 'Audio_Method 'linux16audio)) ((member 'irixaudio *modules*) (Parameter.def 'Audio_Method 'irixaudio)) ((member 'macosxaudio *modules*) (Parameter.def 'Audio_Method 'macosxaudio)) ((member 'win32audio *modules*) (Parameter.def 'Audio_Method 'win32audio)) ((member 'os2audio *modules*) (Parameter.def 'Audio_Method 'os2audio)) ((member 'mplayeraudio *modules*) (Parameter.def 'Audio_Method 'mplayeraudio)) (t ;; can't find direct support so guess that /dev/audio for 8k ulaw exists (Parameter.def 'Audio_Method 'sunaudio))) ;;; If you have an external program to play audio add its definition ;;; in siteinit.scm ;;; The audio spooler doesn't work under Windows so redefine audio_mode (if (member 'mplayeraudio *modules*) (define (audio_mode param) param) ) ;;; ;;; Local site initialization, if the file exists load it ;;; (if (probe_file (path-append libdir "siteinit.scm")) (load (path-append libdir "siteinit.scm"))) ;;; User initialization, if a user has a personal customization ;;; file loaded it (if (probe_file (path-append home-directory ".siodrc")) (load (path-append home-directory ".siodrc"))) (provide 'init) ;; Keep this comment at the end of the file ;; Local variables: ;; mode: scheme ;; End: speech_tools/lib/siod/web.scm0000644000076400007640000000745607262605664014677 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Some things for dealing with the web. ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (get_url url filename) "(get_url URL OUTFILE) Get URL and put contents in OUTFILE. Currently only http, and file type URLs are supported." (let ((infile (fopen (parse_url url) "rb"))) (if infile (let ((outfile (fopen filename "wb"))) (if outfile (let ((buffer " ") n) (while (set! n (fread buffer infile)) (if ( < n (length buffer)) (setq buffer (substring buffer 0 n))) (fwrite buffer outfile)) (fclose infile) (fclose outfile) ) "can't open out" ) ) "can't open in" ) ) ) (define (socket_open host port how) "(socket_open HOST PORT HOW) Open a file descriptor to the BSD socket on HOST at PORT. HOW may be \"r\" or \"w\" for a read only or write only filedescriptor. If HOW is unspecified or NIL, \"w\" is assumed. If HOW is \"rw\" then a list of two file descriptors is returned, the first for reading the second for writing. Take care when using the bidiectional socket that deadlock doesn't occur." (let ((file (fopen (list "tcp" host port "") how))) (if (or (equal? how "rw") (equal how "r+")) (list file file) file) ) ) (provide 'web) speech_tools/lib/siod/cstr.scm0000644000076400007640000001051707262605664015065 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; CSTR siod extensions. ;(defvar Parameter nil ; "Parameter ; An assoc-list of parameters and values for various parts of the speech ; synthesis system. This is used by the functions Parameter.set ; Parameter.def and Parameter.get as well as internal C++ functions.") (defvar Param (feats.make) "Param A feature set for arbitrary parameters for modules.") (define (Param.set name val) "(Param.set NAME VAL) Set parameter NAME to VAL (deleting any previous setting)" (feats.set Param name val)) (define (Parameter.set name val) "(Parameter.set NAME VAL) Set parameter NAME to VAL (deleting any previous setting). This is an old function and you should use Param.set instead." (Param.set name val) val ) (define (Parameter.def name val) "(Parameter.def NAME VAL) Set parameter NAME to VAL if not already set. This is an OLD function you shold use Param.def instead." (Param.def name val) ) (define (Param.def name val) "(Param.def NAME VAL) Set parameter NAME to VAL if not already set" (if (not (feats.present Param name)) (feats.set Param name val))) (define (Parameter.get name) "(Parameter.get NAME) Get parameter NAME's value (nil if unset). This is an OLD function and may not exist in later versions (or change functionality). This function (unlike Param.get) may return sylbols (rather than strings if the val doesn't contain whitespace (to allow older functions to still work." (let ((val (Param.get name))) (if (and (eq? 'string (typeof val)) (not (string-matches val ".*[ \t\r\n].*"))) (intern val) val)) ) (define (Param.get name) "(Param.get NAME) Get parameter NAME's value (nil if unset)" (feats.get Param name)) (define (get_param name params default) "(get_param name params default) Get named parameters in params returning default if its not present." (let ((pair (assoc name params))) (if pair (car (cdr pair)) default))) (provide 'cstr) speech_tools/lib/siod/fringe.scm0000644000076400007640000000747507262616577015402 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Talking to fringe. (defvar fringe_verbose nil "fringe_verbose If this is set true, all subsequent fringe connections will print a trace of what they are doing.") ;;; Aliases which are better suited to command line use. (defvar fringe_name "fringe" "fringe_name The name of the last name passed to \[fringe_setup\].") (defvar fringe_connection nil "fringe_connection A connection to fringe, used by the command line fringe functions.") (define (fringe_setup &opt name) "(fringe_setup &opt name) Connect to fringe." (fringe_read_server_table) (if (not name) (set! name fringe_name)) (set! fringe_connection (fringe_server "fringe")) (set! fringe_name name) ) (define (fringe command) "(fringe COMMAND) Send COMMAND to the fringe server \[fringe_connection\] For command line use, use (fringe_comand_string...) in scripts. " (if (not fringe_connection) (fringe_setup)) (let ((val (fringe_command_string fringe_connection command))) (if (or (null val) (consp val)) nil val) ) ) (define (fringel package operation args) "(fringel PACKAGE OPERATION ARGS) Send a command to the fringe server \[fringe_connection\]. For command line use, use (fringe_comand...) in scripts. " (if (not fringe_connection) (fringe_setup)) (let ((val (fringe_command fringe_connection package operation args))) (if (or (null val) (consp val)) nil val) ) ) (provide 'fringe) speech_tools/lib/siod/siod_server.scm0000644000076400007640000000527007262605664016436 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Load this to turn this process into a siod network server. (defvar siod_verbose t "siod_verbose If this is set true, all subsequent siod connections will print a trace of what they are doing.") (set! siod-server (siod_service_loop)) (siod_server_run siod-server) speech_tools/lib/siod/siod_client.scm0000644000076400007640000000623507262605664016410 0ustar awbawb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;; ;;; Centre for Speech Technology Research ;; ;;; University of Edinburgh, UK ;; ;;; Copyright (c) 1996,1997 ;; ;;; All Rights Reserved. ;; ;;; ;; ;;; Permission is hereby granted, free of charge, to use and distribute ;; ;;; this software and its documentation without restriction, including ;; ;;; without limitation the rights to use, copy, modify, merge, publish, ;; ;;; distribute, sublicense, and/or sell copies of this work, and to ;; ;;; permit persons to whom this work is furnished to do so, subject to ;; ;;; the following conditions: ;; ;;; 1. The code must retain the above copyright notice, this list of ;; ;;; conditions and the following disclaimer. ;; ;;; 2. Any modifications must be clearly marked as such. ;; ;;; 3. Original authors' names are not deleted. ;; ;;; 4. The authors' names are not used to endorse or promote products ;; ;;; derived from this software without specific prior written ;; ;;; permission. ;; ;;; ;; ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;; ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;; ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;; ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;; ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;; ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;; ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;; ;;; THIS SOFTWARE. ;; ;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Talking to siod. (defvar siod_verbose t "siod_verbose If this is set true, all subsequent siod connections will print a trace of what they are doing.") ;;; Aliases which are better suited to command line use. (defvar siod_connection nil "siod_connection A connection to siod, used by the command line siod functions.") (define (siod_connect) "(siod_connect) Connect to the default siod." (siod_read_server_table) (set! siod_connection (siod_server "siod")) ) (define (siod_remote command) "(siod_remote COMMAND) Send COMMAND to the siod server \[siod_connection\]." (let ((val (siod_remote_command siod_connection command))) (if (or (null val) (consp val)) nil val) ) ) (siod_connect) (provide 'siod_client) speech_tools/main/ch_lab_main.cc0000644000076400007640000002057711465017155015350 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Paul Taylor and Simon King */ /* Date : June 1995 */ /*-----------------------------------------------------------------------*/ /* Label conversion main file */ /* */ /*=======================================================================*/ #include #include "EST_ling_class.h" #include "EST_Track.h" #include "EST_cmd_line.h" #include "EST_string_aux.h" int check_vocab(EST_Relation &a, EST_StrList &vocab); /** @name ch_lab Label file manipulation @id ch_lab_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** ch_lab is used to manipulate the format of label files and serves as a wrap-around for the EST_Relation class. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_String out_file, ext; EST_StrList files; EST_Option al, op; EST_Relation lab, key; EST_RelationList mlf; EST_Litem *p; parse_command_line (argc, argv, EST_String(" [input file1] [input file2] -o [output file]\n") + "Summary: change/copy label files\n"+ "use \"-\" to make input and output files stdin/out\n"+ "-h Options help\n"+ "-S frame spacing of output\n"+ "-base use base filenames for lists of label files\n"+ "-class Name of class defined in op file\n"+ "-combine \n"+ "-divide \n"+ "-end end time (secs) for label extraction\n"+ "-ext filename extension\n"+ "-extend extend track file beyond label file\n"+ "-extract extract a single file from a list of label files\n"+ "-f sample frequency of label file\n"+ "-itype type of input label file: esps htk ogi\n"+ "-key key label file\n"+ "-lablist list of labels to be considered as blank\n"+ "-length length of track produced\n"+ "-lf sample frequency for labels\n"+ "-map name of file containing label mapping\n"+ "-name eg. Fo Phoneme\n"+ "-nopath ignore pathnames when searching label lists\n"+ "-o output gile name\n"+ "-off vertical offset of track\n"+ "-ops print options\n"+ "-otype {esps}\n"+ " output file type: xmg, ascii, esps, htk\n"+ "-pad Pad with \"high\" or \"low\" values\n"+ "-pos list of labels to be regarded as 'pos'\n"+ "-q quantize label timings to nearest value\n"+ "-range different between high and low values\n"+ "-sed perform regex editing using sed file\n"+ "-shift shift the times of the labels\n"+ "-start start time for label extraction\n"+ "-style output stype e.g. track\n"+ "-vocab file containing list of words in vocab\n"+ "-verify check that only labels in vocab file are in label file\n", files, al); init_lib_ops(al, op); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; read_RelationList(mlf, files, al); // perform all utility functions on all relations in mlf for (p = mlf.head(); p; p = p->next()) relation_convert(mlf(p), al, op); if (al.present("-verify")) { EST_StrList vocab; if (load_StrList(al.val("-vocab"), vocab) != format_ok) { cerr << "Couldn't read vocab file " << al.val("-vocab") << " for verification\n"; exit(-1); } for (p = mlf.head(); p; p = p->next()) check_vocab(mlf(p), vocab); exit(0); } if (files.length() == 1) // special case of only one input file lab = mlf.first(); if (al.present("-extract")) // extract a single relation lab = RelationList_extract(mlf, al.val("-extract"), (bool)al.present("-base")); if (al.present("-combine")) // join all relations into lab sequentially { if (al.present("-key")) { key.load(al.val("-key")); lab = RelationList_combine(mlf, key); } else lab = RelationList_combine(mlf); } if (al.present("-divide")) // make mlf from single relation and keylab { EST_StrList blank; ext = al.present("-ext") ? al.val("-ext") : (EST_String)""; key.load(al.val("-key")); if (al.present("-lablist")) StringtoStrList(al.val("-lablist"), blank); if (relation_divide(mlf, lab, key, blank, ext) == -1) exit(-1); // if (al.present("-newkey")) // the function reassigns keylab boundaries // key.save(al.val("-newkey")); } if (al.val("-style", 0) == "track") { EST_Track tr; label_to_track(lab, al, op, tr); tr.save(out_file, op.val("track_file_type", 0)); exit(0); } int path = al.present("-nopath") ? 0 : 1; if (al.val("-otype", 0) == "mlf") save_RelationList(out_file, mlf, 1, path); // i.e. print times else if (al.val("-otype", 0) == "wmlf") save_RelationList(out_file, mlf, 0, path); // i.e. don't print times else if (al.val("-otype", 0) == "words") save_WordList(out_file, mlf, 0); else if (al.val("-otype", 0) == "sentence") save_WordList(out_file, mlf, 1); else if (al.val("-otype", 0) == "ind") { if (al.present("-a")) save_ind_RelationList(out_file, mlf, "Addresses", path); else save_ind_RelationList(out_file, mlf, "None", path); } else // lab.save(out_file, al.val("-otype", 0), "None"); lab.save(out_file,al.val("-otype")); return 0; } void override_lib_ops(EST_Option &a_list, EST_Option &al) { a_list.override_val("frame_shift", al.val("-S", 0)); a_list.override_val("in_lab_file_type", al.val("-itype", 0)); a_list.override_val("out_lab_file_type", al.val("-otype", 0)); a_list.override_val("label_offset", al.val("-off", 0)); a_list.override_val("label_range", al.val("-range", 0)); if (al.val("-style", 0) == "track") a_list.override_val("track_file_type", al.val("-otype", 0)); } speech_tools/main/ch_track_main.cc0000644000076400007640000003377311465017155015720 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1994,1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : June 1994 */ /*-----------------------------------------------------------------------*/ /* EST_Track file manipulation program */ /* */ /*=======================================================================*/ #include "EST.h" #include "EST_cmd_line_options.h" #define DEFAULT_TIME_SCALE 0.001 int StrListtoIList(EST_StrList &s, EST_IList &il); void extract_channel(EST_Track &orig, EST_Track &nt, EST_IList &ch_list); EST_write_status save_snns_pat(const EST_String filename, EST_TrackList &inpat, EST_TrackList &outpat); EST_read_status read_TrackList(EST_TrackList &tlist, EST_StrList &files, EST_Option &al); void extract(EST_Track &tr, EST_Option &al); /** @name ch_track Track file manipulation * @id ch-track-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** ch_track is used to manipulate the format of a track file. Operations include: file format conversion smoothing changing the frame spacing of a track (resampling) producing differentiated and delta tracks Using a threshold to convert a track file to a label file making multiple input files into a single multi-channel output file extracting a single channel from a multi-channel track extracting a time-delimited portion of the waveform */ //@} /**@name Options */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_String in_file("-"), out_file("-"); EST_Option al, settings; EST_String fname, ftmp; EST_StrList files; EST_Track tr; EST_TrackList trlist; EST_Litem *p; parse_command_line( argc, argv, EST_String("[input file] -o [output file] [options]\n")+ "Summary: change/copy track files\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n"+ options_track_input()+ "\n"+ options_track_output()+ "\n" "-info Print information about file and header. \n" " This option gives useful information such as file \n" " length, file type, channel names. No output is produced\n\n" "-track_names \n" " File containing new names for output channels\n\n" "-diff Differentiate contour. This performs simple \n" " numerical differentiation on the contour by \n" " subtracting the amplitude of the current frame \n" " from the amplitude of the next. Although quick, \n" " this technique is crude and not recommende as the \n" " estimation of the derivate is done on only one point\n\n" "-delta Make delta coefficients (better form of differentiate).\n" " The argument to this option is the regression length of \n" " of the delta calculation and can be between 2 and 4 \n\n" "-sm Length of smoothing window in seconds. Various types of \n" " smoothing are available for tracks. This options specifies \n" " length of the smooting window which effects the degree of \n" " smoothing, i.e. a longer value means more smoothing \n\n" "-smtype Smooth type, median or mean\n" "-style Convert track to other form. Currently only one form \n" " \"label\" is supported. This uses a specified cut off to \n" " make a label file, with two labels, one for above the \n" " cut off (-pos) and one for below (-neg)\n\n" "-t threshold for track to label conversion \n" "-neg Name of negative label in track to label conversion \n" "-pos Name of positive label in track to label conversion \n" "-pc Combine given tracks in parallel. If option \n" " is longest, pad shorter tracks to longest, else if \n" " first pad/cut to match first input track \n" + options_track_filetypes_long(), files, al); /*redundant options "-time_channel \n"+ " Which track in track file holds pitchmark times\n"+ "-time_scale \n"+ " Scale of pitchmarks (default 0.001 = milliseconds)\n"+ */ override_lib_ops(settings, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; EST_TokenStream ts; // ts.open(files.first()); // tr.load(ts); // cout << tr; if (read_TrackList(trlist, files, al) != read_ok) exit(0); if (files.length() == 0) { cerr << argv[0] << ": no input files specified\n"; exit(-1); } if (al.present("-info")) { for (p = trlist.head(); p; p = p->next()) track_info(trlist(p)); exit(0); } if (al.present("-pc")) // parallelize them ParallelTracks(tr, trlist, al.val("-pc")); else if (al.val("-otype", 0) == "snns") { // sometime this will generalise for multiple input files EST_TrackList inpat, outpat; inpat.append(trlist.nth(0)); outpat.append(trlist.nth(1)); save_snns_pat(out_file, inpat, outpat); exit(0); } else // concatenate them { tr.resize(0, tr.num_channels()); // Reorg -- fix += to resize to largest num_channels (with warning) for (p = trlist.head(); p; p = p->next()) tr += trlist(p); } if (al.present("-S")) tr.sample(al.fval("-S")); if (al.present("-sm")) { track_smooth(tr, al.fval("-sm"),al.val("-smtype")); } if (al.present("-diff") && al.present("-delta")) { cerr << "Using -diff and -delta together makes no sense !\n"; exit(-1); } if (al.present("-diff")) { tr = differentiate(tr); } if (al.present("-delta")) { EST_Track ntr = tr; // to copy size !; delta(tr,ntr,al.ival("-delta")); tr = ntr; } if (al.present("-c")) { EST_StrList s; EST_Track ntr; EST_IList il; StringtoStrList(al.val("-c"), s, " ,"); // separator can be space or comma StrListtoIList(s, il); extract_channel(tr, ntr, il); tr = ntr; } if (al.present("-start") || al.present("-end") || al.present("-to") || al.present("-from")) extract(tr, al); // tr.assign_map(&LPCTrackMap); // tr.set_space_type("VARI"); // optionally rename output tracks before saving if (al.present("-track_names")) { EST_StrList new_names; if(load_StrList(al.val("-track_names"),new_names) != format_ok) { cerr << "Failed to load new track names file." << endl; exit(-1); } /* if (tr.num_channels() != new_names.length()) { cerr << "Number of names in output track names file ("; cerr << new_names.length() << ") " << endl; cerr << " does not match number of output channels ("; cerr << tr.num_channels() << ")" << endl; exit(-1); } EST_Litem *np; int ni; for (np = new_names.head(),ni=0; np; np = np->next(),ni++) tr.set_channel_name(new_names(np),ni); */ tr.resize(EST_CURRENT, new_names); } // track_info(tr); /* tr.resize(EST_CURRENT, 10); cout << "new\n"; track_info(tr); EST_StrList x; x.append("a"); x.append("c"); x.append("d"); cout << "new\n"; track_info(tr); */ // Write out file in appropriate format if (al.val("-style",0) == "label") { EST_Relation lab; if (al.present("-t")) track_to_label(tr, lab, al.fval("-t")); else track_to_label(tr, lab); if (al.present("-pos")) change_label(lab, "pos", al.val("-pos")); if (al.present("-neg")) change_label(lab, "neg", al.val("-neg")); if (lab.save(out_file) != write_ok) exit(-1); } /* else if (al.val("-style",0) == "pm") { EST_Relation lab; if (!al.present("-f")) { cerr << "must specify sample rate (with -f) for pm style\n"; exit(-1); } int sample_rate = al.ival("-f", 0); track_to_pm(tr, sample_rate, lab); if (lab.save(out_file) != write_ok) exit(-1); } */ else { if (tr.save(out_file, al.val("-otype")) != write_ok) exit(-1); } return 0; } void override_lib_ops(EST_Option &a_list, EST_Option &al) { a_list.override_val("ishift", al.val("-s", 0)); a_list.override_val("color", al.val("-color", 0)); a_list.override_val("in_track_file_type", al.val("-itype", 0)); a_list.override_val("out_track_file_type", al.val("-otype", 0)); a_list.override_val("tr_to_label_thresh", al.val("-t", 0)); a_list.override_fval("time_scale", DEFAULT_TIME_SCALE); if (al.val("-style", 0) == "label") a_list.override_val("lab_file_type", al.val("-otype", 0)); if (al.present("-time_scale")) a_list.override_fval("time_scale", al.fval("-time_scale", 1)); if (al.present("-time_channel")) a_list.override_val("time_channel", al.sval("-time_channel", 1)); } /** @name Making multiple tracks into a single track If multiple input files are specified, by default they are concatenated into the output file. $ ch_track kdt_010.tr kdt_011.tr kdt_012.tr kdt_013.tr -o out.tr In the above example, 4 multi channel input files are converted to one single channel output file. Multi-channel tracks can concatenated provided they all have the same number of input channels. Multiple input files can be made into a multi-channel output file by using the -pc option: $ ch_track kdt_010.tr kdt_011.tr kdt_012.tr kdt_013.tr -o -pc longest out.tr The argument to -pc can either be longest, in which the output track is the length of the longest input file, or first in which it is the length of the first input file. */ //@{ //@} /** @name Extracting channels from multi-channel tracks The -c option is used to specify channels which should be extracted from the input. If the input is a 4 channel track, $ ch_track kdt_m.tr -o a.tr -c "0 2" will extract the 0th and 2nd channel (counting starts from 0). The argument to -c can be either a single number of a list of numbers (wrapped in quotes). */ //@{ //@} /** @name Extracting of a single region from a track There are several ways of extracting a region of a track. The simplest way is by using the start, end, to and from commands to delimit a sub portion of the input track. For example $ ch_track kdt_010.tr -o small.tr -start 1.45 -end 1.768 extracts a subtrack starting at 1.45 seconds and extending to 1.768 seconds. alternatively, $ ch_track kdt_010.tr -o small.tr -from 50 -to 100 extracts a subtrack starting at 50 frames and extending to 100 frames. Times and frames can be mixed in sub-track extraction. The output track will have the same number of channels as the input track. */ //@{ //@} /** @name Adding headers and format conversion It is usually a good idea for all track files to have headers as this way different files can be handled safely. ch_track provides a means of adding headers to unheadered files. These files are assumed to be ascii floats with one channel per line. The following adds a header to an ascii file. $ ch_track kdt_010.atr -o kdt_010.h5.tr -otype est -s 0.01 ch_track can change the frame shift of a fixed frame file, or convert a variable frame shift file into a fixed frame shift. At present this is done with a very crude resampling technique and hence the output file may suffer from anti-aliasing distortion. Change to a frame spacing of 0.02 seconds: $ ch_track kdt_010.tr -o kdt_010.tr2 -S 0.02 */ //@{ //@} //@} speech_tools/main/ch_wave_main.cc0000644000076400007640000003753711465017155015560 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Change EST_Wave utility main */ /* */ /*=======================================================================*/ #include #include #include #include "EST_Wave.h" #include "EST_cmd_line.h" #include "EST_cmd_line_options.h" #include "EST_sigpr.h" #include "EST_wave_aux.h" #include "EST.h" void wave_extract_channel(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list); void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list); /** @name ch_wave Audio file manipulation @id ch_wave_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** ch_wave is used to manipulate the format of a waveform file. Operations include: file format conversion resampling (changing the sampling frequency) byte-swapping making multiple input files into a single multi-channel output file making multiple input files into a single single-channel output file extracting a single channel from a multi-channel waveform scaling the amplitude of the waveform low pass and high pass filtering extracting a time-delimited portion of the waveform ch_wave is a executable program that serves as a wrap-around for the EST_Wave class and the basic wave manipulation functions. More advanced waveform processing is performed by the signal processing library. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Wave sig, sigload; EST_String in_file("-"), out_file("-"), op_file(""), test; EST_Option al; EST_StrList files; EST_Litem *p; parse_command_line (argc, argv, EST_String("[input file0] [input file1] ... -o [output file]\n")+ "Summary: change/copy/combine waveform files\n"+ "use \"-\" to make input and output files stdin/out\n"+ "-h Options help\n\n"+ options_wave_input()+ options_wave_output()+ "-scale Scaling factor. Increase or descrease the amplitude\n" " of the whole waveform by the factor given\n\n" "-scaleN Scaling factor with normalization. \n" " The waveform is scaled to its maximum level, after which \n" " it is scaled by the factor given\n\n" "-lpfilter Low pass filter, with cutoff frequency in Hz \n" " Filtering is performed by a FIR filter which is built at run \n" " time. The order of the filter can be given by -forder. The \n" " default value is 199\n\n" "-hpfilter High pass filter, with cutoff frequency in Hz \n" " Filtering is performed by a FIR filter which is \n" " built at run time. The order of the filter can \n" " be given by -forder. The default value is 199.\n\n" "-forder Order of FIR filter used for lpfilter and \n" " hpfilter. This must be ODD. Sensible values range \n"+ " from 19 (quick but with a shallow rolloff) to 199 \n" " (slow but with a steep rolloff). The default is 199.\n\n" "-fafter Do filtering after other operations such as \n" " resampling (default : filter before other operations)\n\n" "-info Print information about file and header. \n" " This option gives useful information such as file \n" " length, sampling rate, number of channels etc\n" " No output is produced\n\n" "-add A new single channel waveform is created by adding \n" " the corresponding sample points of each input waveform\n\n" "-pc Combine input waveforms to form a single \n" " multichannel waveform. The argument to this option controls \n" " how long the new waveform should be. If the option \n" " is LONGEST, the output wave if the length of the \n" " longest input wave and shorter waves are padded with \n" " zeros at the end. If the option is FIRST, the length \n" " of the new waveform is the length of the first file \n" " on the command line, and subsequent waves are padded \n" " or cut to this length\n\n" "-key Label file designating subsections, for use with \n" " -divide. The KEYLAB file is a label file which specifies \n" " where chunks (such as individual sentences) in \n" " a waveform begin and end. See section of wave extraction.\n\n" "-divide Divide a single input waveform into multiple output \n" " waveforms. Each output waveform is extracted from the \n" " input waveform by using the KEYLAB file, which \n" " specifies the start and stop times for each chunk. \n" " The output files are named according to the filename \n" " in the KEYLAB file, with extension given by -ext. See \n" " section on wave extraction\n\n" "-ext File extension for divided waveforms\n\n" "-extract Used in conjunction with -key to extract a \n" " single section of waveform from the input \n" " waveform. The argument is the name of a file given \n" " in the file column of the KEYLAB file.\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; // There will always be at least one (or stdin) // The first is dealt specially in case its *way* big if (read_wave(sig, files.first(), al) != format_ok) exit(-1); if (al.present("-info")) wave_info(sig); // concat or parallelize remaining input files if (files.length() > 1) { for (p= files.head()->next(); p != 0; p=p->next()) { if (read_wave(sigload, files(p), al) != format_ok) exit(-1); if (al.present("-info")) wave_info(sigload); else if (al.present("-pc")) { if ((al.val("-pc") == "longest") && (sig.num_samples() < sigload.num_samples())) sig.resize(sigload.num_samples()); else /* "first" or sig is longer */ sigload.resize(sig.num_samples()); sig |= sigload; } else if (al.present("-add")) add_waves(sig, sigload); else sig += sigload; } } if (al.present("-info")) exit(0); // done what I've been asked to so stop // All input files are now in a single wave called sig // default is to filter before any resampling etc. // (this may cause problems for multiplexed data !) if(!al.present("-fafter")){ if(al.present("-lpfilter")) FIRlowpass_filter(sig,al.ival("-lpfilter"),al.ival("-forder")); if(al.present("-hpfilter")) FIRhighpass_filter(sig,al.ival("-hpfilter"),al.ival("-forder")); } if (al.present("-c")) // extract a channel from a multi-channel wave { EST_StrList s; EST_IList il; EST_Wave nsig; StringtoStrList(al.val("-c"), s, " ,"); // separator can be space or comma StrListtoIList(s, il); extract_channels(nsig, sig, il); sig = nsig; } if (al.present("-F")) // resample sig.resample(al.ival("-F")); if (al.present("-scale")) // rescale { float scale = al.fval("-scale", 0); sig.rescale(scale); } else if (al.present("-scaleN")) // rescale { float scale = al.fval("-scaleN", 0); if ((scale < 0) || (scale > 1.0)) { cerr << "ch_wave: -scaleN must be in range 0 to 1" << endl; exit(-1); } sig.rescale(scale,1); } EST_Relation key; if (al.present("-divide")) { EST_WaveList wl; if (!al.present("-key")) { cerr << "Must have key file specified when dividing waveform\n"; exit (-1); } if (key.load(al.val("-key")) != format_ok) exit(-1); if (wave_divide(wl, sig, key, al.val("-ext", 0)) == -1) exit(0); for (p = wl.head(); p; p = p->next()) wl(p).save(wl(p).name(), al.val("-otype", 0)); exit(0); } else if (al.present("-extract")) { EST_Wave e; if (!al.present("-key")) { cerr << "Must have key file specified when dividing waveform\n"; exit (-1); } if (key.load(al.val("-key")) != format_ok) exit(-1); if (wave_extract(e, sig, key, al.val("-extract")) == -1) exit (-1); sig = e; } // if we are filtering after other operations if(al.present("-fafter")){ if(al.present("-lpfilter")) FIRlowpass_filter(sig,al.ival("-lpfilter"),al.ival("-forder")); if(al.present("-hpfilter")) FIRhighpass_filter(sig,al.ival("-hpfilter"),al.ival("-forder")); } write_wave(sig, out_file, al); return 0; } /** @name Making multiple waves into a single wave If multiple input files are specified, by default they are concatenated into the output file. $ ch_wave kdt_010.wav kdt_011.wav kdt_012.wav kdt_013.wav -o out.wav In the above example, 4 single channel input files are converted to one single channel output file. Multi-channel waveforms can also be concatenated provided they all have the same number of input channels. Multiple input files can be made into a multi-channel output file by using the -pc option: $ ch_wave kdt_010.wav kdt_011.wav kdt_012.wav kdt_013.wav -o -pc LONGEST out.wav The argument to -pc can either be LONGEST, in which the output waveform is the length of the longest input file, or FIRST in which it is the length of the first input file. */ //@{ //@} /** @name Extracting channels from multi-channel waves The -c option is used to specify channels which should be extracted from the input. If the input is a 4 channel wave, $ ch_wave kdt_m.wav -o a.wav -c "0 2" will extract the 0th and 2nd channel (counting starts from 0). The argument to -c can be either a single number of a list of numbers (wrapped in quotes) */ //@{ //@} /** @name Extracting of a single region from a waveform There are several ways of extracting a region of a waveform. The simplest way is by using the start, end, to and from commands to delimit a sub portion of the input wave. For example $ ch_wave kdt_010.wav -o small.wav -start 1.45 -end 1.768 extracts a subwave starting at 1.45 seconds and extending to 1.768 seconds. alternatively, $ ch_wave kd_010.wav -o small.wav -from 5000 -to 10000 extracts a subwave starting at 5000 samples and extending to 10000 samples. Times and samples can be mixed in sub-wave extraction. The output waveform will have the same number of channels as the input waveform. */ //@{ //@} /** @name Extracting of a multiple regions from a waveform Multiple regions can be extracted from a waveform, but as it would be too complicated to specify the start and end points on the command line, a label file with start and end points, and file names is used. The file is called a key label file and in xwaves label format looks like: separator ; # 0.308272 121 sil ; file kdt_010.01 ; 0.440021 121 are ; file kdt_010.02 ; 0.512930 121 your ; file kdt_010.03 ; 0.784097 121 grades ; file kdt_010.04 ; 1.140969 121 higher ; file kdt_010.05 ; 1.258647 121 or ; file kdt_010.06 ; 1.577145 121 lower ; file kdt_010.07 ; 1.725516 121 than ; file kdt_010.08 ; 2.315186 121 nancy's ; file kdt_010.09 ; Each line represents one region. The first column is the end time of that region and the start time of the next. The next two columns are colour and an arbitrary name, and the filename in which the output waveform is to be stored is kept as a field called file in the last column. In this example, each region corresponds to a single word in the file. If the above file is called "kdt_010.words.keylab", the command: $ ch_wave kdt_010.wav -key kdt_010.words -ext .wav -divide will divide the input waveform into 9 output waveforms called kdt_010.01.wav, kdt_010.02.wav ... kdt_010.09.wav. The -ext option specifies the extension of the new waveforms, and the -divide command specifies that division of the entire waveform is to take place. If only a single file is required the -extract option can be used, in which case its argument is the filename required. $ ch_wave kdt_010.wav -key kdt_010.words -ext .wav -extract kdt_010.03 \ -o kdt_010.03.wav Note that an output filename should be specified with this option. */ //@{ //@} /** @name Adding headers and format conversion It is usually a good idea for all waveform files to have headers as this way different byte orders, sampling rates etc can be handled safely. ch_wave provides a means of adding headers to raw files. The following adds a header to a file of 16 bit shorts $ ch_wave kdt_010.raw1 -o kdt_010.h1.wav -otype nist -f 16000 -itype raw The following downsamples the input to 8 KHz $ ch_wave kdt_010.raw1 -o kdt_010.h2.wav -otype nist -f 16000 \ -F 8000 -itype raw The following takes a 8K ulaw input file and produces a 16bit, 20Khz output file: $ ch_wave kdt_010.raw2 -o kdt_010.h3.wav -otype nist -istype ulaw \ -f 8000 -F 20000 -itype raw */ //@{ //@} //@} speech_tools/main/na_play_main.cc0000644000076400007640000002076211465017155015557 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Paul Taylor, Alan Black */ /* (c) 1995-1999 */ /*-----------------------------------------------------------------------*/ /* General play back program */ /* */ /*=======================================================================*/ #include "EST.h" #include "EST_audio.h" #include "EST_cmd_line_options.h" /** @name na_play Audio Playback @id na_play_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** na_play is a general playback program for playing sound files on a variety of platforms and sound cards. Currently, the following audio devices are supported: sunaudio: 8k ulaw direct to /dev/audio found on most Sun machines. This is also found under Linux and FreeBSD, and possibly others. This is the default if netaudio is not supported. netaudio: NCD's network transparent audio system (NAS). This allows use of audio devices across a network. NAS has support for, Suns, Linux, FreeBSD, HPs and probably other machines by now. sun16audio: This is only available on newer Sun workstations and has been enabled at compile time. This provides 16bit linear PCM at various sample rates. linux16audio: This is only available on Linux workstations and has been enabled at compile time. This provides 16bit linear PCM at various sample rates. freebsd16audio: This is only available on workstations running FreeBSD and has been enabled at compile time. This provides 16bit linear PCM at various sample rates. mplayeraudio: This is only available under Windows NT 4.0 and Windows 95 and has been enabled at compile time. This provides 16bit linear PCM at various sample rates. win32audio This is only available under Windows NT 4.0 and Windows 95 and has been enabled at compile time. This provides 16bit linear PCM at various sample rates, playing the audio directly rather than saving to a file as with mplayeraudio. irixaudio Audio support for SGI's IRIX 6.2. Audio_Command: Allows the specification of an arbitrary UNIX command to play the waveform. This won't normally be used with na_play as you could just use the command directly but is necessary with some systems using the speech tools. The default audio is netaudio if it is supported. If not the platform specific auido mode is the default (e.g. sun16audio, linux16audio, freebsd16audio or mplayeraudio). If none of these is supported, sunaudio is the default. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Wave sig; EST_String in_file("-"), out_file("-"); EST_StrList files; EST_Option al; EST_Litem *p; parse_command_line (argc,argv, EST_String("[input file0] [input file1] ...\n")+ "Summary; play waveform files on audio device\n"+ "use \"-\" to make input and output files stdin/out\n"+ "-h options help\n"+ options_wave_input()+ "-p audio device protocol. Ths supported types are\n" " "+options_supported_audio()+"\n" "-command command to play wave when protocol\n"+ " is audio_command\n" "-basic HTML audio/basic format, if unheadered treat\n" " as ulaw 8K\n\n" "-r* ESPS compatible way of selecting subrange of file.\n" " The options -start, -end, -to and -from are \n" " recommended\n\n" "-quality either [ high | low ]. \"high\" will ensure \n" " that proper resampling is used. \"low\" means play \n" " as fast as possible, with a minimum of processing\n\n" "-server play sound on machine (when protocol is\n" " server-based)\n" "-audiodevice use specified audiodevice if approrpriate\n" " for protocol\n" "-scale change the gain (volume) of the signal. 1.0 is default\n" "-v verbose. Print file names when playing\n" "-wait wait for a key to be pressed between each file\n", files, al); // by default, parse_cl_ops adds a stdout file called "-". This is // irrelevant for na_play and needs to be removed. if (al.present("-server")) al.add_item("-display", al.val("-server")); for (p = files.head(); p; ) { if (al.present("-v")) cout << "playing " << files(p) << endl; if (read_wave(sig, files(p), al) != format_ok) exit(-1); EST_Wave tmp, *toplay=&sig; if (al.present("-c")) { wave_extract_channel(tmp,sig,al.ival("-c")); toplay=&tmp; } /* * This is redundant as play_wave does this * else if (sig.num_channels() > 1) { wave_combine_channels(tmp, sig); toplay=&tmp; } */ if (al.present("-scale")) (*toplay).rescale(al.fval("-scale")); play_wave(*toplay, al); // pause for a keystroke between each file if (al.present("-wait") && p->next()) { if (getc(stdin) == 'a') continue; } p = p->next(); } return 0; } void override_lib_ops(EST_Option &a_list, EST_Option &al) { // Reorg -- can be deleted ? // general options a_list.override_val("sample_rate", al.val("-f", 0)); // low pass filtering options. a_list.override_val("lpf_cutoff",al.val("-u", 0)); a_list.override_val("lpf_order",al.val("-o", 0)); if (al.val("-L", 0) == "true") a_list.override_val("do_low_pass", "true"); if (al.val("-R", 0) == "true") a_list.override_val("do_low_pass", "false"); a_list.override_val("color", al.val("-color", 0)); a_list.override_val("f0_file_type", al.val("-otype", 0)); a_list.override_val("wave_file_type", al.val("-itype", 0)); } speech_tools/main/na_record_main.cc0000644000076400007640000001530610330516525016061 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author: Alan W Black */ /* Date : February 1998 */ /*-----------------------------------------------------------------------*/ /* General recording program */ /* */ /*=======================================================================*/ #include "EST.h" #include "EST_audio.h" #include "EST_cmd_line_options.h" #if defined(WIN32) || defined(__CYGWIN__) #include "windows.h" #include "Mmsystem.h" #endif int record_voxware_wave(EST_Wave &inwave, EST_Option &al); #if defined(WIN32) || defined(__CYGWIN__) int win_record_wave(EST_Wave &wave, EST_Option &al); #endif /** @name na_record Audio file recording @id na-record-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** na_record records wavefors from an audio device. It only supports recording for N seconds (default is 10). Specifying the frequency defines the recording frequency (if supported by the hardware). This currently doesn't support NAS audio in. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Wave wave; EST_String out_file("-"); EST_StrList files; EST_Option al; parse_command_line (argc,argv, EST_String("[options]\n")+ "Summary; record waveform from audio device\n"+ "use \"-\" to make output files stdout\n"+ "-h options help\n"+ "-f Input sample rate\n"+ "-audiodevice use specified audiodevice if appropriate\n" " for protocol\n" "-time Wave length in seconds\n"+ options_wave_output()+ "\n"+ "-p audio device protocol. Ths supported types are\n"+ " "+options_supported_audio()+"\n", files,al); if (al.present("-f")) al.add_item("-sample_rate", al.val("-f")); else al.add_item("-sample_rate", "16000"); if (!al.present("-time")) al.add_item("-time", "10"); if (al.present("-o")) out_file = al.val("-o"); #if defined(WIN32) || defined(__CYGWIN__) if (win_record_wave(wave,al) != 0) #else if (record_wave(wave,al) != 0) #endif { return -1; } write_wave(wave, out_file, al); return 0; } #if defined(WIN32) || defined(__CYGWIN__) int win_record_wave(EST_Wave &wave, EST_Option &al) { char command_buffer[100]; // This could be more robust - ART MCIERROR audio_error; EST_String out_file("-"); // EST_String save_command("save mysound "); if (!al.present("-o")) { cerr << "na_record: for Win32 version, must specify an output file with the -o flag" << endl; return -1; } out_file = al.val("-o"); // save_command += al.val("-o"); // Should check the audio_error return values in the following - ART // as it only reliable records at 44100 we'll do that and down sample audio_error = mciSendString("open new type waveaudio alias mysound buffer 6",NULL,0,NULL); sprintf(command_buffer,"set mysound time format ms bitspersample 16 samplespersec %d",44100); audio_error = mciSendString(command_buffer,NULL, 0 ,NULL); // In theory, based on the previous command, the integer being // calculated in the next line should be the ending time of the // recording in milliseconds. However, I have tried this program // on a number of Windows machines and have found that the // durations are off by a factor that seems to be assuming a 11025 // Hz sample rate. My guess for the additional factor of 2 needed // to make the output file the right duration is that the Win32 // multimedia library is probably assuming stereo instead of mono // recording. - ART sprintf(command_buffer,"record mysound from 0 to %d wait",(int)(2*1000*al.fval("-time")*44100)/11025); audio_error = mciSendString(command_buffer,NULL,0,NULL); sprintf(command_buffer,"save mysound %s",(char *)al.val("-o")); audio_error = mciSendString(command_buffer,NULL,0,NULL); // audio_error = mciSendString(save_command,NULL,0,NULL); audio_error = mciSendString("close mysound",NULL,0,NULL); read_wave(wave, out_file, al); wave.resample(al.ival("-sample_rate")); return 0; } #endif speech_tools/main/sigfilter_main.cc0000644000076400007640000001572410127000720016106 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Filter signals */ /* */ /*=======================================================================*/ #include #include #include #include "EST_Wave.h" #include "EST_cmd_line.h" #include "EST_cmd_line_options.h" #include "EST_sigpr.h" #include "EST_wave_aux.h" void inv_filter_ola(EST_Wave &sig, EST_Track &lpc, EST_Wave &res); void frame_filter(EST_Wave &sig, EST_Track &lpc, EST_Wave &res); void inv_lpc_filter_ola(EST_Wave &in_sig, EST_Track &lpc, EST_Wave &out_sig); void FIR_double_filter(EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator); /** @name sigfilter Filter waveforms * @id sigfilter-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** sigfilter filters an input waveform and produces a output waveform. */ //@} /**@name Options */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Wave sig, fsig; EST_String in_file("-"), out_file("-"), op_file(""), test; EST_Option al; EST_TList files; EST_Track filter; parse_command_line (argc, argv, EST_String("[input file0] -o [output file]\n") + "Summary: filter waveform files\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n"+ options_wave_input()+ "\n"+ options_wave_output()+ "\n" "-scale Scaling factor. Increase or descrease the amplitude\n" " of the whole waveform by the factor given\n\n" "-scaleN Scaling factor with normalization. \n" " The waveform is scaled to its maximum level, after which \n" " it is scaled by the factor given\n\n" "-double Perform double filtering by applying a forward filter,\n" " then a backward filter, leaving the filtered signla in phase\n" " with the original\n\n" "-lpfilter Low pass filter, with cutoff frequency in Hz \n" " Filtering is performed by a FIR filter which is built at run \n" " time. The order of the filter can be given by -forder. The \n" " default value is 199\n\n" "-hpfilter High pass filter, with cutoff frequency in Hz \n" " Filtering is performed by a FIR filter which is \n" " built at run time. The order of the filter can \n" " be given by -forder. The default value is 199.\n\n" "-forder Order of FIR filter used for lpfilter and \n" " hpfilter. This must be ODD. Sensible values range \n" " from 19 (quick but with a shallow rolloff) to 199 \n" " (slow but with a steep rolloff). The default is 199.\n\n" "-lpcfilter Track file containing lpc filter coefficients\n\n" "-firfilter File containing a single set of FIR filter\n" " coefficients\n\n" "-inv_filter use filter coefficients for inverse filtering\n\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (read_wave(sig, files.first(), al) != format_ok) exit(-1); if (al.present("-s")) // rescale { float scale = al.fval("-s", 0); sig.rescale(scale); } else if (al.present("-scaleN")) // rescale { float scale = al.fval("-scaleN", 0); if ((scale < 0) || (scale > 1.0)) { cerr << "ch_wave: -scaleN must be in range 0 to 1" << endl; exit(-1); } sig.rescale(scale,1); } // default is to filter before any resampling etc. // (this may cause problems for multiplexed data !) if (al.present("-lpfilter")) { FIRlowpass_filter(sig, al.ival("-lpfilter"),al.ival("-forder")); fsig = sig; } if (al.present("-hpfilter")) { FIRhighpass_filter(sig,al.ival("-hpfilter"),al.ival("-forder")); fsig = sig; } if (al.present("-lpcfilter")) { filter.load(al.val("-lpcfilter")); if (al.present("-inv_filter")) inv_lpc_filter_ola(sig, filter, fsig); else // frame_filter(sig, filter, fsig); cout << "not done yet\n"; } if (al.present("-firfilter")) { EST_FVector firfilter; firfilter.load(al.val("-firfilter")); if (al.present("-double")) FIR_double_filter(sig, fsig, firfilter); else FIRfilter(sig, fsig, firfilter); } if (write_wave(fsig, out_file, al) != write_ok) { cerr << "sigfilter: failed to write output to \"" << out_file << "\"" << endl; exit(-1); } return 0; } speech_tools/main/sig2fv_main.cc0000644000076400007640000003355411465017155015337 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Paul Taylor and Simon King */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Generate feature vectors */ /* */ /*=======================================================================*/ #include #include "EST_speech_class.h" #include "EST_string_aux.h" #include "EST_cmd_line.h" #include "EST_cmd_line_options.h" #include "sigpr/EST_sigpr_utt.h" #include "sigpr/EST_filter.h" #define EPSILON (0.0001) #define DEFAULT_FRAME_SIZE 0.01 #define DEFAULT_FRAME_FACTOR 2.0 #define DEFAULT_LPC_ORDER 16 #define DEFAULT_REF_ORDER 16 #define DEFAULT_CEP_ORDER 12 #define DEFAULT_FBANK_ORDER 20 #define DEFAULT_MELCEP_ORDER 12 #define DEFAULT_WINDOW "hamming" #define DEFAULT_PREEMPH 0 #define DEFAULT_LIFTER 0 // sane values for pitchmarks (in seconds) #define MINIMUM_PITCH_PERIOD (0.0033) // 300 hz #define MAXIMUM_PITCH_PERIOD (0.02) // 50 Hz #define DEFAULT_PITCH_PERIOD (0.01) // 100 Hz void calculate_orders(EST_StrList &clist, EST_IList &olist, EST_Option &op); void add_channels_to_map(EST_StrList &map, EST_StrList &types, EST_Features &op, int order); void set_options(EST_Features &op, EST_Option &al); EST_String sigpr_options_supported(void) { return EST_String("")+ " lpc linear predictive coding\n" " cep cepstrum coding from lpc coefficients\n" " melcep Mel scale cepstrum coding via fbank\n" " fbank Mel scale log filterbank analysis\n" " lsf line spectral frequencies\n" " ref Linear prediction reflection coefficients\n" " power\n" " f0\n" " energy: root mean square energy\n"; }; /** @name sig2fv Generate signal processing coefficients from waveforms * @id sigfv-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** sig2fv is used to create signal processing feature vector analysis on speech waveforms. The following types of analysis are provided: Linear prediction (LPC) Cepstrum coding from lpc coefficients Mel scale cepstrum coding via fbank Mel scale log filterbank analysis Line spectral frequencies Linear prediction reflection coefficients Root mean square energy Power fundamental frequency (pitch) calculation of delta and acceleration coefficients of all of the above The -coefs option is used to specify a list of the names of what sort of basic processing is required, and -delta and -acc are used for delta and acceleration coefficients respectively. */ //@} /**@name Options */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_String out_file("-"); EST_StrList files; EST_Option al; EST_Features op; EST_Wave sig; EST_Track full; EST_StrList coef_list, delta_list, acc_list, tlist, map; EST_IList olist; parse_command_line (argc, argv, EST_String("[input file] -o [output file]\n")+ "Summary: generate acoustic feature vectors for a waveform file \n" "use \"-\" to make input and output files stdin/out \n" "-h Options help \n\n" + options_wave_input() + options_track_output() + " \n" "-shift frame spacing in seconds for fixed frame analysis. This \n" " doesn't have to be the same as the output file spacing - the \n" " S option can be used to resample the track before saving \n" " default: "+ftoString(DEFAULT_FRAME_SIZE) +"\n\n" "-factor Frames lengths will be FACTOR times the \n" " local pitch period. \n" " default: "+ftoString(DEFAULT_FRAME_FACTOR) +"\n\n" "-pm Pitch mark file name. This is used to \n" " specify the positions of the analysis frames for pitch \n" " synchronous analysis. Pitchmark files are just standard \n" " track files, but the channel information is ignored and \n" " only the time positions are used\n" "-size If specified with pm, size is used as the \n" " fixed window size (times factor) rather than size within \n" " each the pms.\n\n" "-coefs list of basic types of processing required. \n" " Permissable types are: \n" + sigpr_options_supported()+" \n" "-delta list of delta types of processing required. Basic \n" " processing does not need to be specified for this option to work. \n" " Permissable types are: \n" + sigpr_options_supported()+" \n" "-acc list of acceleration (delta delta) processing \n" " required. Basic processing does not need to be specified for \n" " this option to work. \n" " Permissable types are: \n" + sigpr_options_supported()+"\n" "-window_type Type of window used on waveform. \n" " Permissable types are: \n" + EST_Window::options_supported() + " default: "DEFAULT_WINDOW"\n\n" "-lpc_order Order of lpc analysis. \n\n" "-ref_order Order of lpc reflection coefficient analysis. \n\n" "-cep_order Order of lpc cepstral analysis.\n\n" "-melcep_order Order of Mel cepstral analysis.\n\n" "-fbank_order Order of filter bank analysis.\n\n" "-preemph Perform pre-emphasis with this factor.\n\n" "-lifter lifter coefficient.\n\n" "-usepower use power rather than energy in filter bank \n" " analysis\n\n"+ "-include_c0 include cepstral coefficient 0\n\n" "-order order of analyses\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; set_options(op, al); StringtoStrList(al.val("-coefs"), coef_list); StringtoStrList(al.val("-delta"), delta_list); StringtoStrList(al.val("-acc"), acc_list); StringtoStrList(al.val("-order"), tlist); StrListtoIList(tlist, olist); if (read_wave(sig, files.first(), al) != read_ok) exit(-1); // allocate and fill time axis if (al.present("-pm")) { if (read_track(full, al.val("-pm"), al)) exit(1); } else { full.resize((int)ceil(sig.end() / op.F("frame_shift")), 0); full.fill_time(op.F("frame_shift")); } // allocate channels add_channels_to_map(map, coef_list, op, 0); add_channels_to_map(map, delta_list, op, 1); add_channels_to_map(map, acc_list, op, 2); //cerr << "MAP " << map << endl; full.resize(EST_CURRENT, map); if (al.present("-preemph")) pre_emphasis(sig, al.fval("-preemph")); if(al.present("-usepower")) cerr << "sig2fv: -usepower currently not supported" << endl; sigpr_base(sig, full, op, coef_list); sigpr_delta(sig, full, op, delta_list); sigpr_acc(sig, full, op, acc_list); if (al.present("-S")) { cout << "-S " << al.fval("-S") << endl; full.sample(al.fval("-S")); } if (full.save(out_file, al.val("-otype", 0)) != write_ok) { cerr << "sig2fv: failed to write output to \"" << out_file << "\"" << endl; exit(-1); } return 0; } void calculate_orders(EST_StrList &clist, EST_IList &olist, EST_Option &op) { EST_Litem *c, *o; EST_String k; int v; for (c = clist.head(), o = olist.head(); c && o; c= c->next(), o = o->next()) { k = clist(c) + "_order"; v = olist(o); op.override_ival(k, v); } } void set_options(EST_Features &op, EST_Option &al) { op.set("frame_shift", DEFAULT_FRAME_SIZE); op.set("frame_factor", DEFAULT_FRAME_FACTOR); op.set("window_type", DEFAULT_WINDOW); op.set("preemph", DEFAULT_PREEMPH); op.set("lifter", DEFAULT_LIFTER); op.set("lpc_order", DEFAULT_LPC_ORDER); op.set("ref_order", DEFAULT_REF_ORDER); op.set("cep_order", DEFAULT_CEP_ORDER); op.set("fbank_order", DEFAULT_FBANK_ORDER); op.set("melcep_order", DEFAULT_MELCEP_ORDER); op.set("max_period", MAXIMUM_PITCH_PERIOD); op.set("min_period", MINIMUM_PITCH_PERIOD); op.set("def_period", DEFAULT_PITCH_PERIOD); if (al.present("-max_period")) op.set("max_period", al.fval("-max_period", 0)); if (al.present("-min_period")) op.set("min_period", al.fval("-min_period", 0)); if (al.present("-def_period")) op.set("def_period", al.fval("-def_period", 0)); if (al.present("-window_type")) op.set("window_type", al.sval("-window_type", 1)); if (al.present("-shift")) op.set("frame_shift", al.fval("-shift", 1)); if (al.present("-factor")) op.set("frame_factor", al.fval("-factor", 1)); if (al.present("-size")) op.set("frame_factor", op.F("frame_factor")*-1.0*al.fval("-size")); if (al.present("-length")) op.set("frame_factor", al.fval("-length", est_errors_allowed)/op.F("frame_shift",est_errors_allowed)); if (al.present("-preemph")) op.set("preemph", al.fval("-preemph", 1)); if (al.present("-lifter")) op.set("lifter", al.fval("-lifter", 1)); if (al.present("-lpc_order")) op.set("lpc_order", al.ival("-lpc_order", 1)); if (al.present("-ref_order")) op.set("ref_order", al.ival("-ref_order", 1)); if (al.present("-cep_order")) op.set("cep_order", al.ival("-cep_order", 1)); if (al.present("-fbank_order")) op.set("fbank_order", al.ival("-fbank_order", 1)); if (al.present("-melcep_order")) op.set("melcep_order", al.ival("-melcep_order", 1)); if (al.present("-usepower")) op.set("usepower", al.val("-usepower", 1)); if (al.present("-include_c0")) op.set("include_c0", al.val("-include_c0", 1)); } /**@name Examples Fixed frame basic linear prediction: To produce a set of linear prediction coefficients at every 10ms, using pre-emphasis and saving in EST format: $ sig2fv kdt_010.wav -o kdt_010.lpc -coefs "lpc" -otype est -shift 0.01 -preemph 0.5 Pitch Synchronous linear prediction. The following used the set of pitchmarks in kdt_010.pm as the centres of the analysis windows. $ sig2fv kdt_010.wav -pm kdt_010.pm -o kdt_010.lpc -coefs "lpc" -otype est -shift 0.01 -preemph 0.5 F0, Linear prediction and cepstral coefficients: $ sig2fv kdt_010.wav -o kdt_010.lpc -coefs "f0 lpc cep" -otype est -shift 0.01 Note that pitchtracking can also be done with the pda program. Both use the same underlying technique, but the pda program offers much finer control over the pitch track specific processing parameters. Energy, Linear Prediction and Cepstral coefficients, with a 10ms frame shift during analysis but a 5ms frame shift in the output file: $ sig2fv kdt_010.wav -o kdt_010.lpc -coefs "f0 lpc cep" -otype est -S 0.005 -shift 0.01 Delta and acc coefficients can be calculated even if their base form is not required. This produces normal energy coefficients and cepstral delta coefficients: $ sig2fv ../kdt_010.wav -o kdt_010.lpc -coefs "energy" -delta "cep" -otype est Mel-scaled cepstra, Delta and acc coefficients, as is common in speech recognition: $ sig2fv ../kdt_010.wav -o kdt_010.lpc -coefs "melcep" -delta "melcep" -acc "melcep" -otype est -preemph 0.96 */ //@{ //@} //@} speech_tools/main/spectgen_main.cc0000644000076400007640000001354510044502523015733 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author: Paul Taylor */ /* Date : April 1995 */ /*-----------------------------------------------------------------------*/ /* Generate feature vectors */ /* */ /*=======================================================================*/ #include "EST.h" #include "EST_cmd_line_options.h" #include "sigpr/EST_spectrogram.h" #define DEFAULT_FRAME_SIZE 0.001 #define DEFAULT_FRAME_LENGTH 0.008 #define DEFAULT_ORDER 256 #define DEFAULT_PREEMPH 0.94 void set_options(EST_Features &op, EST_Option &al); /** @name spectgen Make spectrograms * @id spectgen-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** spectgen is used to create spectrograms, which are 3d plots of amplitude against time and frequency. Spectgen takes a waveform and produces a track, where each channel represents one frequency bin. By default spectgen produces a "wide-band" spectrogram, that is one with high time resolution and low frequency resolution. "Narrow-band" spectrograms can be produced by using the -shift and -length options. Typical values for -shift and -length are: */ //@} /**@name Options */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_String out_file; EST_StrList files; EST_Option al; EST_Features op; int orig_sr; EST_Wave sig; EST_Track spec; parse_command_line (argc, argv, EST_String("[input file] -o [output file]\n")+ "Summary: make spectrogram\n"+ "use \"-\" to make input and output files stdin/out\n"+ "-h Options help\n"+ options_wave_input()+ "\n"+ options_track_output()+ "-shift frame spacing in seconds for fixed frame analysis. This \n" " doesn't have to be the same as the output file spacing - the \n" " S option can be used to resample the track before saving \n" " default: "+ftoString(DEFAULT_FRAME_SIZE) +"\n\n" "-length input frame length in milliseconds\n"+ "-sr range in which output values should lie\n"+ "-slow slow FFT code\n"+ "-w white cut off (0.0 to 1.0)\n"+ "-b black cut off (0.0 to 1.0)\n"+ "-raw Don't perform any scaling\n"+ "-order cepstral order\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; set_options(op, al); if (read_wave(sig, files.first(), al) != format_ok) exit(-1); orig_sr = sig.sample_rate(); make_spectrogram(sig, spec, op); spec.save(out_file, al.val("-otype", 0)); return 0; } void set_options(EST_Features &op, EST_Option &al) { op.set("frame_shift", DEFAULT_FRAME_SIZE); op.set("frame_length", DEFAULT_FRAME_LENGTH); op.set("preemph", DEFAULT_PREEMPH); op.set("frame_order", DEFAULT_ORDER); if (al.present("-shift")) op.set("frame_shift", al.fval("-shift")); if (al.present("-length")) op.set("frame_length", al.fval("-length")); if (al.present("-order")) op.set("frame_order", al.fval("-order")); if (al.present("-sr")) op.set("sp_range", al.fval("-sr")); if (al.present("-w")) op.set("sp_wcut", al.fval("-w")); if (al.present("-b")) op.set("sp_bcut", al.fval("-b")); if (al.present("-preemph")) op.set("preemph", al.fval("-preemph", 1)); if (al.present("-raw")) op.set("raw", 1); } speech_tools/main/pda_main.cc0000644000076400007640000002207010266455571014700 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : May 1994 */ /*-----------------------------------------------------------------------*/ /* Pitch Detection Algorithm Main routine */ /* */ /*=======================================================================*/ #include #include "EST.h" #include "sigpr/EST_sigpr_utt.h" #include "EST_cmd_line_options.h" void set_parameters(EST_Features &a_list, EST_Option &al); void option_override(EST_Features &op, EST_Option al, const EST_String &option, const EST_String &arg); static int save_pm(EST_String filename, EST_Track fz); /** @name pda Pitch Detection Algorithm @id pda-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** pda is a pitch detection algorithm that produces a fundamental frequency contour from a speech waveform file. At present only the super resolution pitch determination algorithm is implemented. See (Medan, Yair, and Chazan, 1991) and (Bagshaw et al., 1993) for a detailed description of the algorithm. The default values given below were found to optimise the performance of the pitch determination algorithm for speech data sampled at 20kHz using a 16\-bit waveform and low pass filter with a 600Hz cut-off frequency and more than \-85dB rejection above 700Hz. The best performances occur if the [\-p] flag is passed. */ //@} /**@name Options */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Track fz; EST_Wave sig; EST_Option al; EST_Features op; EST_String out_file("-"); EST_StrList files; parse_command_line (argc, argv, EST_String("[input file] -o [output file] [options]\n")+ "Summary: pitch track waveform files\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n\n"+ options_wave_input()+ options_pda_general()+ options_pda_srpd()+ options_track_output(), files, al); default_pda_options(op); set_parameters(op, al); if (read_wave(sig, files.first(), al) != format_ok) exit(-1); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; pda(sig, fz, op); // do f0 tracking if (al.present("-pm")) save_pm(out_file, fz); else fz.save(out_file, op.S("f0_file_type", "0")); if (al.present("-diff")) { fz = differentiate(fz); fz.save(out_file + ".diff", op.S("f0_file_type", "0")); } return 0; } void set_parameters(EST_Features &op, EST_Option &al) { op.set("srpd_resize", 1); // general options option_override(op, al, "pda_frame_shift", "-shift"); option_override(op, al, "pda_frame_length", "-length"); option_override(op, al, "max_pitch", "-fmax"); option_override(op, al, "min_pitch", "-fmin"); // low pass filtering options. option_override(op, al, "lpf_cutoff", "-u"); option_override(op, al, "lpf_order", "-forder"); option_override(op, al, "decimation", "-d"); option_override(op, al, "noise_floor", "-n"); option_override(op, al, "min_v2uv_coef_thresh", "-m"); option_override(op, al, "v2uv_coef_thresh_ratio", "-R"); option_override(op, al, "v2uv_coef_thresh", "-H"); option_override(op, al, "anti_doubling_thresh", "-t"); option_override(op, al, "peak_tracking", "-P"); option_override(op, al, "f0_file_type", "-otype"); option_override(op, al, "wave_file_type", "-itype"); if (al.val("-L", 0) == "true") op.set("do_low_pass", "true"); if (al.val("-R", 0) == "true") op.set("do_low_pass", "false"); /* op.set("lpf_cutoff",al.val("-u", 0)); op.set("lpf_order",al.val("-forder", 0)); //sprd options op.set("decimation", al.val("-d", 0)); op.set("noise_floor", al.val("-n", 0)); op.set("min_v2uv_coef_thresh", al.val("-m", 0)); op.set("v2uv_coef_thresh_ratio", al.val("-r", 0)); op.set("v2uv_coef_thresh", al.val("-H", 0)); op.set("anti_doubling_thresh", al.val("-t", 0)); op.set("peak_tracking", al.val("-P", 0)); if (al.val("-L", 0) == "true") op.set("do_low_pass", "true"); if (al.val("-R", 0) == "true") op.set("do_low_pass", "false"); op.set("f0_file_type", al.val("-otype", 0)); op.set("wave_file_type", al.val("-itype", 0)); */ } /* a_list.override_val("sample_rate", al.val("-f", 0)); a_list.override_val("min_pitch", al.val("-fmin", 0)); a_list.override_val("max_pitch", al.val("-fmax", 0)); a_list.override_val("pda_frame_shift", al.val("-s", 0)); a_list.override_val("pda_frame_length",al.val("-l", 0)); // low pass filtering options. a_list.override_val("lpf_cutoff",al.val("-u", 0)); a_list.override_val("lpf_order",al.val("-forder", 0)); //sprd options a_list.override_val("decimation", al.val("-d", 0)); a_list.override_val("noise_floor", al.val("-n", 0)); a_list.override_val("min_v2uv_coef_thresh", al.val("-m", 0)); a_list.override_val("v2uv_coef_thresh_ratio", al.val("-r", 0)); a_list.override_val("v2uv_coef_thresh", al.val("-H", 0)); a_list.override_val("anti_doubling_thresh", al.val("-t", 0)); a_list.override_val("peak_tracking", al.val("-P", 0)); if (al.val("-L", 0) == "true") a_list.override_val("do_low_pass", "true"); if (al.val("-R", 0) == "true") a_list.override_val("do_low_pass", "false"); a_list.override_val("f0_file_type", al.val("-otype", 0)); a_list.override_val("wave_file_type", al.val("-itype", 0)); */ static int save_pm(EST_String filename, EST_Track fz) { ostream *outf; float position, period; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) { cerr << "save_pm: can't write to file \"" << filename << "\"" << endl; return -1; } *outf << "XAO1\n\n"; // xmg header identifier. *outf << "LineType bars \n"; *outf << "LineStyle solid \n"; *outf << "LineWidth 0 \n"; *outf << "Freq 16\n"; *outf << "Format Binary \n"; *outf << char(12) << "\n"; // control L character position = 0.0; int gap = 0; for (int i = 0; i < fz.num_frames(); ++i) { if (fz.val(i)) { if (gap) { position = fz.t(i); gap = 0; } period = 1.0 / fz.a(i); *outf << (position + period) * 1000.0 << endl; position += period; } else gap = 1; } if (outf != &cout) delete outf; return 0; } /**@name Examples Pitch detection on typical male voice, using low pass filtering: $ pda kdt_010.wav -o kdt_010.f0 -fmin 80 -fmax 200 -L */ //@{ //@} //@} speech_tools/main/pitchmark_main.cc0000644000076400007640000003573310127000720016102 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : 1997, 1998, 1999 */ /*-----------------------------------------------------------------------*/ /* Pitchmarking program */ /*************************************************************************/ #include #include #include #include "EST_unix.h" #include "EST_cmd_line_options.h" #include "EST_cmd_line.h" #include "EST_speech_class.h" #include "sigpr/EST_pitchmark.h" void set_options(EST_Features &op, EST_Option &al); static EST_write_status save_msec(EST_Track &pm, EST_String filename); static EST_write_status save_ogi_bin(EST_Track &pm, EST_String filename, int sr); void pm_to_label(EST_Track &pm, EST_Relation &lab); /*void pm_to_label(EST_Track &pm, EST_Relation &lab); void find_pm(EST_Wave &sig, EST_Track &pm); void pm_min_check(EST_Track &pm, float min); void pm_sanity_check(EST_Track &pm, float new_end, float max, float min, float def); void pm_fill(EST_Track &pm, float new_end, float max, float min, float def); void pm_to_f0(EST_Track &pm, EST_Track &f0); */ /** @name pitchmark Find instants of glottal closure in Laryngograph file * @id pitchmark-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** pitchmark locates instants of glottal closure in a laryngograph waveform, and performs post-processing to produce even pitchmarks. EST does not currently provide any means of pitchmarking a speech waveform. Pitchmarking is performed by calling the pitchmark() function, which carries out the following operations: Double low pass filter the signal. This removes noise in the signal. The parameter lx_lf specifies the low pass cutoff frequency, and lx_lo specifies the order. Double filtering (feeding the waveform through the filter, then reversing the waveform and feeding it through again) is performed to reduce any phase shift between the input and output of the filtering operation. Double high pass filter the signal. This removes the very low frequency swell that is often observed in laryngograph waveforms. The parameter lx_hf specifies the high pass cutoff frequency, and lx_ho specifies the order. Double filtering is performed to reduce any phase shift between the input and output of the filtering operation. Calculate the delta signal. The filtered waveform is differentiated using the delta() function. Low pass filter the delta signal. Some noise may still be present in the signal, and this is removed by further low pass filtering. Experimentation has shown that simple mean smoothing is often more effective than FIR smoothing at this point. The parameter mo is used to specify the size of the mean smoothing window. If FIR smoothing is chosen, the parameter df_lf specifies the low pass cutoff frequency, and df_lo specifies the order. Double filtering is again used to avoid phase distortion. Pick zero crossings. Now simple zero-crossing is used to find the pitchmarks themselves. pitchmark also performs post-processing on the pitchmarks. This can be used to eliminate pitchmarks which occur too closely together, or to provide estimated evenly spaced pitchmarks during unvoiced regions. The -fill option switches this facility on, and -min, -max, -def, -end and -wave_end control its operation. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Track pm; EST_Wave lx; EST_Option al; EST_Features op; EST_String out_file("-"); EST_StrList files; parse_command_line (argc, argv, EST_String("[input file] -o [output file] [options]")+ "Summary: pitchmark laryngograph (lx) files\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n\n"+ options_wave_input()+ options_track_output()+ "-lx_lf lx low frequency cutoff\n\n" "-lx_lo lx low order\n\n" "-lx_hf lx high frequency cutoff\n\n" "-lx_ho lx high order\n\n" "-df_lf df low frequeny cutoff\n\n" "-df_lo df low order\n\n" "-med_o median smoothing order\n\n" "-mean_o mean smoothing order\n\n" "-inv Invert polarity of lx signal. Often the lx signal \n" " is upside down. This option inverts the signal prior to \n" " processing.\n\n" "-fill Insert and remove pitchmarks according to min, max\n" " and def period values. Often it is desirable to place limits\n" " on the values of the pitchmarks. This option enforces a \n" " minimum and maximum pitch period (specified by -man and -max).\n" " If the maximum pitch setting is low enough, this will \n" " esnure that unvoiced regions have evenly spaced pitchmarks \n\n" "-min Minimum allowed pitch period, in seconds\n\n" "-max Maximum allowed pitch period, in seconds\n\n" "-def Default pitch period in seconds, used for a guide\n" " as to what length pitch periods should be in unvoiced \n" " sections \n\n" "-pm Input is raw pitchmark file. This option is \n" " used to perform filling operations on an already existing \n" " set of pitchmarks \n\n" "-f0 Calculate F0 from pitchmarks and save to file\n\n" "-end Specify the end time of the last pitchmark, for use \n" " with the -fill option\n\n" "-wave_end Use the end of a waveform to specify when the \n" " last pitchmark position should be. The waveform file is only \n" " read to determine its end, no processing is performed\n\n" "-inter Output intermediate waveforms. This will output the \n" " signal at various stages of processing. Examination of these \n" " waveforms is extremely useful in setting the parameters for \n" " similar waveforms\n\n" "-style \"track\" or \"lab\"\n\n", files, al); set_options(op, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (!al.present("-pm") || (al.present("-pm") && al.present("-wave_end"))) if (read_wave(lx, files.first(), al) != read_ok) exit(-1); if (al.present("-pm")) pm.load(al.val("-pm")); else { if (al.present("-inv")) invert(lx); pm = pitchmark(lx, op); } // this allows the end to be aligned with the end of a waveform op.set("pm_end", lx.end()); if (al.present("-f0")) { EST_Track f0; pm_to_f0(pm, f0); f0.save(al.val("-f0")); } // various options for filling he gaps between distant pitchmarks // and removing pitchmarks that are too close together if (al.present("-fill")) { pm_fill(pm, op.F("pm_end"), op.F("max_period"), op.F("min_period"), op.F("def_period")); pm_fill(pm, op.F("pm_end"), op.F("max_period"), op.F("min_period"), op.F("def_period")); } else if (al.present("-min")) pm_min_check(pm, al.fval("-min")); if (al.present("-style")) { // label format if (al.val("-style").contains("lab")) { EST_Relation lab; pm_to_label(pm, lab); if (lab.save(out_file + ".pm_lab") != write_ok) exit(-1); } // save file in "traditional" milli-second format if (al.val("-style").contains("msec")) save_msec(pm, out_file + ".pm"); // ogi binary integer sample point format if (al.val("-style").contains("ogi_bin")) save_ogi_bin(pm, out_file + ".pmv", lx.sample_rate()); } else if (pm.save(out_file, al.val("-otype", 0)) != write_ok) { cerr << "pitchmark: failed to write output to \"" << out_file << "\"" << endl; exit(-1); } return 0; } static EST_write_status save_msec(EST_Track &pm, EST_String filename) { ostream *outf; if (filename == "-") outf = &cout; else outf = new ofstream(filename); if (!(*outf)) return write_fail; outf->precision(5); outf->setf(ios::fixed, ios::floatfield); outf->width(8); for (int i = 0; i < pm.num_frames(); ++i) *outf << pm.t(i) * 1000.0 << endl; return write_ok; } static EST_write_status save_ogi_bin(EST_Track &pm, EST_String filename, int sr) { int *d; FILE *fp; int i; d = new int[pm.num_frames()]; for (i = 0; i < pm.num_frames(); ++i) d[i] = int(pm.t(i) * (float) sr); if ((fp = fopen(filename, "wb")) == NULL) return misc_write_error; if (fwrite(d, pm.num_frames(), sizeof(int), fp) != 1) { fclose(fp); return misc_write_error; } delete d; return write_ok; } void override_lib_ops(EST_Option &op, EST_Option &al) { op.override_ival("lx_low_frequency", 400); op.override_ival("lx_low_order", 19); op.override_ival("lx_high_frequency", 40); op.override_ival("lx_high_order", 19); op.override_ival("df_low_frequency", 1000); op.override_ival("df_low_order", 19); op.override_fval("min_period", 0.003); op.override_fval("max_period", 0.02); op.override_fval("def_period", 0.01); op.override_fval("pm_end", -1.0); if (al.present("-lx_lf")) op.override_ival("lx_low_frequency", al.ival("-lx_lf", 0)); if (al.present("-lx_lo")) op.override_ival("lx_low_order", al.ival("-lx_lo", 0)); if (al.present("-lx_hf")) op.override_ival("lx_high_frequency", al.ival("-lx_hf", 0)); if (al.present("-lx_ho")) op.override_ival("lx_high_order", al.ival("-lx_ho", 0)); if (al.present("-med_o")) op.override_ival("median_order", al.ival("-med_o", 0)); if (al.present("-mean_o")) op.override_ival("mean_order", al.ival("-mean_o", 0)); if (al.present("-df_lf")) op.override_ival("df_low_frequency", al.ival("-df_lf", 0)); if (al.present("-df_lo")) op.override_ival("df_low_order", al.ival("-df_lo", 0)); if (al.present("-min")) op.override_fval("min_period", al.fval("-min", 0)); if (al.present("-max")) op.override_fval("max_period", al.fval("-max", 0)); if (al.present("-def")) op.override_fval("def_period", al.fval("-def", 0)); if (al.present("-end")) op.override_fval("pm_end", al.fval("-end", 0)); if (al.present("-inter")) op.override_ival("pm_debug", 1); } void set_options(EST_Features &op, EST_Option &al) { op.set("lx_low_frequency", LX_LOW_FREQUENCY); op.set("lx_low_order", LX_LOW_ORDER); op.set("lx_high_frequency", LX_HIGH_FREQUENCY); op.set("lx_high_order", LX_HIGH_ORDER); op.set("df_low_frequency", DF_LOW_FREQUENCY); op.set("df_low_order", DF_LOW_ORDER); op.set("min_period", MIN_PERIOD); op.set("max_period", MAX_PERIOD); op.set("def_period", DEF_PERIOD); op.set("pm_end", PM_END); if (al.present("-lx_lf")) op.set("lx_low_frequency", al.ival("-lx_lf", 0)); if (al.present("-lx_lo")) op.set("lx_low_order", al.ival("-lx_lo", 0)); if (al.present("-lx_hf")) op.set("lx_high_frequency", al.ival("-lx_hf", 0)); if (al.present("-lx_ho")) op.set("lx_high_order", al.ival("-lx_ho", 0)); if (al.present("-med_o")) op.set("median_order", al.ival("-med_o", 0)); if (al.present("-mean_o")) op.set("mean_order", al.ival("-mean_o", 0)); if (al.present("-df_lf")) op.set("df_low_frequency", al.ival("-df_lf", 0)); if (al.present("-df_lo")) op.set("df_low_order", al.ival("-df_lo", 0)); if (al.present("-min")) op.set("min_period", al.fval("-min", 0)); if (al.present("-max")) op.set("max_period", al.fval("-max", 0)); if (al.present("-def")) op.set("def_period", al.fval("-def", 0)); if (al.present("-end")) op.set("pm_end", al.fval("-end", 0)); if (al.present("-inter")) op.set("pm_debug", 1); } /** @name Examples Basic Pitchmarking $ pitchmark kdt_010.lar -o kdt_010.pm -otype est Pitchmarking with unvoiced regions filled The following fills unvoiced regions with pitch periods that are about 0.01 seconds long. It also post-processes the set of pitchmarks and ensures that noe are above 0.02 seconds long and none below 0.003. A final unvoiced region extending to the end of the wave is specified by using the -wave_end option. $ pitchmark kdt_010.lar -o kdt_010.pm -otype est -fill -min 0.003 \ -max 0.02 -def 0.01 -wave_end */ //@{ //@} speech_tools/main/ngram_test_main.cc0000644000076400007640000002735011465017155016277 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Simon King */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* EST_Ngrammar test program */ /* */ /*=======================================================================*/ #include "EST.h" #include "EST_Ngrammar.h" /** @name ngram_test Test n-gram language model @id ngram_test_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** ngram_test is for testing ngram models generated from ngram_build. How do we test an ngram model ? ngram_test will compute the entropy (or perplexity, see below) of some test data, given an ngram model. The entropy gives a measure of how likely the ngram model is to have generated the test data. Entropy is defined (for a sliding-window type ngram) as: \[H = -\frac{1}{Q} \sum_{i=1}^{Q} log P(w_i | w_{i-1}, w_{i-2},... w_{i-N+1}) \] where \(Q\) is the number of words of test data and \(N\) is the order of the ngram model. Perplexity is a more intuitive mease, defined as: \[B = 2^H \] The perplexity of an ngram model with vocabulary size V will be between 1 and V. Low perplexity indicates a more predictable language, and in speech recognition, a models with low perplexity on test data (i.e. data NOT used to estimate the model in the first place) typically give better accuracy recognition than models with higher perplexity (this is not guaranteed, however). test_ngram works with non-sliding-window type models when the input format is ngram_per_line. Input data format The data input format options are the same as ngram_build, as is the treatment of sentence start/end using special tags. Note: To get meaningful entropy/perplexity figures, it is recommended that you use the same data input format in both ngram_build and ngram_test, and the treatment of sentence start/end should be the same. @see ngram_build */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { //int order; EST_StrList files,script; EST_Option al, op; EST_String wordlist_file, script_file, in_file, format; EST_String prev_tag, prev_prev_tag, last_tag; EST_Litem *p; //EST_Ngrammar::representation_t representation = //EST_Ngrammar::dense; EST_StrList wordlist; EST_Ngrammar ngrammar; bool per_file_stats=false; bool raw_stats=false; bool brief=false; EST_String input_format; double raw_entropy,count,entropy,perplexity,total_raw_H,total_count; total_count = 0; total_raw_H = 0; parse_command_line (argc, argv, EST_String("[input file0] [input file1] ...\n")+ "-g grammar file (required)\n"+ "-w filename containing word list (required for some grammar formats)\n"+ "-S script file\n"+ "-raw_stats print unnormalised entropy and sample count\n"+ "-brief print results in brief format\n"+ "-f print stats for each file\n"+ "\n"+ "-input_format \n"+ " format of input data (default sentence_per_line)\n"+ " may also be sentence_per_file, or ngram_per_line.\n"+ "\n"+ "Pseudo-words :\n"+ "-prev_tag \n"+ " tag before sentence start\n"+ "-prev_prev_tag \n"+ " all words before 'prev_tag'\n"+ "-last_tag \n"+ " after sentence end\n"+ "-default_tags\n"+ " use default tags of "+SENTENCE_START_MARKER+ ","+SENTENCE_END_MARKER+" and "+SENTENCE_END_MARKER+"\n"+ " respectively\n", files, al); if (al.present("-w")) wordlist_file = al.val("-w"); else{ wordlist_file = ""; } if (al.present("-f")) per_file_stats = true; if (al.present("-input_format")) input_format = al.val("-input_format"); else input_format = "sentence_per_line"; if ( al.present("-raw_stats") || al.present("-r")) raw_stats = true; if ( al.present("-brief") || al.present("-b") ) brief = true; if (al.present("-default_tags")) { prev_tag = SENTENCE_START_MARKER; prev_prev_tag = SENTENCE_END_MARKER; last_tag = SENTENCE_END_MARKER; } if (al.present("-prev_tag")) { if (al.present("-default_tags")) cerr << "test_ngram: WARNING : -prev_tag overrides -default_tags" << endl; prev_tag = al.val("-prev_tag"); } if (al.present("-prev_prev_tag")) { if (al.present("-default_tags")) cerr << "test_ngram: WARNING : -prev_prev_tag overrides -default_tags" << endl; prev_prev_tag = al.val("-prev_prev_tag"); } if (al.present("-last_tag")) { if (al.present("-default_tags")) cerr << "test_ngram: WARNING : -last_tag overrides -default_tags" << endl; last_tag = al.val("-last_tag"); } if ( ( (prev_tag=="") || (prev_prev_tag=="") || (last_tag=="") ) && ( (prev_tag!="") || (prev_prev_tag!="") || (last_tag!="") ) ) { cerr << "test_ngram: ERROR : if any tags are given, ALL must be given" << endl; exit(1); } // script if (al.present("-S")) { script_file = al.val("-S"); if(load_StrList(script_file,script) != format_ok) { cerr << "test_ngram: Could not read script from file " << script_file << endl; exit(1); } } if (al.present("-g")) in_file = al.val("-g"); else { cerr << "test_ngram: Must give a grammar filename using -g" << endl; exit(1); } // plus any files on command line // except file "-" unless there is no script if(script.head()==NULL) script += files; else for(p=files.head();p!=0;p=p->next()) if(files(p) != "-") script.append(files(p)); if(script.head() == NULL) { cerr << "test_ngram: No test files given" << endl; exit(1); } if (wordlist_file != "") { // load wordlist if (load_StrList(wordlist_file,wordlist) != format_ok) { cerr << "test_ngram: Could not read wordlist from file " << wordlist_file << endl; exit(1); } // load grammar using wordlist if (ngrammar.load(in_file,wordlist) != format_ok) { cerr << "test_ngram: Failed to load grammar" << endl; exit(1); } } else { if (ngrammar.load(in_file) != format_ok) { cerr << "test_ngram: Failed to load grammar" << endl; exit(1); } } if (!brief) { cout << "Ngram Test Results" << endl; cout << "==================" << endl; } for (p = script.head(); p; p = p->next()) { // test each file if (test_stats(ngrammar, script(p), raw_entropy,count, entropy,perplexity, input_format, prev_tag, prev_prev_tag)) { total_raw_H += raw_entropy; total_count += count; if(per_file_stats) { if (brief) cout << basename(script(p)) << " \t"; else cout << script(p) << endl; if(raw_stats) { if (brief) cout << raw_entropy << " " << count << " "; else { cout << " raw entropy " << raw_entropy << endl; cout << " count " << count << endl; } } if (brief) cout << entropy << " " << perplexity << endl; else { cout << " entropy " << entropy << endl; cout << " perplexity " << perplexity << endl << endl; } } } else { cerr << "test_ngram: WARNING : file '" << script(p) << "' could not be processed" << endl; } } if (total_count > 0) { if (!brief) cout << "Summary for grammar " << in_file << endl; else if (per_file_stats) cout << "summary \t"; if(raw_stats) { if (brief) cout << total_raw_H << " " << total_count << " "; else { cout << " raw entropy " << total_raw_H << endl; cout << " count " << total_count << endl; } } if (brief) { cout << total_raw_H / total_count; cout << " " << pow(2.0,total_raw_H / total_count); cout << endl; } else { cout << " entropy " << total_raw_H / total_count << endl; cout << " perplexity " << pow(2.0,total_raw_H / total_count); cout << endl; } } else { cerr << "test_ngram: No data processed" << endl; } // everything went okay return 0; } void override_lib_ops(EST_Option &a_list, EST_Option &al) { (void)a_list; (void)al; } /** @name Hints I got a perplexity of Infinity - what went wrong ? A perplexity of Infinity means that at least one of the ngrams in your test data had a probability of zero. Possible reasons for this include: The training data had no examples of this ngram, and you did not specify a floor for zero frequency ngrams in \Ref{build_ngram} You used differing input formats for \Ref{ngram_build} and \Ref{ngram_test}. You used differing sentence start/end treatments in \Ref{ngram_build} and \Ref{ngram_test}. */ //@{ //@} //@} speech_tools/main/ngram_build_main.cc0000644000076400007640000003553710127000720016405 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Simon King */ /* Date : July 1995 */ /*-----------------------------------------------------------------------*/ /* EST_Ngrammar build program */ /* */ /*=======================================================================*/ #include #include "EST.h" #include "EST_Ngrammar.h" #include "EST_Pathname.h" /** @name ngram_build Train n-gram language model @id ngram_build_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** ngram_build offers basic ngram language model estimation. Input data format Two input formats are supported. In sentence_per_line format, the program will deal with start and end of sentence (if required) by using special vocabulary items specified by -prev_tag, -prev_prev_tag and -last_tag. For example, the input sentence: the cat sat on the mat would be treated as ... prev_prev_tag prev_prev_tag prev_tag the cat sat on the mat last_tag where prev_prev_tag is the argument to -prev_prev_tag, and so on. A default set of tag names is also available. This input format is only useful for sliding-window type applications (e.g. language modelling for speech recognition). The second input format is ngram_per_line which is useful for either non-sliding-window applications, or where the user requires an alternative treatment of start/end of sentence to that provided above. Now the input file simply contains a complete ngram per line. For the same example as above (to build a trigram model) this would be: prev_prev_tag prev_tag the prev_tag the cat the cat sat cat sat on sat on the on the mat the mat last_tag Representation \[V^N\] The internal representation of the model becomes important for higher values of N where, if V is the vocabulary size, \(V^N\) becomes very large. In such cases, we cannot explicitly hold probabilities for all possible ngrams, and a sparse representation must be used (i.e. only non-zero probabilities are stored). Getting more robust probability estimates The common techniques for getting better estimates of the low/zero frequency ngrams are provided: namely smoothing and backing-off Testing an ngram model Use the ngram_test program. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { int order; EST_StrList files; EST_Option al, op; EST_String wordlist_file,wordlist_file2, out_file, format; EST_String prev_tag(""), prev_prev_tag(""), last_tag(""); EST_String input_format(""), oov_mode(""), oov_marker(""); EST_Ngrammar::representation_t representation = EST_Ngrammar::dense; EST_StrList wordlist,wordlist2; EST_Ngrammar ngrammar; bool trace=false; double floor=0.0; parse_command_line (argc, argv, EST_String("[input file0] [input file1] ... -o [output file]\n")+ "-w filename containing word list (required)\n"+ "-p filename containing predictee word list\n"+ " (default is to use wordlist given by -w)\n"+ "-order order, 1=unigram, 2=bigram etc. (default 2)\n"+ "-smooth Good-Turing smooth the grammar up to the\n"+ " given frequency\n"+ "-o Output file for constructed ngram\n"+ "\n" "-input_format \n"+ " format of input data (default sentence_per_line)\n"+ " may be sentence_per_file, ngram_per_line.\n"+ "-otype format of output file, one of cstr_ascii\n"+ " cstr_bin or htk_ascii\n"+ "-sparse build ngram in sparse representation\n"+ "-dense build ngram in dense representation (default)\n"+ "-backoff \n"+ " build backoff ngram (requires -smooth)\n"+ "-floor \n"+ " frequency floor value used with some ngrams\n"+ "-freqsmooth \n"+ " build frequency backed off smoothed ngram, this\n"+ " requires -smooth option\n"+ "-trace give verbose outout about build process\n"+ "-save_compressed save ngram in gzipped format\n"+ "-oov_mode \n"+ " what to do about out-of-vocabulary words,\n"+ " one of skip_ngram, skip_sentence (default),\n"+ " skip_file, or use_oov_marker\n"+ "-oov_marker \n"+ " special word for oov words (default "+OOV_MARKER+")\n"+ " (use in conjunction with '-oov_mode use_oov_marker'\n"+ "\n"+ "Pseudo-words :\n"+ "-prev_tag \n"+ " tag before sentence start\n"+ "-prev_prev_tag \n"+ " all words before 'prev_tag'\n"+ "-last_tag \n"+ " after sentence end\n"+ "-default_tags use default tags of "+SENTENCE_START_MARKER+ ","+SENTENCE_END_MARKER+" and "+SENTENCE_END_MARKER+"\n"+ " respectively\n", files, al); if (al.present("-input_format")) input_format = al.val("-input_format"); else input_format = "sentence_per_line"; if (al.present("-oov_mode")) oov_mode = al.val("-oov_mode"); else oov_mode = "skip_sentence"; if(al.present("-oov_marker")) { if(oov_mode != "use_oov_marker") { cerr << "Error : can only use -oov_marker with '-oov_mode use_oov_marker'" << endl; exit(1); } else oov_marker = al.val("-oov_marker"); // should check oov marker is/isn't (?) in vocab // ...... } if( (oov_mode != "skip_ngram") && (oov_mode != "skip_sentence") && (oov_mode != "skip_file") && (oov_mode != "use_oov_marker") ) { cerr << oov_mode << " is not a valid oov_mode !" << endl; exit(1); } if (al.present("-w")) wordlist_file = al.val("-w"); else{ cerr << "build_ngram: Must specify a wordlist with -w" << endl; exit(1); } if (load_StrList(wordlist_file,wordlist) != format_ok) { cerr << "build_ngram: Could not read wordlist from file " << wordlist_file << endl; exit(1); } if (al.present("-p")) { if(input_format != "ngram_per_line") { cerr << "Can't have differering predictor/predictee lists unless data is in ngram_per_line format !" << endl; exit(1); } wordlist_file2 = al.val("-p"); if (load_StrList(wordlist_file2,wordlist2) != format_ok) { cerr << "build_ngram: Could not read predictee list from file " << wordlist_file2 << endl; exit(1); } } if (al.present("-trace")) trace=true; if (al.present("-o")) out_file = al.val("-o"); else out_file = "-"; if (al.present("-default_tags")) { prev_tag = SENTENCE_START_MARKER; prev_prev_tag = SENTENCE_END_MARKER; last_tag = SENTENCE_END_MARKER; wordlist.append(SENTENCE_START_MARKER); wordlist.append(SENTENCE_END_MARKER); if (al.present("-p")) { wordlist2.append(SENTENCE_START_MARKER); wordlist2.append(SENTENCE_END_MARKER); } } if (al.present("-prev_tag")) { if (al.present("-default_tags")) cerr << "build_ngram: WARNING : -prev_tag overrides -default_tags" << endl; prev_tag = al.val("-prev_tag"); } if (al.present("-prev_prev_tag")) { if (al.present("-default_tags")) cerr << "build_ngram: WARNING : -prev_prev_tag overrides -default_tags" << endl; prev_prev_tag = al.val("-prev_prev_tag"); } if (al.present("-last_tag")) { if (al.present("-default_tags")) cerr << "build_ngram: WARNING : -last_tag overrides -default_tags" << endl; last_tag = al.val("-last_tag"); } if ( ( (prev_tag=="") || (prev_prev_tag=="") || (last_tag=="") ) && ( (prev_tag!="") || (prev_prev_tag!="") || (last_tag!="") ) ) { cerr << "build_ngram: ERROR : if any tags are given, ALL must be given" << endl; exit(1); } if (al.present("-order")) order = al.ival("-order"); else { cerr << "build_ngram: WARNING : No order specified with -order : defaulting to bigram" << endl; order = 2; } if (al.present("-otype")) format = al.val("-otype"); else format = ""; if (al.present("-floor")) floor = al.dval("-floor"); else floor = 0.0; if (al.present("-backoff")) if (!al.present("-smooth")) { cerr << "build_ngram: backoff requires smooth value" << endl; exit(-1); } if (al.present("-freqsmooth")) if (!al.present("-smooth")) { cerr << "build_ngram: frequency smooth requires smooth value" << endl; exit(-1); } if (al.present("-dense")) representation = EST_Ngrammar::dense; else if (al.present("-sparse")) { cerr << "build_ngram: Sorry, sparse representation is not yet available " << endl; exit(1); representation = EST_Ngrammar::sparse; } else if (al.present("-backoff")) representation = EST_Ngrammar::backoff; else cerr << "build_ngram: Defaulting to dense representation" << endl; if (al.present("-p")) { if (!ngrammar.init(order,representation,wordlist,wordlist2)) { cerr << "build_ngram: Failed to initialise " << order << "-gram" << endl; exit(1); } } else { if (!ngrammar.init(order,representation,wordlist)) { cerr << "build_ngram: Failed to initialise " << order << "-gram" << endl; exit(1); } } if ( al.present("-backoff") ) { if (!ngrammar.build(files,prev_tag,prev_prev_tag, last_tag,input_format,oov_mode, al.ival("-backoff"),al.ival("-smooth"))) { cerr << "build_ngram: Failed to build backoff " << order << "-gram" << endl; exit(1); } else if (trace) cerr << "build_ngram: Built backoff " << order << "-gram" << endl; } else { if (!ngrammar.build(files,prev_tag,prev_prev_tag, last_tag,input_format,oov_mode)) { cerr << "build_ngram: Failed to build " << order << "-gram" << endl; exit(1); } else if(trace) cerr << "build_ngram: Built " << order << "-gram" << endl; } // Posit processing functions if (al.present("-freqsmooth")) { Ngram_freqsmooth(ngrammar,al.ival("-smooth"),al.ival("-freqsmooth")); } else if (al.present("-smooth") && !al.present("-backoff")) { int smoothcount = atoi(al.val("-smooth")); if(!Good_Turing_smooth(ngrammar,smoothcount)) { cerr << "build_ngram: Failed to smooth " << order << "-gram" << endl; exit(1); } else if(trace) cerr << "build_ngram: Good Turing smoothed " << order << "-gram" << endl; } // save if (al.present("-save_compressed")) { EST_String tmp_file = make_tmp_filename(); if (ngrammar.save(tmp_file,format,trace,floor) == write_ok) { EST_String prog_name; EST_Pathname tmp(out_file); if (tmp.extension() == GZIP_FILENAME_EXTENSION) prog_name = "gzip --stdout"; else if (tmp.extension() == COMPRESS_FILENAME_EXTENSION) prog_name = "compress -c"; else // default { prog_name = "gzip --stdout"; if(out_file != "-") out_file = out_file + "." + GZIP_FILENAME_EXTENSION; } if (trace) cerr << "build_ngram: Compressing with '" << prog_name << "'" << endl; // now compress if(compress_file(tmp_file,out_file,prog_name) != 0) { cerr << "build_ngram: Failed to compress to file " << out_file << endl; (void)delete_file(tmp_file); exit(1); } (void)delete_file(tmp_file); if(trace) cerr << "build_ngram: Saved in compressed " << format << " format to " << out_file << endl; } else { cerr << "build_ngram: Failed to write temporary file " << tmp_file << endl; exit(1); } } else { if (ngrammar.save(out_file,format,trace,floor) == write_ok) { if(trace) cerr << "build_ngram: Saved in " << format << " format to " << out_file << endl; } else { cerr << "build_ngram: Failed to save " << format << " format data to " << out_file << endl; exit(1); } } // everything went okay return 0; } speech_tools/main/tilt_synthesis_main.cc0000644000076400007640000001624611465017155017223 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor */ /* Date : February 1996 */ /*-----------------------------------------------------------------------*/ /* Event RFC Synthesis */ /* */ /*=======================================================================*/ #include "EST_cmd_line.h" #include "EST_tilt.h" #include "EST_Track.h" #include "ling_class/EST_relation_aux.h" #include "EST_string_aux.h" /** @name tilt_synthesis Generate F0 contours from Tilt descriptions * @id tilt_synthesis-manual * @toc */ //@{ void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list); /**@name Synopsis */ //@{ //@synopsis /** tilt_synthesis generates a F0 contour, given a label file containing parameterised Tilt or RFC events. A detailed description of the Tilt intonation model can be found in the Tilt model overview section. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_Track fz, nfz; EST_Relation ev; EST_Option al, op; EST_String out_file("-"), ev_format, pstring; EST_StrList files, event_list; EST_Item *e; float shift; const float default_frame_shift = 0.01; // i.e 10ms intervals parse_command_line (argc, argv, EST_String("[input label file] -o [output file] [options]") + "Summary: generate F0 file from tilt or RFC label file\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n\n"+ "-noconn Synthesize events only - no connections in output\n" "-o Output F0 file\n" "-otype File type for output label file\n" "-event_names List of labels to be classed as events. \n" " Lists are specified as quoted strings with spaces \n" " separating each item, e.g.: \"a b c d\"\n\n" "-s Frame spacing of generated contour in seconds\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; init_lib_ops(al, op); ev.load(files.first()); // temporary fix until status of start and end is finalised float prev_end = 0.0; for (e = ev.head(); e; e = e->next()) { e->set("start", prev_end); prev_end = e->F("end"); } pstring = al.present("-event_names") ? al.val("-event_names"): EST_String("a b ab pos"); StringtoStrList(pstring, event_list); convert_to_broad(ev, event_list, "int_event"); shift = al.present("-s") ? al.fval("-s") : default_frame_shift; if (ev.f("intonation_style") == "tilt") tilt_synthesis(fz, ev, shift, al.present("-noconn")); else { // validate_rfc_stream(ev); fill_rfc_types(ev); // cout << ev; rfc_synthesis(fz, ev, shift, al.present("-noconn")); } fz.set_channel_name("F0", 0); fz.save(out_file, al.val("-otype")); return 0; } /** @name Input Intonation Files The input should be a label file containing the tilt parameters for the events in feature format. An example, in xlabel format, is shown below: intonation_style tilt # 0.29 26 phrase_start ; ev.f0 115.234 ; position 0.29 ; 0.53 26 a ; int_event 1 ; ev.f0 118.171 ; position 0.53 ; tilt.amp 21.8602 ; tilt.dur 0.26 ; tilt.tilt -0.163727 ; 0.77 26 a ; int_event 1 ; ev.f0 112.694 ; position 0.77 ; tilt.amp 27.0315 ; tilt.dur 0.32 ; tilt.tilt -0.446791 ; 1.53 26 a ; int_event 1 ; ev.f0 100.83 ; position 1.53 ; tilt.amp 7.507 ; tilt.dur 0.22 ; tilt.tilt -0.296317 ; 1.79 26 phrase_end ; ev.f0 92.9785 ; position 1.79 ; tilt_synthesis can also generate F0 contours from RFC parameters: intonation_style rfc # 0.29 26 phrase_start ; ev.f0 115.234 ; position 0.29 ; 0.53 26 a ; ev.f0 118.171 ; rfc.rise_amp 8.19178 ; rfc.rise_dur 0.12 ; rfc.fall_amp -13.6684 ; rfc.fall_dur 0.14 ; position 0.53 ; 0.77 26 a ; ev.f0 112.694 ; rfc.rise_amp 6.50673 ; rfc.rise_dur 0.1 ; rfc.fall_amp -20.5248 ; rfc.fall_dur 0.22 ; position 0.77 ; 1.53 26 a ; ev.f0 100.83 ; rfc.rise_amp 1.55832 ; rfc.rise_dur 0.11 ; rfc.fall_amp -6.09238 ; rfc.fall_dur 0.11 ; position 1.53 ; 1.79 26 phrase_end ; ev.f0 92.9785 ; position 1.79 ; The feature in the header, "intonation_style tilt" or "intonation_style rfc" is needed for the tilt_synthesis program to know which type of synthesis to perform. */ //@{ //@} //@} void override_lib_ops(EST_Option &a_list, EST_Option &al) { // general options a_list.override_val("sample_rate", al.val("-f", 0)); } speech_tools/main/tilt_analysis_main.cc0000644000076400007640000002720710127000720016774 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Paul Taylor */ /* Date : Oct 95 */ /*-----------------------------------------------------------------------*/ /* Event RFC and Tilt labelling */ /* */ /*=======================================================================*/ #include #include "EST_tilt.h" #include "sigpr/EST_sigpr_utt.h" #include "EST_cmd_line_options.h" #include "ling_class/EST_relation_aux.h" #include "EST_string_aux.h" #define SIL_NAMES "sil !ENTER !EXIT" #define EVENT_NAMES "a rb arb m mrb" void set_fn_start(EST_Relation &ev); void default_rfc_params(EST_Features &op); void override_rfc_params(EST_Features &rfc, EST_Option &al); void rfc_analysis(EST_Track &fz, EST_Relation &ev, EST_Features &op); void change_label(EST_Relation &seg, const EST_StrList &oname, const EST_String &nname); void set_options(EST_Option &al, EST_Features &op); void option_override(EST_Features &op, EST_Option al, const EST_String &option, const EST_String &arg); /** @name tilt_analysis Produce tilt descriptions from F0 contours * @id tilt_analysis-manual * @toc */ //@{ void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list); /**@name Synopsis */ //@{ //@synopsis /** tilt_analysis produces a Tilt or RFC analysis of a F0 contour, given a set label file containing a set of approximate intonational event boundaries. A detailed description of the Tilt intonation model can be found in the Tilt model overview section. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_Track fz, nfz; EST_Relation ev; EST_Option al; EST_Features op; EST_StrList files, event_list, sil_list; EST_String out_file, pstring; EST_Track speech, raw_fz; EST_Relation sil_lab; EST_Features rfc_op; parse_command_line (argc, argv, EST_String("[input f0 file] -e [input event label file] -o [output file]" "[options]")+ "Summary: produce rfc file from events and f0 contour\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n\n"+ options_track_input()+ "\n" "-event_names List of labels to be classed as events. \n" " Lists are specified as quoted strings with spaces \n" " separating each item, e.g.: \"a b c d\"\n\n" "-sil_names List of labels to be classed as silence \n" " Lists are specified as quoted strings with spaces \n" " separating each item, e.g.: \"pau sil #\"\n\n" "-e Input event label file. This file contains \n" " the list of events to be parameterized, each with its approximate \n" " start and stop time marked. This file also contains silencesn \n" " which are used to decide where to insert and stop phrases \n\n" "-o Output label file\n\n" "-otype File type of output file \n\n" "-limit start and stop limit in seconds. The rfc \n" " matching algorithm defines a search region within which it tries \n" " all possible rise and fall shapes. This option specifies how much \n" " before the input label start time and how much after the input \n" " label end time the search region should be. Typical value, 0.1 \n\n" "-range Range of RFC search region. In addition to \n" " the limit, the range defines the limits of the rfc matching \n" " search region as a percentage of the overal input label \n" " duration. Typical value, 0.25 (the search region is the first and \n" " last 25% of the label) \n\n" "-smooth Smooth and Interpolate input F0 contour. \n" " rfc matching can only operate on smooth fully interpolated \n" " contours. This option must be used if the contour hasn't already \n" " been smoothed and interpolated\n\n" "-w1 length in seconds of smoothing window prior\n" " to interpolation. Default value 0.05 \n\n" "-w2 length in seconds of smoothing window after\n" " to interpolation. Default value 0.05 \n\n" "-sf0 Save f0 contour that results from smoothing \n" "-rfc Save as RFC parameters instead of tilt\n\n", files, al); default_rfc_params(rfc_op); override_rfc_params(rfc_op, al); set_options(al, op); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (read_track(nfz, files.first(), al) == -1) exit(-1); // REORG - extract proper f0 channel here nfz.copy_sub_track(fz, 0, EST_ALL, 0, 1); if (ev.load(al.val("-e")) != format_ok) exit(-1); pstring = (al.present("-event_names") ? al.val("-event_names"): EST_String("a b ab pos")); StringtoStrList(pstring, event_list); convert_to_broad(ev, event_list, "int_event", 1); // ensure all sil_names are re-written as sil pstring = (al.present("-sil_names") ? al.val("-sil_names"): EST_String(SIL_NAMES)); StringtoStrList(pstring, sil_list); change_label(ev, sil_list, "sil"); if (al.present("-smooth")) { sil_lab = ev; StringtoStrList("sil", sil_list); convert_to_broad(sil_lab, sil_list, "pos", 0); label_to_track(sil_lab, speech, fz.shift()); raw_fz = fz; smooth_phrase(raw_fz, speech, op, fz); } if (al.present("-sf0")) fz.save(al.val("-sf0")); ev.f.set("name", "intevents"); ev.f.set("timing_style", "segment"); // set_fn_start(ev); // main RFC analysis function rfc_analysis(fz, ev, rfc_op); // convert to Tilt if necessary if (!al.present("-rfc")) { rfc_to_tilt(ev); ev.remove_item_feature("rfc"); } ev.save(out_file); } /** @name Input Intonation Files A label file containing approximate intonational event boundaries must be given as input. A typical file in xlabel format is shown below: 0.290 146 sil 0.480 146 c 0.620 146 a 0.760 146 c 0.960 146 a 1.480 146 c 1.680 146 a 1.790 146 sil The set of intonational events can be given on the command line with the -event_names option. The default set is "a rb arb m mrb" and so the above example would not need the -event_names option. The label "c" (connection) is to separate events, in effect giving each event a start time as well as a end time. The silence labels are important also: they specify where phrases should start and end. */ //@{ //@} /** @name Input F0 Files tilt_analysis can operate on all the F0 file types supported by the EST library. Tilt analysis can only operate on smooth and continuous F0 contours.(i.e. F0 values must be defined during unvoiced regons). If the input contour is not in this format, use the -smooth option. The -w1 and -w2 options can be used to control the amount of smoothing. The smoothed version of the input contour can be examined by saving it using the -sf0 option. */ //@{ //@} /** @name Output Intonation Files The output will be a label file containing the tilt parameters for the events in feature format. An example, in xlabel format, is shown below: intonation_style tilt # 0.29 26 phrase_start ; ev.f0 115.234 ; time 0.29 ; 0.53 26 a ; int_event 1 ; ev.f0 118.171 ; time 0.53 ; tilt.amp 21.8602 ; tilt.dur 0.26 ; tilt.tilt -0.163727 ; 0.77 26 a ; int_event 1 ; ev.f0 112.694 ; time 0.77 ; tilt.amp 27.0315 ; tilt.dur 0.32 ; tilt.tilt -0.446791 ; 1.53 26 a ; int_event 1 ; ev.f0 100.83 ; time 1.53 ; tilt.amp 7.507 ; tilt.dur 0.22 ; tilt.tilt -0.296317 ; 1.79 26 phrase_end ; ev.f0 92.9785 ; time 1.79 ; The -rfc option will make a file containing the RFC parameters instead: intonation_style rfc # 0.29 26 phrase_start ; ev.f0 115.234 ; time 0.29 ; 0.53 26 a ; ev.f0 118.171 ; rfc.rise_amp 8.19178 ; rfc.rise_dur 0.12 ; rfc.fall_amp -13.6684 ; rfc.fall_dur 0.14 ; time 0.53 ; 0.77 26 a ; ev.f0 112.694 ; rfc.rise_amp 6.50673 ; rfc.rise_dur 0.1 ; rfc.fall_amp -20.5248 ; rfc.fall_dur 0.22 ; time 0.77 ; 1.53 26 a ; ev.f0 100.83 ; rfc.rise_amp 1.55832 ; rfc.rise_dur 0.11 ; rfc.fall_amp -6.09238 ; rfc.fall_dur 0.11 ; time 1.53 ; 1.79 26 phrase_end ; ev.f0 92.9785 ; time 1.79 ; The feature in the header, "intonation_style tilt" or "intonation_style rfc" is needed for the tilt_synthesis program to work. */ //@{ //@} //@} void override_rfc_params(EST_Features &rfc, EST_Option &al) { if (al.present("-limit")) { rfc.set("start_limit", al.fval("-limit")); rfc.set("stop_limit", al.fval("-limit", 0)); } if (al.present("-range")) rfc.set("range", al.fval("-range")); if (al.present("-min_dur")) rfc.set("min_event_duration", al.fval("-min_dur")); } void set_options(EST_Option &al, EST_Features &op) { // Nobody else has set window_length or second_length so // set defaults here op.set("window_length",0.05); op.set("second_length",0.05); option_override(op, al, "window_length", "-w1"); option_override(op, al, "second_length", "-w2"); } speech_tools/main/viterbi_main.cc0000644000076400007640000005233111465017155015575 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Alan W Black and Simon King */ /* Date : January 1997 */ /*-----------------------------------------------------------------------*/ /* A simple use of the Viterbi decoder */ /* */ /*=======================================================================*/ #include #include #include #include "EST.h" EST_read_status load_TList_of_StrVector(EST_TList &w, const EST_String &filename, const int vec_len); static void print_results(EST_Relation &wstream); static bool do_search(EST_Relation &wstream); static EST_VTPath *vit_npath(EST_VTPath *p,EST_VTCandidate *c,EST_Features &f); static EST_VTCandidate *vit_candlist(EST_Item *s,EST_Features &f); static void top_n_candidates(EST_VTCandidate* &all_c); static void load_vocab(const EST_String &vfile); static void add_word(EST_Relation &w, const EST_String &word, int pos); static void load_wstream(const EST_String &filename, const EST_String &vfile, EST_Relation &w, EST_Track &obs); static void load_given(const EST_String &filename, const int ngram_order); static double find_gram_prob(EST_VTPath *p,int *state); // special stuff for non-sliding window ngrams static double find_extra_gram_prob(EST_VTPath *p,int *state, int time); static void get_history(EST_StrVector &history, EST_VTPath *p); static void fill_window(EST_StrVector &window,EST_StrVector &history, EST_VTPath *p,const int time); static int is_a_special(const EST_String &s, int &val); static int max_history=0; static EST_Ngrammar ngram; static EST_String pstring = SENTENCE_START_MARKER; static EST_String ppstring = SENTENCE_END_MARKER; static float lm_scale = 1.0; static float ob_scale = 1.0; static float ob_scale2 = 1.0; // pruning beam widths static float beam=-1; static float ob_beam=-1; static int n_beam = -1; static bool trace_on = FALSE; // always logs static double ob_log_prob_floor = SAFE_LOG_ZERO; static double ob_log_prob_floor2 = SAFE_LOG_ZERO; static double lm_log_prob_floor = SAFE_LOG_ZERO; int btest_debug = FALSE; static EST_String out_file = ""; static EST_StrList vocab; static EST_Track observations; static EST_Track observations2; static EST_TList given; // to do : convert to array for speed int using_given=FALSE; // default is that obs are already logs int take_logs = FALSE; int num_obs = 1; /** @name viterbi Combine n-gram model and likelihoods to estimate posterior probabilities * @id viterbi-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** viterbi is a simple time-synchronous Viterbi decoder. It finds the most likely sequence of items drawn from a fixed vocabulary, given frame-by-frame observation probabilities for each item in that vocabulary, and a ngram grammar. Possible uses include: Simple speech recogniser back end viterbi can optionally use two sets of frame-by-frame observation probabilities in a weighted-sum fashion. Also, the ngram language model is not restricted to the conventional sliding window type in which the previous n-1 items are the ngram context. Items in the ngram context at each frame may be given. In this case, the user must provide a file containing the ngram context: one (n-1) tuple per line. To include items from the partial Viterbi path so far (i.e. found at recognition time, not given) the special notation <-N> is used where N indicates the distance back to the item required. For example <-1> would indicate the item on the partial Viterbi path at the last frame. See \Ref{Examples}. Pruning Three types of pruning are available to reduce the size of the search space and therefore speed up the search: Observation pruning Top-N pruning at each frame Fixed width beam pruning */ //@} /**@name Options */ //@{ //@options //@} int main(int argc, char **argv) { EST_StrList files; EST_Option al; EST_Relation wstream; double floor; // a temporary parse_command_line(argc, argv, EST_String("[observations file] -o [output file]\n")+ "Summary: find the most likely path through a sequence of\n"+ " observations, constrained by a language model.\n"+ "-ngram Grammar file, required\n"+ "-given ngram left contexts, per frame\n"+ "-vocab File with names of vocabulary, this\n"+ " must be same number as width of observations, required\n"+ "-ob_type Observation type : likelihood .... and change doc\"probs\" or \"logs\" (default is \"logs\")\n"+ "\nFloor values and scaling (scaling is applied after floor value)\n"+ "-lm_floor LM floor probability\n"+ "-lm_scale LM scale factor factor (applied to log prob)\n"+ "-ob_floor Observations floor probability\n"+ "-ob_scale Observation scale factor (applied to prob or log prob, depending on -ob_type)\n\n"+ "-prev_tag \n"+ " tag before sentence start\n"+ "-prev_prev_tag \n"+ " all words before 'prev_tag'\n"+ "-last_tag \n"+ " after sentence end\n"+ "-default_tags use default tags of "+SENTENCE_START_MARKER+"," SENTENCE_END_MARKER+" and "+SENTENCE_END_MARKER+"\n"+ " respectively\n\n"+ "-observes2 second observations (overlays first, ob_type must be same)\n"+ "-ob_floor2 \n"+ "-ob_scale2 \n\n"+ "-ob_prune observation pruning beam width (log) probability\n"+ "-n_prune top-n pruning of observations\n"+ "-prune pruning beam width (log) probability\n"+ "-trace show details of search as it proceeds\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (files.length() != 1) { cerr << argv[0]; cerr << ": you must give exactly one observations file on the command line"; cerr << endl; cerr << "(use -observes2 for optional second observations)" << endl; exit(-1); } if (al.present("-ngram")) { ngram.load(al.val("-ngram")); } else { cerr << argv[0] << ": no ngram specified" << endl; exit(-1); } if(!al.present("-vocab")) { cerr << "You must provide a vocabulary file !" << endl; exit(-1); } load_wstream(files.first(),al.val("-vocab"),wstream,observations); if (al.present("-observes2")) { load_wstream(al.val("-observes2"),al.val("-vocab"),wstream,observations2); num_obs = 2; } if (al.present("-given")) { load_given(al.val("-given"),ngram.order()); using_given=TRUE; } if (al.present("-lm_scale")) lm_scale = al.fval("-lm_scale"); else lm_scale = 1.0; if (al.present("-ob_scale")) ob_scale = al.fval("-ob_scale"); else ob_scale = 1.0; if (al.present("-ob_scale2")) ob_scale2 = al.fval("-ob_scale2"); else ob_scale2 = 1.0; if (al.present("-prev_tag")) pstring = al.val("-prev_tag"); if (al.present("-prev_prev_tag")) ppstring = al.val("-prev_prev_tag"); // pruning if (al.present("-prune")) beam = al.fval("-prune"); else beam = -1; // no pruning if (al.present("-ob_prune")) ob_beam = al.fval("-ob_prune"); else ob_beam = -1; // no pruning if (al.present("-n_prune")) { n_beam = al.ival("-n_prune"); if(n_beam <= 0) { cerr << "WARNING : " << n_beam; cerr << " is not a reasonable value for -n_prune !" << endl; } } else n_beam = -1; // no pruning if (al.present("-trace")) trace_on = TRUE; // language model floor if (al.present("-lm_floor")) { floor = al.fval("-lm_floor"); if(floor < 0) { cerr << "Error : LM floor probability is negative !" << endl; exit(-1); } else if(floor > 1) { cerr << "Error : LM floor probability > 1 " << endl; exit(-1); } lm_log_prob_floor = safe_log(floor); } // observations floor if (al.present("-ob_floor")) { floor = al.fval("-ob_floor"); if(floor < 0) { cerr << "Error : Observation floor probability is negative !" << endl; exit(-1); } else if(floor > 1) { cerr << "Error : Observation floor probability > 1 " << endl; exit(-1); } ob_log_prob_floor = safe_log(floor); } if (al.present("-ob_floor2")) { floor = al.fval("-ob_floor2"); if(floor < 0) { cerr << "Error : Observation2 floor probability is negative !" << endl; exit(-1); } else if(floor > 1) { cerr << "Error : Observation2 floor probability > 1 " << endl; exit(-1); } ob_log_prob_floor2 = safe_log(floor); } if (al.present("-ob_type")) { if(al.val("-ob_type") == "logs") take_logs = false; else if(al.val("-ob_type") == "probs") take_logs = true; else { cerr << "\"" << al.val("-ob_type") << "\" is not a valid ob_type : try \"logs\" or \"probs\"" << endl; exit(-1); } } if(do_search(wstream)) print_results(wstream); else cerr << "No path could be found." << endl; return 0; } static void print_results(EST_Relation &wstream) { EST_Item *s; float pscore; EST_String predict; FILE *fd; if (out_file == "-") fd = stdout; else if ((fd = fopen(out_file,"wb")) == NULL) { cerr << "can't open \"" << out_file << "\" for output" << endl; exit(-1); } for (s=wstream.head(); s != 0 ; s=s->next()) { predict = s->f("best").string(); pscore = s->f("best_score"); fprintf(fd,"%s %f\n",(const char *)predict,pscore); } if (out_file != "") fclose(fd); } static bool do_search(EST_Relation &wstream) { // Apply Ngram to matrix of probs int states; states = ngram.num_states(); EST_Viterbi_Decoder vc(vit_candlist,vit_npath,states); vc.initialise(&wstream); if((beam > 0) || (ob_beam > 0)) vc.set_pruning_parameters(beam,ob_beam); if(trace_on) { vc.turn_on_trace(); cerr << "Starting Viterbi search..." << endl; } vc.search(); return vc.result("best"); // adds fields to w with best values } static void load_wstream(const EST_String &filename, const EST_String &vfile, EST_Relation &w, EST_Track &obs) { // Load in vocab and probs into Stream (this isn't general) EST_String word, pos; int i=-1; if(vocab.empty()) load_vocab(vfile); if (obs.load(filename,0.10) != 0) { cerr << "can't find observations file \"" << filename << "\"" << endl; exit(-1); } if (vocab.length() != obs.num_channels()) { cerr << "Number in vocab (" << vocab.length() << ") not equal to observation's width (" << obs.num_channels() << ")" << endl; exit(-1); } if(w.empty()) for (i=0; i < obs.num_frames(); i++) add_word(w,itoString(i),i); } static void load_given(const EST_String &filename, const int ngram_order) { EST_String word, pos; EST_Litem *p; int i,j; if (load_TList_of_StrVector(given,filename,ngram_order-1) != 0) { cerr << "can't load given file \"" << filename << "\"" << endl; exit(-1); } // set max history for (p = given.head(); p; p = p->next()) { for(i=0;i max_history)) max_history = -j; } } static void load_vocab(const EST_String &vfile) { // Load vocabulary (strings) EST_TokenStream ts; if (ts.open(vfile) == -1) { cerr << "can't find vocab file \"" << vfile << "\"" << endl; exit(-1); } while (!ts.eof()) if (ts.peek() != "") vocab.append(ts.get().string()); ts.close(); } static void add_word(EST_Relation &w, const EST_String &word, int pos) { EST_Item *item = w.append(); item->set_name(word); item->set("pos",pos); } static EST_VTCandidate *vit_candlist(EST_Item *s,EST_Features &f) { // Return a list of new candidates from this point double prob=1.0,prob2=1.0; int i; EST_Litem *p; int observe; EST_VTCandidate *all_c = 0; EST_VTCandidate *c; (void)f; observe = s->f("pos"); // index for observations TRACK for (i=0,p=vocab.head(); i < observations.num_channels(); i++,p=p->next()) { c = new EST_VTCandidate; c->name = vocab(p); // to be more efficient this could be the index prob = observations.a(observe,i); if(num_obs == 2) prob2 = observations2.a(observe,i); if(take_logs) { prob = safe_log10(prob); if (prob < ob_log_prob_floor) prob = ob_log_prob_floor; if(num_obs == 2) { prob2 = safe_log10(prob2); if (prob2 < ob_log_prob_floor2) prob2 = ob_log_prob_floor2; } } else // already in logs { if (prob < ob_log_prob_floor) prob = ob_log_prob_floor; if ((num_obs == 2) && (prob2 < ob_log_prob_floor2)) prob2 = ob_log_prob_floor2; } prob *= ob_scale; prob2 *= ob_scale2; if(num_obs == 2) c->score = prob + prob2; else c->score = prob; c->next = all_c; c->s = s; all_c = c; } if(n_beam > 0) { // N.B. this might be very time-consuming top_n_candidates(all_c); } return all_c; } static EST_VTPath *vit_npath(EST_VTPath *p,EST_VTCandidate *c, EST_Features &f) { // Build a (potential) new path link from this previous path and // This candidate EST_VTPath *np = new EST_VTPath; double lprob,prob; EST_String prev,ttt; (void)f; np->c = c; np->from = p; // are we using extra info ? if(using_given) // time of candidate is // c->s->f("pos"); prob = find_extra_gram_prob(np,&np->state,c->s->f("pos")); else prob = find_gram_prob(np,&np->state); lprob = safe_log10(prob); if (lprob < lm_log_prob_floor) lprob = lm_log_prob_floor; lprob *= lm_scale; np->f.set("lscore",(c->score+lprob)); // simonk : changed prob to lprob if (p==0) np->score = (c->score+lprob); else np->score = (c->score+lprob) + p->score; return np; } static double find_gram_prob(EST_VTPath *p,int *state) { // Look up transition probability from *state for name. // Return probability and update state double prob=0.0,nprob; int i,f=FALSE; EST_VTPath *pp; EST_StrVector window(ngram.order()); for (pp=p->from,i=ngram.order()-2; i >= 0; i--) { if (pp != 0) { window[i] = pp->c->name.string(); pp = pp->from; } else if (f) window[i] = ppstring; else { window[i] = pstring; f = TRUE; } } window[ngram.order()-1] = p->c->name.string(); const EST_DiscreteProbDistribution &pd = ngram.prob_dist(window); if (pd.samples() == 0) prob = 0; else prob = (double)pd.probability(p->c->name.string()); for (i=0; i < ngram.order()-1; i++) window[i] = window(i+1); ngram.predict(window,&nprob,state); return prob; } static double find_extra_gram_prob(EST_VTPath *p,int *state,int time) { int i; double prob=0.0,nprob; EST_StrVector window(ngram.order()); EST_StrVector history(max_history); get_history(history,p); fill_window(window,history,p,time); /* cerr << "Looking up ngram "; for(i=0;ic->name.string()); // shift history, adding latest item at 'end' (0) if(max_history>0) { for(i=history.length()-1;i>0;i--) history[i] = history(i-1); history[0] = p->c->name.string(); } fill_window(window,history,p,time+1); ngram.predict(window,&nprob,state); //cerr << endl << endl; return prob; } static void get_history(EST_StrVector &history, EST_VTPath *p) { EST_VTPath *pp; int i,f=FALSE; for (pp=p->from,i=0; i < history.length(); i++) { if (pp != 0) { history[i] = pp->c->name.string(); pp = pp->from; } else if (f) history[i] = ppstring; else { history[i] = pstring; f = TRUE; } } } static void fill_window(EST_StrVector &window,EST_StrVector &history, EST_VTPath *p,const int time) { // Look up transition probability from *state for name. // Return probability and update state int i,j; EST_String s; // can we even do it? if( time >= given.length() ) return; // format should be run-time defined, but try this for now // first n-1 things in window come from 'given' // last one is predictee // also want vocab and grammar mismatch allowed !!!!!! // predictee window[ngram.order()-1] = p->c->name.string(); // given info for this time EST_StrVector *this_g = &(given.nth(time)); // inefficient to count down a list for(i=0;i (0) j=-2 -> (1) etc. else window[i] = (*this_g)(i); } } static int is_a_special(const EST_String &s, int &val) { // special is "" EST_String tmp; if(s.contains("<") && s.contains(">")) { tmp = s.after("<"); tmp = tmp.before(">"); val = atoi(tmp); //cerr << "special " << tmp << "=" << val << endl; return TRUE; } return FALSE; } static void top_n_candidates(EST_VTCandidate* &all_c) { // keep the n most likely candidates // avoiding a full sort of the (potentially long) list EST_VTCandidate *top_c=NULL,*p,*q,*this_best, *prev_to_best; int i; if(n_beam < 1) return; // do nothing // here we assume big is always good //if(!big_is_good) //score_multiplier = -1; for(i=0;inext) { //cerr << "item : " << p->score << endl; if(p->score > this_best->score) { this_best = p; prev_to_best=q; } } if(this_best == NULL) break; // give up now - must have run out of candidates // move best candidate over to new list if(prev_to_best == NULL) // best was head of list all_c = this_best->next; else // best was not head of all_c prev_to_best->next = this_best->next; this_best->next = top_c; top_c = this_best; } delete all_c; all_c = top_c; /* cerr << "Here are the top " << n_beam << " candidates" << endl; for(p=all_c;p != NULL;p=p->next) cerr << p->score << endl; */ } /**@name Examples Example 'given' file (items f and g are in the vocabulary), the ngram is a 4-gram. <-2> g g <-1> g f <-1> f g <-2> g g <-3> g g <-1> g f */ //@{ //@} //@} speech_tools/main/dp_main.cc0000644000076400007640000003117511465017155014537 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author: Simon King */ /* Date : May 1998 */ /*-----------------------------------------------------------------------*/ /* Simple dynamic programming */ /* e.g. for aligning pronunciations */ /*=======================================================================*/ #include #include #include #include "EST.h" EST_read_status load_TList_of_StrVector(EST_TList &w, const EST_String &filename, const int vec_len); typedef float (*local_cost_function)(const EST_Item *item1, const EST_Item *item2); typedef bool (*local_pruning_function)(const int i, const int j, const int max_i, const int max_j); bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym); bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, EST_Item *null_sym); float local_cost(const EST_Item *s1, const EST_Item *s2); bool local_prune(const int i, const int j, const int max_i,const int max_j); static void load_vocab(const EST_String &vfile); static EST_Item *null_sym; //static EST_String deleted_marker = ""; //static EST_String inserted_marker = ""; static bool show_cost=FALSE; static int prune_width = 100; //static float path_cost; int StrVector_index(const EST_StrVector &v, const EST_String &s); EST_StrList pattern1_l, pattern2_l, vocab_l; EST_StrVector pattern1, pattern2, vocab; EST_FMatrix DP_substitution_cost; EST_FVector DP_deletion_cost; EST_FVector DP_insertion_cost; EST_IMatrix DP_path_i,DP_path_j; EST_FMatrix cost_matrix; // this are local distance measures, // NOT the 1/2/1 weights in the DP recursion formula ! float insertion_cost = 1; float deletion_cost = 1; float substitution_cost = 1; // two possibilities : // 1. simple insertion/deletion/substitution penalties // 2. matrix of distances between all pairs of vocab items, // where vocab includes some null symbol for insertions/deletions EST_String distance_measure = "simple"; // could be "matrix" /** @name dp Perform dynamic programming on label sequences * @id dp-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** dp provides simple dynamic programming to find the lowest cost alignment of two symbol sequences. Possible uses include: Label alignment (e.g. speech recogniser output scoring) The costs of inserting/deleting/substituting symbols can be given either with command line options, or as a file containing a full matrix of costs. In the former case, all insertions will have the same cost. In the latter case, each row of the file contains the cost of replacing a symbol in sequence 1 with each possible symbol in the vocabulary to align with sequence 2, including a special "place holder" symbol used for insertions/deletions. See the examples below. The place holder can be redefined. The output is an EST utterance with three Relations: the first two are the input sequences, and the third shows the alignment found by dynamic programming. */ //@} /**@name Options */ //@{ //@options //@} int main(int argc, char **argv) { EST_StrList files; EST_Option al; EST_String out_file; //int i; EST_Relation *path1, *path2, *match; null_sym = new EST_Item; null_sym->set_name(""); parse_command_line(argc, argv, EST_String("Usage:\n")+ "dp \"pattern 1\" \"pattern 2\"\n"+ "Find the best alignment of a pair of symbol sequences (e.g. word pronuciations).\n"+ "-vocab file containing vocabulary\n"+ "-place_holder which vocab item is the place holder (default is " + null_sym->name() + " )\n"+ "-show_cost show cost of matching path\n"+ "-o output file\n"+ "-p 'beam' width\n"+ "Either:\n"+ "-i insertion cost\n"+ "-d deletion cost\n"+ "-s substitution cost\n"+ "Or:\n"+ "-cost_matrix file containing cost matrix\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (al.present("-vocab")) load_vocab(al.val("-vocab")); else { cerr << argv[0] << ": no vocab file specified" << endl; exit(-1); } if (al.present("-p")) prune_width = al.ival("-p"); if (al.present("-cost_matrix")) { if(al.present("-i") || al.present("-d") || al.present("-s") ) { cerr << "Can't have ins/del/subs costs as well as matrix !" << endl; exit(-1); } distance_measure="matrix"; cost_matrix.load(al.val("-cost_matrix")); if(al.present("-place_holder")) null_sym->set_name(al.val("-place_holder")); if(StrVector_index(vocab,null_sym->name()) < 0) { cerr << "The place holder symbol '" << null_sym->name(); cerr << "' is not in the vocbulary !" << endl; exit(-1); } if(cost_matrix.num_columns() != vocab.length()) { cerr << "Cost matrix number of columns must match vocabulary size !" << endl; exit(-1); } if(cost_matrix.num_rows() != vocab.length()) { cerr << "Cost matrix number of rows must match vocabulary size !" << endl; exit(-1); } } else if(al.present("-i") && al.present("-d") && al.present("-s") ) { insertion_cost = al.fval("-i"); deletion_cost = al.fval("-d"); substitution_cost = al.fval("-s"); } else { cerr << "Must give either ins/del/subs costs or cost matrix !" << endl; exit(-1); } if(al.present("-show_cost")) show_cost=TRUE; if(files.length() != 2) { cerr << "Must give 2 patterns !" << endl; exit(-1); } StringtoStrList(files(files.head()),pattern1_l," "); StringtoStrList(files(files.head()->next()),pattern2_l," "); EST_Utterance utt; path1 = utt.create_relation("Lexical"); path2 = utt.create_relation("Surface"); match = utt.create_relation("Match"); EST_Litem *p; for(p=pattern1_l.head();p != 0; p=p->next()) { if( StrVector_index(vocab,pattern1_l(p)) < 0) { cerr << pattern1_l(p) << " is not in the vocabulary !" << endl; exit(1); } EST_Item new_item; new_item.set_name(pattern1_l(p)); path1->append(&new_item); } for(p=pattern2_l.head();p != 0; p=p->next()) { if( StrVector_index(vocab,pattern2_l(p)) < 0) { cerr << pattern2_l(p) << " is not in the vocabulary !" << endl; exit(1); } EST_Item new_item; new_item.set_name(pattern2_l(p)); path2->append(&new_item); } // to do : check all items in two patterns are in vocab // ..... // cerr << "MATCHING..." << endl; if(!dp_match(*path1,*path2,*match, local_cost,local_prune,null_sym)) // cerr << "OK !" << endl; // else cerr << "No match could be found." << endl; utt.save(out_file); return 0; } static void load_vocab(const EST_String &vfile) { // Load vocabulary (strings) EST_TokenStream ts; if (ts.open(vfile) == -1) { cerr << "can't find vocab file \"" << vfile << "\"" << endl; exit(-1); } while (!ts.eof()) if (ts.peek() != "") vocab_l.append(ts.get().string()); ts.close(); StrList_to_StrVector(vocab_l,vocab); } float local_cost(const EST_Item *s1, const EST_Item *s2) { // N.B. cost is not necessarily zero for matching symbols //cerr << "lcf " << s1 << "," << s2 << endl; // otherwise cost is either insertion cost, or cost_matrix value if(distance_measure == "simple") { if(s1->name() == s2->name()) return 0; else { if(s1 == null_sym) return insertion_cost; else if(s2 == null_sym) return deletion_cost; else return substitution_cost; } } //cerr << "Cost of replacing " << s1 << " with " << s2 << " is "; //cerr << cost_matrix(StrVector_index(vocab,s1),StrVector_index(vocab,s2)) << endl; return cost_matrix(StrVector_index(vocab,s1->name()), StrVector_index(vocab,s2->name())); } bool local_prune(const int i, const int j, const int max_i, const int max_j) { // keep it simple : // if we stray too far from the diagonal - PRUNE ! float scale = (float)max_i / (float)max_j; float near_j = (float)i / scale; float near_i = (float)j * scale; /* cerr << "prune i: " << i << " " << near_i - (float)i << " " << abs(near_i - (float)i)<< endl; cerr << "prune j: " << j << " " << near_j - (float)j << " " << abs(near_j - (float)j) << endl; */ if( (abs((int)(near_i - (float)i)) > prune_width) || (abs((int)(near_j - (float)j)) > prune_width) ) { //cerr << "lpf " << i << "," << j << " true" << endl; return TRUE; } return FALSE; } /**@name Examples Align two symbol sequences: $ dp -vocab vocab.file "a b c" "a b d c" -i 1 -d 2 -s 3 where vocab.file contains "a b c d" Or, using a full cost matrix: $ dp -vocab vocab2.file -cost_matrix foo "a b c" "a b d c" where vocab2.file contains "a b c d " and the file foo contains: 0 3 3 3 2 3 0 3 3 2 3 3 0 3 2 3 3 3 0 2 1 1 1 1 0 Each row of foo shows the cost of replacing an input symbol with each symbol in the vocabulary to match an output symbol. Each row corresponds to an item in the vocabulary (in the order they appear in the vocabulary file). In the example, replacing 'a' with 'a' costs 0, replacing 'a' with any of 'b' 'c' or 'd' costs 3 (a substitution), and replacing 'a' with the place holder symbol 'null' costs 2 (a deletion). The cost of replacing 'null' with anything other than 'null' costs 1 (an insertion). The costs of 1,2 and 3 used here are only for illustration. The cost matrix meed not have the form above - for example, replacing 'a' with 'a' need not cost 0. The entries in foo are read as floats. */ //@{ //@} speech_tools/main/bcat_main.cc0000644000076400007640000001103011465017155015031 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Thu Aug 14 1997 */ /* -------------------------------------------------------------------- */ /* A simple file concatenator which does everything in binary */ /* mode. For use in the tests on Windows etc. */ /* */ /*************************************************************************/ #include #include "EST.h" #include "EST_String.h" #include "EST_error.h" #define BUFFER_SIZE (1024) /** @name bcat Binary safe version of cat @id bcat-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** bcat is a trivial file concatenation program. It exists to allow testing of various file splitting operations under the cygwin environment on Windows where the distinction between binary and text data is important. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_StrList files; EST_Option settings, cmd_line; parse_command_line (argc, argv, EST_String("-o [ofile] [files...]\n")+ "Summary; concatenate files in binary mode\n"+ "-o Ouptut file of binary data\n", files, cmd_line); EST_String out_file; if (cmd_line.present("-o")) out_file = cmd_line.val("-o"); else EST_error("No output file specified"); FILE *dest; if ((dest=fopen(out_file, "wb")) == NULL) EST_sys_error("Can't create '%s'", (const char *)out_file); EST_Litem *item; for(item=files.head(); item; item = item->next()) { FILE *src; if ((src=fopen(files(item), "rb"))==NULL) EST_sys_error("can't read '%s'", (const char *)files(item)); unsigned int n; char buf[BUFFER_SIZE]; while((n=fread(buf, sizeof(char), BUFFER_SIZE, src)) >0) if (fwrite(buf, sizeof(char), n, dest) < n) EST_sys_error("write error"); fclose(src); } fclose(dest); return 0; } speech_tools/main/ch_utt_main.cc0000644000076400007640000001126111465017155015414 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Authors: Richard Caley */ /* ------------------------------------------------------------------- */ /* Label conversion main file */ /* */ /*************************************************************************/ #include #include "EST_error.h" #include "EST_ling_class.h" #include "EST_cmd_line.h" int main(int argc, char *argv[]) { EST_String out_file, ext; EST_StrList files; EST_Option al; parse_command_line(argc, argv, EST_String("Usage: " "ch_utt -o \n" "Summary: change/copy utterance file\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n" "-f Feature to use as item ID when merging utterances.\n" "-o output file name\n" "-otype output file type: \n" "-sysdir Look for unqualified system entities in this directory" ) + options_utterance_filetypes_long(), files, al); EST_Utterance utt; EST_read_status rstat; EST_String feat = al.present("-f")?al.sval("-f"):EST_String("name"); if (al.present("-sysdir")) utterance_xml_register_id("^\\([^/]*\\)", al.sval("-sysdir") + "/\\1"); rstat=utt.load(files.first()); if (rstat == read_format_error) EST_error("Bad format in %s", (const char *)files.first()); else if (rstat != read_ok) EST_sys_error("Error reading %s", (const char *)files.first()); EST_Utterance u; EST_Litem *fp = files.head()->next(); for(; fp != NULL; fp=fp->next()) { rstat = u.load(files(fp)); if (rstat == read_format_error) EST_error("Bad format in %s", (const char *)files(fp)); else if (rstat != read_ok) EST_sys_error("Error reading %s", (const char *)files(fp)); utterance_merge(utt, u, feat); } EST_String otype = al.present("-otype")? al.sval("-otype") : (EST_String)"est"; if (al.present("-o")) utt.save(al.sval("-o"), otype); else { utt.save("-", otype); } return 0; } speech_tools/main/fringe_client_main.cc0000644000076400007640000001422410127000720016720 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Simple client which talks to fringe. */ /* */ /*************************************************************************/ #include #include "EST_unix.h" #include "EST_error.h" #include "EST_ServiceTable.h" #include "EST_FringeServer.h" #include "EST_cmd_line.h" /** @name fringe_client Send commands to a running fringe server @id fringe-client-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** fringe_client is a simple program for sending commands to a fringe process which is running in server mode. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char *argv[]) { EST_String out_file, ext; EST_StrList commands; EST_Option al; int verbose; parse_command_line (argc, argv, EST_String("[options] [command]\n")+ "Summary: Send commands to a running fringe server.\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n" "-n Name of fringe to connect to (default 'fringe').\n" "-f File containing fringe connection information.\n" "-l List available fringe servers.\n" "-v Print what is being done.\n", commands, al); verbose=al.present("-v"); if (al.present("-f")) EST_ServiceTable::read_table(al.sval("-f")); else EST_ServiceTable::read_table(); EST_String name="fringe"; if (al.present("-n")) name = al.sval("-n"); if (al.present("-l")) { EST_ServiceTable::list(cout, "fringe"); exit(0); } EST_FringeServer server(name, verbose?&cout:(ostream *)NULL); switch (server.connect()) { case connect_ok: break; case connect_not_found_error: EST_sys_error("Can't find host '%s:%d'", (const char *)server.servername(), server.port()); break; case connect_not_allowed_error: EST_sys_error("Can't connect to '%s:%d'", (const char *)server.servername(), server.port()); break; default: EST_sys_error("Error connecting to '%s:%d'", (const char *)server.servername(), server.port()); break; } EST_StrList::Entries p; for(p.begin(commands); p != 0; ++p) { EST_String package; EST_String operation; EST_FringeServer::Args args; EST_FringeServer::ResultHandler res_hand; EST_FringeServer::Result &res = res_hand.res; if (server.parse_command(*p, package, operation, args)) { if (verbose) { printf("command package='%s' operation='%s'\n", (const char *)package, (const char *)operation); EST_FringeServer::Args::Entries argp; for (argp.begin(args); argp != 0; ++argp) printf("\t%10s%s%s\n", (const char *)argp->k, argp->k==""?" : ":" = ", (const char *)argp->v.String()); } if (!server.execute(package, operation, args, res_hand)) EST_error("Error from Fringe: %s", (const char *)res.S("ERROR")); } else EST_error("badly formatted command '%s'", (const char *)*p); } return(0); } /**@name Finding Fringe. Each fringe which runs in server mode registers it's location in a file called .estServices in the users home directory. Multiple servers can be present if they are given different names, and the can be used to select which fringe a command is sent to. */ speech_tools/main/design_filter_main.cc0000644000076400007640000001352410127000720016730 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Paul Taylor, Simon King */ /* Date : 1995-99 */ /*-----------------------------------------------------------------------*/ /* Design FIR filter */ /* */ /*=======================================================================*/ #include #include #include #include "EST_Wave.h" #include "EST_cmd_line.h" #include "EST_cmd_line_options.h" #include "sigpr/EST_filter_design.h" /** @name design_filter * @id designfilter-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** designfilter computes the coefficients of a FIR filter with a given frequency response. The user supplies the frequency response as a vector of evenly spaced gains ranging from 0 to half the sampling frequency. The length of this vector must be a power of 2. The filter coefficients can be used by the \Ref{sigfilter} program. */ //@} /**@name Options */ //@{ //@options //@} int main (int argc, char *argv[]) { EST_FVector fresponse, filter; EST_String in_file("-"), out_file("-"), op_file(""), test; EST_Option al; EST_TList files; int forder; parse_command_line (argc, argv, EST_String("[input file0] -o [output file]\n") + "Summary: filter waveform files\n" "use \"-\" to make input and output files stdin/out\n" "-h Options help\n" "-forder Order of FIR filter. This must be ODD.\n" " Sensible values range \n" " from 19 (quick but with a shallow rolloff) to 199 \n" " (slow but with a steep rolloff). The default is 199.\n\n" "-double Design a filter suitable for double (zero-phase)\n" " filtering\n\n" "-o output filter file\n", files, al); out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; if (fresponse.load(files.first()) != format_ok) exit(-1); forder = al.present("-forder") ? al.ival("-forder") : 199; if (al.present("-double")) for (int i = 0; i < fresponse.length(); i++) fresponse[i] = sqrt(fresponse[i]); // user gives freq response for freq range 0...half sampling freq // we need to make a mirror image of this int l = fresponse.length() * 2; EST_FVector full_fresponse(l); for(int i = 0;iDesigning a bandpass filter The frequency response vector must be placed in a file, in either ascii of EST headered format. For example: EST_File fvector version 1 DataType ascii length 128 EST_Header_End 0.0 0.0 .....[etc] 1.0 1.0 1.0 .....[etc] 0.0 0.0 0.0 .....[etc] And the filter is simply designed using $ design_filter -o filter.coefficients filter.freq_response where filter.freq_response is the above file, and filter.coefficients is the output file which can be used by \Ref{sigfilter}. */ //@{ //@} //@} speech_tools/main/align_main.cc0000644000076400007640000003025311465017155015222 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : September 1999 */ /*-----------------------------------------------------------------------*/ /* Simple alignment scoring program to give number of insertions, */ /* deletions, errors between a string of symbols and a reference string */ /* of symbols */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_WFST.h" static int align_main(int argc, char **argv); static void nisttool_align(EST_Option &al); static void string_align(EST_Option &al); static void align_score(EST_Utterance &u, const EST_String &refrel, const EST_String &hyporel, const EST_String &alignrel, int &total,int &ins,int &del,int &sub,int &correct); static int name_distance(EST_Item *r,EST_Item *h); void align(EST_Utterance &utt, const EST_String &refrel, const EST_String &hyporel, const EST_String &alignrel); static void load_sentence(EST_Utterance &u, const EST_String &relname, EST_TokenStream &ts); static void load_sentence(EST_Utterance &u, const EST_String &relname, EST_String &relval); /** @name align align stream with reference stream @id align-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { align_main(argc,argv); exit(0); return 0; } static int align_main(int argc, char **argv) { // Top level function generates a WFST from rules EST_Option al; EST_StrList files; EST_String outfile; EST_String format; parse_command_line (argc, argv, EST_String("[options] ...\n")+ "Summary: align an hypothesis with a reference string\n"+ "-rfile Reference file\n"+ "-hfile Hypothesis file\n"+ "-rstring Reference string\n"+ "-hstring Hypothesis string\n"+ "-format \n"+ " Supported formats: strings, nisttool\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; if (al.present("-format")) format = al.val("-format"); else format = "strings"; if (format == "strings") string_align(al); else if (format == "nisttool") nisttool_align(al); else cout << "Unknown or unhandled format: " << format << endl; return 0; } bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, float ins, float del, float sub); static void string_align(EST_Option &al) { EST_String refStr = al.val("-rstring"); EST_String hypStr = al.val("-hstring"); EST_Utterance u; int total,ins,del,sub,correct; load_sentence(u,"ref",refStr); load_sentence(u,"hypo",hypStr); align(u,"ref","hypo","align"); align_score(u,"ref","hypo","align",total,ins,del,sub,correct); fprintf(stdout,"words %d\n",total); fprintf(stdout,"insertions %d\n",ins); fprintf(stdout,"deletions %d\n",del); fprintf(stdout,"substitutions %d\n",sub); fprintf(stdout,"correct %d\n",correct); fprintf(stdout,"WER %f\n",(100.0 * (float)(ins+del+sub))/total); } static void nisttool_align(EST_Option &al) { // Using the format used by the NIST tools for alignment // Sentence per line with parenthesized id at end EST_String reffile = al.val("-rfile"); EST_String hypofile = al.val("-hfile"); EST_TokenStream rts,hts; EST_Item *r, *h; static EST_Regex id("^(.*)$"); int sents=0; int total,ins,del,sub,correct; int s_total,s_ins,s_del,s_sub,s_correct; rts.open(reffile); hts.open(hypofile); s_total=s_ins=s_del=s_sub=s_correct=0; while (!rts.eof()) { EST_Utterance u; load_sentence(u,"ref",rts); load_sentence(u,"hypo",hts); r = u.relation("ref")->last(); h = u.relation("hypo")->last(); if ((!r->name().matches(id)) || (r->name() != h->name())) { cerr << "Align: failed to match sentence " << sents << " at id " << r->name() << endl; } else { // Ids aren't counted as words r->unref_all(); h->unref_all(); align(u,"ref","hypo","align"); // This doesn't give exactly the same as the NIST tools // even though it should (actually I think its better) // dp_match(*u.relation("ref"), // *u.relation("hypo"), // *u.create_relation("align"), // 3,3,4); align_score(u,"ref","hypo","align", total,ins,del,sub,correct); s_total += total; s_ins += ins; s_del += del; s_sub += sub; s_correct += correct; } sents++; } rts.close(); hts.close(); fprintf(stdout,"sentences %d\n",sents); fprintf(stdout,"words %d\n",s_total); fprintf(stdout,"insertions %d\n",s_ins); fprintf(stdout,"deletions %d\n",s_del); fprintf(stdout,"substitutions %d\n",s_sub); fprintf(stdout,"correct %d\n",s_correct); fprintf(stdout,"WER %f\n",(100.0 * (float)(s_ins+s_del+s_sub))/s_total); } static void load_sentence(EST_Utterance &u, const EST_String &relname, EST_TokenStream &ts) { EST_Relation *r = u.create_relation(relname); do { EST_Item *i = r->append(); i->set_name(ts.get()); } while ((!ts.eoln()) && (!ts.eof())); } static void load_sentence(EST_Utterance &u, const EST_String &relname, EST_String &relval) { EST_Relation *r = u.create_relation(relname); EST_StrList strlist; StringtoStrList(relval, strlist, " "); EST_StrList::Entries iter; for (iter.begin(strlist); iter; ++iter) { EST_Item *i = r->append(); i->set_name(*iter); } } static void align_score(EST_Utterance &u, const EST_String &refrel, const EST_String &hyporel, const EST_String &alignrel, int &total,int &ins,int &del,int &sub,int &correct) { // Score alignment EST_Item *ri,*hi; total=ins=del=correct=sub=0; for (ri=u.relation(refrel)->first(), hi=u.relation(hyporel)->first(); ri; ri=ri->next(),hi=hi->next()) { for ( ; (as(hi,alignrel) == 0) && hi ; hi=hi->next()) { fprintf(stdout,"inserted: %s\n",(const char *)hi->name()); ins++; } for ( ; (daughter1(ri,alignrel) == 0) && ri; ri=ri->next()) { fprintf(stdout,"deleted: %s\n",(const char *)ri->name()); del++; } if (!ri) break; if (name_distance(ri,daughter1(ri,alignrel)) == 0) { fprintf(stdout,"correct: %s\n",(const char *)ri->name()); correct++; } else { fprintf(stdout,"substituted: %s\n",(const char *)ri->name()); sub++; } } // For trailing hypothesized (or ref is nil) for ( ; hi ; hi=hi->next()) { fprintf(stdout,"inserted: %s\n",(const char *)hi->name()); ins++; } total = u.relation(refrel)->length(); // fprintf(stdout,"total %d ins %d del %d subs %d correct %d\n", // total, ins, del, sub, correct); } static int name_distance(EST_Item *r,EST_Item *h) { EST_String rname = r->name(); EST_String hname = h->name(); if ((rname == hname) || (downcase(rname) == downcase(hname))) return 0; else return 1; } void align(EST_Utterance &utt, const EST_String &refrel, const EST_String &hyporel, const EST_String &alignrel) { // Align refrel to hyporel by alignrel int r_size = utt.relation(refrel)->length(); int h_size = utt.relation(hyporel)->length(); EST_Item *ri = utt.relation(refrel)->first(); EST_Item *hi = utt.relation(hyporel)->first(); int i,j; int insdel_cost = 3; int subs_cost = 4; float to_insert,to_del,to_subs; float cost; EST_Relation *ar = utt.create_relation(alignrel); EST_FMatrix dpt(r_size+1,h_size+1); EST_IMatrix dpp(r_size+1,h_size+1); // Initialise first row and column dpt(0,0) = subs_cost * name_distance(ri,hi); dpp(0,0) = 0; for (i=1; ifirst(); for (i=1; ri; ri=ri->next(),i++) { ar->append(ri); // for use later hi = utt.relation(hyporel)->first(); for (j=1; hi; hi=hi->next(),j++) { cost = name_distance(ri,hi); to_insert = insdel_cost + dpt(i,j-1); to_del = insdel_cost + dpt(i-1,j); to_subs = (cost * subs_cost) + dpt(i-1,j-1); if (to_insert < to_del) { if (to_insert < to_subs) { dpt(i,j) = to_insert; dpp(i,j) = 1; } else { dpt(i,j) = to_subs; dpp(i,j) = 0; } } else { if (to_del < to_subs) { dpt(i,j) = to_del; dpp(i,j) = -1; } else { dpt(i,j) = to_subs; dpp(i,j) = 0; } } } } // for (i=1,ri=utt.relation(refrel)->first(); i < r_size+1; i++,ri=ri->next()) // { // fprintf(stdout,"%10s ",(const char *)ri->name()); // for (j=1,hi=utt.relation(hyporel)->first(); jnext()) // fprintf(stdout,"%3d/%2d ",(int)dpt(i,j),dpp(i,j)); // fprintf(stdout,"\n"); // } for (i=r_size,j=h_size, ri=utt.relation(refrel)->last(), hi=utt.relation(hyporel)->last(); ri; i--,ri=ri->prev()) { while (dpp(i,j) == 1) { j--; // fprintf(stdout,"skipping hi %s\n", // (const char *)hi->name()); hi=hi->prev(); } if (dpp(i,j) == 0) { // fprintf(stdout,"linking %s %s\n", // (const char *)ri->name(), // (const char *)hi->name()); append_daughter(ri,alignrel,hi); j--; hi=hi->prev(); } // else // fprintf(stdout,"skipping ri %s\n", // (const char *)ri->name()); } } speech_tools/main/wagon_main.cc0000644000076400007640000004172411061232300015227 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996-2006 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*-----------------------------------------------------------------------*/ /* A Classification and Regression Tree (CART) Program */ /* A basic implementation of many of the techniques in */ /* Briemen et al. 1984 */ /* */ /* Added decision list support, Feb 1997 */ /* */ /* Added vector support for Clustergen 2005/2006 */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_Wagon.h" #include "EST_cmd_line.h" enum wn_strategy_type {wn_decision_list, wn_decision_tree}; static wn_strategy_type wagon_type = wn_decision_tree; static int wagon_main(int argc, char **argv); /** @name wagon CART building program @id wagon_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** wagon is used to build CART tress from feature data, its basic features include: both decisions trees and decision lists are supported predictees can be discrete or continuous input features may be discrete or continuous many options for controlling tree building fixed stop value balancing held-out data and pruning stepwise use of input features choice of optimization criteria correct/entropy (for classification and rmse/correlation (for regression) A detailed description of building CART models can be found in the CART model overview section. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { wagon_main(argc,argv); exit(0); return 0; } static int set_Vertex_Feats(EST_Track &wgn_VertexFeats, EST_String &wagon_track_features) { int i,s=0,e; EST_TokenStream ts; for (i=0; i Field description file\n"+ "-data Datafile, one vector per line\n"+ "-stop {50} Minimum number of examples for leaf nodes\n"+ "-test Datafile to test tree on\n"+ "-frs {10} Float range split, number of partitions to\n"+ " split a float feature range into\n"+ "-dlist Build a decision list (rather than tree)\n"+ "-dtree Build a decision tree (rather than list) default\n"+ "-output \n"+ "-o File to save output tree in\n"+ "-distmatrix \n"+ " A distance matrix for clustering\n"+ "-track \n"+ " track for vertex indices\n"+ "-track_start \n"+ " start channel vertex indices\n"+ "-track_end \n"+ " end (inclusive) channel for vertex indices\n"+ "-track_feats \n"+ " Track features to use, comma separated list\n"+ " with feature numbers and/or ranges, 0 start\n"+ "-unittrack \n"+ " track for unit start and length in vertex track\n"+ "-quiet No questions printed during building\n"+ "-verbose Lost of information printing during build\n"+ "-predictee \n"+ " name of field to predict (default is first field)\n"+ "-ignore \n"+ " Filename or bracket list of fields to ignore\n"+ "-count_field \n"+ " Name of field containing count weight for samples\n"+ "-stepwise Incrementally find best features\n"+ "-swlimit {0.0}\n"+ " Percentage necessary improvement for stepwise,\n"+ " may be negative.\n"+ "-swopt Parameter to optimize for stepwise, for \n"+ " classification options are correct or entropy\n"+ " for regression options are rmse or correlation\n"+ " correct and correlation are the defaults\n"+ "-balance For derived stop size, if dataset at node, divided\n"+ " by balance is greater than stop it is used as stop\n"+ " if balance is 0 (default) always use stop as is.\n"+ "-vertex_output Output or of cluster\n"+ "-held_out Percent to hold out for pruning\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, should not normally need\n"+ " to be changed from its default, only with *very*\n"+ " large description files (> 1M)\n"+ "-noprune No (same class) pruning required\n", files, al); if (al.present("-held_out")) wgn_held_out = al.ival("-held_out"); if (al.present("-balance")) wgn_balance = al.fval("-balance"); if ((!al.present("-desc")) || ((!al.present("-data")))) { cerr << argv[0] << ": missing description and/or datafile" << endl; cerr << "use -h for description of arguments" << endl; } if (al.present("-quiet")) wgn_quiet = TRUE; if (al.present("-verbose")) wgn_verbose = TRUE; if (al.present("-stop")) wgn_min_cluster_size = atoi(al.val("-stop")); if (al.present("-noprune")) wgn_prune = FALSE; if (al.present("-predictee")) wgn_predictee_name = al.val("-predictee"); if (al.present("-count_field")) wgn_count_field_name = al.val("-count_field"); if (al.present("-swlimit")) stepwise_limit = al.fval("-swlimit"); if (al.present("-frs")) // number of partitions to try in floats wgn_float_range_split = atof(al.val("-frs")); if (al.present("-swopt")) wgn_opt_param = al.val("-swopt"); if (al.present("-vertex_output")) wgn_vertex_output = al.val("-vertex_output"); if (al.present("-output") || al.present("-o")) { if (al.present("-o")) wgn_oname = al.val("-o"); else wgn_oname = al.val("-output"); wgn_coutput = new ofstream(wgn_oname); if (!(*wgn_coutput)) { cerr << "Wagon: can't open file \"" << wgn_oname << "\" for output " << endl; exit(-1); } } else wgn_coutput = &cout; if (al.present("-distmatrix")) { if (wgn_DistMatrix.load(al.val("-distmatrix")) != 0) { cerr << "Wagon: failed to load Distance Matrix from \"" << al.val("-distmatrix") << "\"\n" << endl; exit(-1); } } if (al.present("-dlist")) wagon_type = wn_decision_list; WNode *tree; float score; LISP ignores = NIL; siod_init(al.ival("-heap")); if (al.present("-ignore")) { EST_String ig = al.val("-ignore"); if (ig[0] == '(') ignores = read_from_string(ig); else ignores = vload(ig,1); } // Load in the data wgn_load_datadescription(al.val("-desc"),ignores); wgn_load_dataset(wgn_dataset,al.val("-data")); if (al.present("-distmatrix") && (wgn_DistMatrix.num_rows() < wgn_dataset.length())) { cerr << "wagon: distance matrix is smaller than number of training elements\n"; exit(-1); } else if (al.present("-track")) { wgn_VertexTrack.load(al.val("-track")); wgn_VertexFeats.resize(1,wgn_VertexTrack.num_channels()); for (i=0; i wgn_VertexTrack.num_channels())) { printf("wagon: track_start invalid: %d out of %d channels\n", feats_start, wgn_VertexTrack.num_channels()); exit(-1); } for (i=0; i wgn_VertexTrack.num_channels())) { printf("wagon: track_end invalid: %d between start %d out of %d channels\n", feats_end, feats_start, wgn_VertexTrack.num_channels()); exit(-1); } for (i=feats_end+1; i 0.0) // printf("%d ",i); // printf("\n"); if (al.present("-unittrack")) { /* contains two features, a start and length. start indexes */ /* into VertexTrack to the first vector in the segment */ wgn_UnitTrack.load(al.val("-unittrack")); } if (al.present("-test")) wgn_load_dataset(wgn_test_dataset,al.val("-test")); // Build and test the model if (al.present("-stepwise")) tree = wagon_stepwise(stepwise_limit); else if (wagon_type == wn_decision_tree) tree = wgn_build_tree(score); // default operation else if (wagon_type == wn_decision_list) // dlist is printed with build_dlist rather than returned tree = wgn_build_dlist(score,wgn_coutput); else { cerr << "Wagon: unknown operation, not tree or list" << endl; exit(-1); } if (tree != 0) { *wgn_coutput << *tree; summary_results(*tree,wgn_coutput); } if (wgn_coutput != &cout) delete wgn_coutput; return 0; } /** @name Building Trees To build a decision tree (or list) Wagon requires data and a description of it. A data file consists a set of samples, one per line each consisting of the same set of features. Features may be categorial or continuous. By default the first feature is the predictee and the others are used as predictors. A typical data file will look like this 0.399 pau sh 0 0 0 1 1 0 0 0 0 0 0 0.082 sh iy pau onset 0 1 0 0 1 1 0 0 1 0.074 iy hh sh coda 1 0 1 0 1 1 0 0 1 0.048 hh ae iy onset 0 1 0 1 1 1 0 1 1 0.062 ae d hh coda 1 0 0 1 1 1 0 1 1 0.020 d y ae coda 2 0 1 1 1 1 0 1 1 0.082 y ax d onset 0 1 0 1 1 1 1 1 1 0.082 ax r y coda 1 0 0 1 1 1 1 1 1 0.036 r d ax coda 2 0 1 1 1 1 1 1 1 ... The data may come from any source, such as the festival script dumpfeats which allows the creation of such files easily from utterance files. In addition to a data file a description file is also require that gives a name and a type to each of the features in the datafile. For the above example it would look like ((segment_duration float) ( name aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) ( n.name 0 aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) ( p.name 0 aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) (position_type 0 onset coda) (pos_in_syl float) (syl_initial 0 1) (syl_final 0 1) (R:Sylstructure.parent.R:Syllable.p.syl_break float) (R:Sylstructure.parent.syl_break float) (R:Sylstructure.parent.R:Syllable.n.syl_break float) (R:Sylstructure.parent.R:Syllable.p.stress 0 1) (R:Sylstructure.parent.stress 0 1) (R:Sylstructure.parent.R:Syllable.n.stress 0 1) ) The feature names are arbitrary, but as they appear in the generated trees is most useful if the trees are to be used in prediction of an utterance that the names are features and/or pathnames. Wagon can be used to build a tree with such files with the command wagon -data feats.data -desc fest.desc -stop 10 -output feats.tree A test data set may also be given which must match the given data description. If specified the built tree will be tested on the test set and results on that will be presented on completion, without a test set the results are given with respect to the training data. However in stepwise case the test set is used in the multi-level training process thus it cannot be considered as true test data and more reasonable results should found on applying the generate tree to truly held out data (via the program wagon_test). */ //@} speech_tools/main/wagon_test_main.cc0000644000076400007640000003472711162153672016313 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* A program for testing a CART tree against data, also may be used to */ /* predict values using a tree and data */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_Wagon.h" #include "EST_cutils.h" #include "EST_multistats.h" #include "EST_Token.h" #include "EST_cmd_line.h" static int wagon_test_main(int argc, char **argv); static LISP find_feature_value(const char *feature, LISP vector, LISP description); static LISP wagon_vector_predict(LISP tree, LISP vector, LISP description); static LISP get_data_vector(EST_TokenStream &data, LISP description); static void simple_predict(EST_TokenStream &data, FILE *output, LISP tree, LISP description, int all_info); static void test_tree_class(EST_TokenStream &data, FILE *output, LISP tree, LISP description); static void test_tree_float(EST_TokenStream &data, FILE *output, LISP tree, LISP description); /** @name wagon_test Test CART models @id wagon-test-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** Wagon_test is used to test CART models on feature data. A detailed description of the CART model can be found in the CART model overview section. */ int main(int argc, char **argv) { wagon_test_main(argc,argv); exit(0); return 0; } static int wagon_test_main(int argc, char **argv) { // Top level function sets up data and creates a tree EST_Option al; EST_StrList files; LISP description,tree=NIL;; EST_TokenStream data; FILE *wgn_output; parse_command_line (argc, argv, EST_String("\n")+ "Summary: program to test CART models on data\n"+ "-desc Field description file\n"+ "-data Datafile, one vector per line\n"+ "-tree File containing CART tree\n"+ "-track \n"+ " track for vertex indices\n"+ "-predict Predict for each vector returning full vector\n"+ "-predict_val Predict for each vector returning just value\n"+ "-predictee \n"+ " name of field to predict (default is first field)\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, should not normally need\n"+ " to be changed from its default\n"+ "-o File to save output in\n", files, al); siod_init(al.ival("-heap")); if (al.present("-desc")) { gc_protect(&description); description = car(vload(al.val("-desc"),1)); } else { cerr << argv[0] << ": no description file specified" << endl; exit(-1); } if (al.present("-tree")) { gc_protect(&tree); tree = car(vload(al.val("-tree"),1)); if (tree == NIL) { cerr << argv[0] << ": no tree found in \"" << al.val("-tree") << "\"" << endl; exit(-1); } } else { cerr << argv[0] << ": no tree file specified" << endl; exit(-1); } if (al.present("-data")) { if (data.open(al.val("-data")) != 0) { cerr << argv[0] << ": can't open data file \"" << al.val("-data") << "\" for input." << endl; exit(-1); } } else { cerr << argv[0] << ": no data file specified" << endl; exit(-1); } if (al.present("-track")) { wgn_VertexTrack.load(al.val("-track")); } if (al.present("-o")) { if ((wgn_output = fopen(al.val("-o"),"w")) == NULL) { cerr << argv[0] << ": can't open output file \"" << al.val("-o") << "\"" << endl; } } else wgn_output = stdout; if (al.present("-predictee")) { LISP l; int i; wgn_predictee_name = al.val("-predictee"); for (l=description,i=0; l != NIL; l=cdr(l),i++) if (streq(wgn_predictee_name,get_c_string(car(car(l))))) { wgn_predictee = i; break; } if (l==NIL) { cerr << argv[0] << ": predictee \"" << wgn_predictee << "\" not in description\n"; } } const char *predict_type = get_c_string(car(cdr(siod_nth(wgn_predictee,description)))); if (al.present("-predict")) simple_predict(data,wgn_output,tree,description,FALSE); else if (al.present("-predict_val")) simple_predict(data,wgn_output,tree,description,TRUE); else if (streq(predict_type,"float") || streq(predict_type,"int")) test_tree_float(data,wgn_output,tree,description); #if 0 else if (streq(predict_type,"vector")) test_tree_vector(data,wgn_output,tree,description); #endif else test_tree_class(data,wgn_output,tree,description); if (wgn_output != stdout) fclose(wgn_output); data.close(); return 0; } static LISP get_data_vector(EST_TokenStream &data, LISP description) { // read in one vector. Should be terminated with an newline LISP v=NIL,d; if (data.eof()) return NIL; for (d=description; d != NIL; d=cdr(d)) { EST_Token t = data.get(); if ((d != description) && (t.whitespace().contains("\n"))) { cerr << "wagon_test: unexpected newline within vector " << t.row() << " wrong number of features" << endl; siod_error(); } if (streq(get_c_string(car(cdr(car(d)))),"float") || streq(get_c_string(car(cdr(car(d)))),"int")) v = cons(flocons(atof(t.string())),v); else if ((streq(get_c_string(car(cdr(car(d)))),"_other_")) && (siod_member_str(t.string(),cdr(car(d))) == NIL)) v = cons(strintern("_other_"),v); else v = cons(strintern(t.string()),v); } return reverse(v); } static void simple_predict(EST_TokenStream &data, FILE *output, LISP tree, LISP description, int all_info) { LISP vector,predict; EST_String val; for (vector=get_data_vector(data,description); vector != NIL; vector=get_data_vector(data,description)) { predict = wagon_vector_predict(tree,vector,description); if (all_info) val = siod_sprint(car(reverse(predict))); else val = siod_sprint(predict); fprintf(output,"%s\n",(const char *)val); } } static void test_tree_float(EST_TokenStream &data, FILE *output, LISP tree, LISP description) { // Test tree against data to get summary of results FLOAT float predict_val,real_val; EST_SuffStats x,y,xx,yy,xy,se,e; double cor,error; LISP vector,predict; for (vector=get_data_vector(data,description); vector != NIL; vector=get_data_vector(data,description)) { predict = wagon_vector_predict(tree,vector,description); predict_val = get_c_float(car(reverse(predict))); real_val = get_c_float(siod_nth(wgn_predictee,vector)); x += predict_val; y += real_val; error = predict_val-real_val; se += error*error; e += fabs(error); xx += predict_val*predict_val; yy += real_val*real_val; xy += predict_val*real_val; } cor = (xy.mean() - (x.mean()*y.mean()))/ (sqrt(xx.mean()-(x.mean()*x.mean())) * sqrt(yy.mean()-(y.mean()*y.mean()))); fprintf(output,";; RMSE %1.4f Correlation is %1.4f Mean (abs) Error %1.4f (%1.4f)\n", sqrt(se.mean()), cor, e.mean(), e.stddev()); } static void test_tree_class(EST_TokenStream &data, FILE *output, LISP tree, LISP description) { // Test tree against class data to get summary of results EST_StrStr_KVL pairs; EST_StrList lex; EST_String predict_class,real_class; LISP vector,w,predict; double H=0,Q=0,prob; (void)output; for (vector=get_data_vector(data,description); vector != NIL; vector=get_data_vector(data,description)) { predict = wagon_vector_predict(tree,vector,description); predict_class = get_c_string(car(reverse(predict))); real_class = get_c_string(siod_nth(wgn_predictee,vector)); prob = get_c_float(car(cdr(siod_assoc_str(real_class, predict)))); if (prob == 0) H += log(0.000001); else H += log(prob); Q ++; pairs.add_item(real_class,predict_class,1); } for (w=cdr(siod_nth(wgn_predictee,description)); w != NIL; w = cdr(w)) lex.append(get_c_string(car(w))); const EST_FMatrix &m = confusion(pairs,lex); print_confusion(m,pairs,lex); fprintf(stdout,";; entropy %g perplexity %g\n", (-1*(H/Q)),pow(2.0,(-1*(H/Q)))); } static void test_tree_vector(EST_TokenStream &data, FILE *output, LISP tree, LISP description) { // Test tree against class data to get summary of results // Note we are talking about predicting vectors (a *bunch* of // numbers, not just a single class here) EST_StrStr_KVL pairs; EST_StrList lex; EST_String predict_class,real_class; LISP vector,w,predict; double H=0,Q=0,prob; (void)output; for (vector=get_data_vector(data,description); vector != NIL; vector=get_data_vector(data,description)) { predict = wagon_vector_predict(tree,vector,description); predict_class = get_c_string(car(reverse(predict))); real_class = get_c_string(siod_nth(wgn_predictee,vector)); prob = get_c_float(car(cdr(siod_assoc_str(real_class, predict)))); if (prob == 0) H += log(0.000001); else H += log(prob); Q ++; pairs.add_item(real_class,predict_class,1); } for (w=cdr(siod_nth(wgn_predictee,description)); w != NIL; w = cdr(w)) lex.append(get_c_string(car(w))); const EST_FMatrix &m = confusion(pairs,lex); print_confusion(m,pairs,lex); fprintf(stdout,";; entropy %g perplexity %g\n", (-1*(H/Q)),pow(2.0,(-1*(H/Q)))); } static LISP wagon_vector_predict(LISP tree, LISP vector, LISP description) { // Using the LISP tree, vector and description, do standard prediction if (cdr(tree) == NIL) return car(tree); LISP value = find_feature_value(wgn_ques_feature(car(tree)), vector, description); if (wagon_ask_question(car(tree),value)) // Yes answer return wagon_vector_predict(car(cdr(tree)),vector,description); else // No answer return wagon_vector_predict(car(cdr(cdr(tree))),vector,description); } static LISP find_feature_value(const char *feature, LISP vector, LISP description) { LISP v,d; for (v=vector,d=description; v != NIL; v=cdr(v),d=cdr(d)) if (streq(feature,get_c_string(car(car(d))))) return car(v); cerr << "wagon_test: can't find feature \"" << feature << "\" in description" << endl; siod_error(); return NIL; } /** @name Testing trees Decision trees generated by wagon (or otherwise) can be applied to and tested against data sets using this program. This program requires a data set which is in the same format as wagon (and other programs) requires. It also needs a dataset description file naming the fields and given their type (see the wagon manual for a description for the actual format. wagon_test -data feats.data -desc feats.desc -tree feats.tree This will simply uses the tree against each sample in the data file and compare the predicted value with the actual value and produce a summary of the result. For categorial predictees a percentage correct and confusion matrix is generated. For continuous values the root mean squared error (RMSE) and correlation between the predicted values and the actual values is given. By default the predictee is the first field but may also be specified on the command line. The dataset may contain features which are not used by the tree. This program can also be used to generate output values for sampled data. In this case the sample data must still contain a "value" for the predictee even if it is dummy. The option -predict will output the new sample vector with the predicted value in place, and the option -predict_val option will just output the value. This program is specifically designed for testing purposes although it can also just be used for prediction. It is probably more efficient to use the Lisp function wagon or underlying C++ function wagon_predict(). */ //@} speech_tools/main/ols_main.cc0000644000076400007640000001724011465017155014726 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : January 1998 */ /*-----------------------------------------------------------------------*/ /* Ordinary least squares */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_Wagon.h" #include "EST_multistats.h" #include "EST_cmd_line.h" static void load_ols_data(EST_FMatrix &X, EST_FMatrix &Y, WDataSet &d); static int ols_main(int argc, char **argv); /** @name ols Train linear regression model @id ols-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { return ols_main(argc,argv); } static int ols_main(int argc, char **argv) { // Top level function loads in sample data and finds coefficients EST_Option al; EST_StrList files; EST_String ofile = "-"; WDataSet dataset,test_dataset; EST_FMatrix coeffs; EST_FMatrix X,Y,Xtest,Ytest; LISP ignores = NIL; parse_command_line (argc, argv, EST_String("[options]\n")+ "Summary: Linear Regression by ordinary least squares (defaults in {})\n"+ "-desc Field description file\n"+ "-data Datafile, one vector per line\n"+ "-test Datafile, for testing\n"+ "-robust Robust, may take longer\n"+ "-stepwise Order the features by contribution,\n"+ " implies robust.\n"+ "-swlimit {0.0}\n"+ " Percentage necessary improvement for stepwise\n"+ "-quiet No summary\n"+ "-o \n"+ "-output Output file for coefficients\n"+ "-ignore Filename or bracket list of fields to ignore\n", files, al); if (al.present("-output")) ofile = al.val("-output"); if (al.present("-o")) ofile = al.val("-o"); siod_init(); if (al.present("-ignore")) { EST_String ig = al.val("-ignore"); if (ig[0] == '(') ignores = read_from_string(ig); else ignores = vload(ig,1); } // Load in the data if (!al.present("-desc")) { cerr << "ols: no description file specified\n"; return -1; } else { dataset.load_description(al.val("-desc"),ignores); dataset.ignore_non_numbers(); } if (!al.present("-data")) { cerr << "ols: no data file specified\n"; return -1; } else wgn_load_dataset(dataset,al.val("-data")); if (al.present("-test")) { test_dataset.load_description(al.val("-desc"),ignores); test_dataset.ignore_non_numbers(); wgn_load_dataset(test_dataset,al.val("-test")); load_ols_data(Xtest,Ytest,test_dataset); } else // No test data specified so use training data load_ols_data(Xtest,Ytest,dataset); load_ols_data(X,Y,dataset); if (al.present("-stepwise")) { EST_StrList names; float swlimit = al.fval("-swlimit"); EST_IVector included; int i; names.append("Intercept"); for (i=1; i < dataset.width(); i++) names.append(dataset.feat_name(i)); included.resize(X.num_columns()); included[0] = TRUE; // always guarantee interceptor for (i=1; inext(),n++) { Y.a_no_check(n,0) = d(p)->get_flt_val(0); X.a_no_check(n,0) = 1; for (m=1; m < d.width(); m++) { if (d.ignore(m)) { X.a_no_check(n,m) = 0; } else X.a_no_check(n,m) = d(p)->get_flt_val(m); } } } speech_tools/main/ols_test_main.cc0000644000076400007640000001255211465017155015766 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : January 1998 */ /*-----------------------------------------------------------------------*/ /* A program for testing a OLS */ /* */ /*=======================================================================*/ #include #include #include #include #include "EST_Wagon.h" #include "EST_cutils.h" #include "EST_multistats.h" #include "EST_Token.h" #include "EST_cmd_line.h" static int ols_test_main(int argc, char **argv); static void load_ols_data(EST_FMatrix &X, EST_FMatrix &Y, WDataSet &d); /** @name ols_test Test linear regression model @id ols-test-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { ols_test_main(argc,argv); exit(0); return 0; } static int ols_test_main(int argc, char **argv) { // Top level function sets up data and creates a tree EST_Option al; EST_StrList files; EST_FMatrix X,Y,coeffs; WDataSet dataset; EST_String outfile; parse_command_line (argc, argv, EST_String("[options]\n")+ "ols_test \n"+ "program to test OLS on data\n"+ "-desc Field description file\n"+ "-data Datafile, one vector per line\n"+ "-coeffs File containing OLS coefficients\n"+ "-predict Predict for each vector returning value\n"+ "-o File to save output in\n", files, al); siod_init(); if (al.present("-desc")) { dataset.load_description(al.val("-desc"),NIL); } else { cerr << argv[0] << ": no description file specified" << endl; exit(-1); } if (coeffs.load(al.val("-coeffs")) != format_ok) { cerr << argv[0] << ": no coefficients file specified" << endl; exit(-1); } if (al.present("-data")) wgn_load_dataset(dataset,al.val("-data")); else { cerr << argv[0] << ": no data file specified" << endl; exit(-1); } if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; EST_FMatrix pred; float cor,rmse; load_ols_data(X,Y,dataset); ols_apply(X,coeffs,pred); if (ols_test(Y,pred,cor,rmse)) printf(";; RMSE %f Correlation is %f\n",rmse,cor); else printf(";; varation too small RMSE %f but no correlation\n",rmse); if (al.present("-o") || al.present("-predict")) pred.save(outfile); return 0; } static void load_ols_data(EST_FMatrix &X, EST_FMatrix &Y, WDataSet &d) { EST_Litem *p; int n,m; X.resize(d.length(),d.width()); Y.resize(d.length(),1); for (n=0,p=d.head(); p != 0; p=p->next(),n++) { Y(n,0) = d(p)->get_flt_val(0); X(n,0) = 1; for (m=1; m < d.width(); m++) X(n,m) = d(p)->get_flt_val(m); } } speech_tools/main/scfg_make_main.cc0000644000076400007640000002306511465017155016052 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* Build a stochastic context feee grammar with N non-terminals and */ /* M terminals specific as lists or numbers */ /* Probabilities are either even or random on rules and specified as */ /* probs or -log prob */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_SCFG.h" #include "siod.h" EST_String outfile = "-"; EST_String domain = "nlogp"; EST_String values = "equal"; static int scfg_make_main(int argc, char **argv); static void load_symbols(EST_StrList &syms,const EST_String &filename); static void make_symbols(EST_StrList &syms,int n,const EST_String &prefix); static LISP assign_probs(LISP rules, const EST_String &domain, const EST_String &values); static LISP make_all_rules(const EST_StrList &NonTerminals, const EST_StrList &Terminals); static void generate_probs(double *probs,int num); /** @name scfg_make Make the rules for a stochastic context free grammar @id scfg-make-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** Builds a stochastic context free grammar from a vocabulary of non-terminal and terminal symbols. An exhaustive set of all possible binary rules are generated with random (or equal) probabilities (or negative log probabilities). This program is designed for making grammars that can be trained using scfg_train. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { scfg_make_main(argc,argv); exit(0); return 0; } static int scfg_make_main(int argc, char **argv) { // Top level function generates a probabilistic grammar EST_Option al; EST_StrList files; EST_StrList NonTerminals, Terminals; LISP rules,r; FILE *fd; parse_command_line (argc, argv, EST_String("[options]\n")+ "Summary: Build a stochastic context free grammar\n"+ "-nonterms Number of nonterminals or file containing them\n"+ "-terms Number of terminals or file containing them\n"+ "-domain {nlogp}\n"+ " Values to be nlogp (negative log probabilities)\n"+ " or prob (probabilities)\n"+ "-values {equal}\n"+ " General initial scores on rules as equal or\n" " random\n"+ "-heap {500000}\n"+ " Set size of Lisp heap, only needed for large grammars\n"+ "-o File to save grammar (default stdout)\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; if (al.present("-domain")) { if (al.val("-domain") == "nlogp") domain = "nlogp"; else if (al.val("-domain") == "prob") domain = "prob"; else { cerr << "scfg_make: domain must be nlogp or prob" << endl; exit(1); } } if (al.present("-values")) { if (al.val("-values") == "equal") values = "equal"; else if (al.val("-values") == "random") values = "random"; else { cerr << "scfg_make: values must be equal or random" << endl; exit(1); } } if (al.present("-nonterms")) { if (al.val("-nonterms").matches(RXint)) make_symbols(NonTerminals,al.ival("-nonterms"),"NT"); else load_symbols(NonTerminals,al.val("-nonterms")); } else { cerr << "scfg_make: no nonterminals specified" << endl; exit(1); } if (al.present("-terms")) { if (al.val("-terms").matches(RXint)) make_symbols(Terminals,al.ival("-terms"),"T"); else load_symbols(Terminals,al.val("-terms")); } else { cerr << "scfg_make: no terminals specified" << endl; exit(1); } siod_init(al.ival("-heap")); rules = make_all_rules(NonTerminals,Terminals); rules = assign_probs(rules,domain,values); if (outfile == "-") fd = stdout; else { if ((fd=fopen(outfile,"w")) == NULL) { cerr << "scfg_make: failed to open file \"" << outfile << "\" for writing" << endl; exit(1); } } for (r=rules; r != NIL; r=cdr(r)) pprint_to_fd(fd,car(r)); if (fd != stdout) fclose(fd); return 0; } static LISP make_all_rules(const EST_StrList &NonTerminals, const EST_StrList &Terminals) { // Build all possibly rules (CNF) // NT -> NT NT and NT -> T EST_Litem *p,*q,*r; LISP rules = NIL; for (p=NonTerminals.head(); p != 0; p=p->next()) { int num_rules_nt = (NonTerminals.length()*NonTerminals.length())+ Terminals.length(); double *probs = new double[num_rules_nt]; generate_probs(probs,num_rules_nt); int i=0; for (q=NonTerminals.head(); q != 0; q=q->next()) for (r=NonTerminals.head(); r != 0; r=r->next(),i++) rules = cons(cons(flocons(probs[i]), cons(rintern(NonTerminals(p)), cons(rintern(NonTerminals(q)), cons(rintern(NonTerminals(r)),NIL)))), rules); for (q=Terminals.head(); q != 0; q=q->next(),i++) rules = cons(cons(flocons(probs[i]), cons(rintern(NonTerminals(p)), cons(rintern(Terminals(q)),NIL))), rules); delete [] probs; } return reverse(rules); } static void generate_probs(double *probs,int num) { // Generate probabilities int i; if (values == "equal") { double defp = 1.0/(float)num; for (i=0; i < num; i++) probs[i] = defp; } else if (values == "random") { // This isn't random but is somewhat arbitrary double sum = 0; for (i=0; i < num; i++) { probs[i] = (double)abs(rand())/(double)0x7fff; sum += probs[i]; } for (i=0; i < num; i++) { probs[i] /= sum; } } else { cerr << "scfg_make: unknown value for probability distribution" << endl; exit(1); } } static LISP assign_probs(LISP rules, const EST_String &domain, const EST_String &values) { // Modify probs (don't know how to do random probs yet) LISP r; (void)values; if (domain == "nlogp") for (r=rules; r != NIL; r = cdr(r)) if (get_c_float(car(car(r))) == 0) CAR(car(r)) = flocons(40); else CAR(car(r)) = flocons(-log(get_c_float(car(car(r))))); return rules; } static void make_symbols(EST_StrList &syms,int n,const EST_String &prefix) { // Generate n symbols with given prefix int i; int magnitude,t; for (magnitude=0,t=n; t > 0; t=t/10) magnitude++; char *name = walloc(char,prefix.length()+magnitude+1); char *skel = walloc(char,prefix.length()+5); sprintf(skel,"%s%%%02dd",(const char *)prefix,magnitude); for (i=0; i < n; i++) { sprintf(name,skel,i); syms.append(name); } wfree(name); wfree(skel); } static void load_symbols(EST_StrList &syms,const EST_String &filename) { // Load symbol list for file load_StrList(filename,syms); } speech_tools/main/scfg_train_main.cc0000644000076400007640000001406010127000720016225 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* Train a stochastic context free grammar with respect to a given */ /* corpus. */ /* */ /* Only the inside/outside algorithm (with bracketing) is supported */ /* */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST_cmd_line.h" #include "EST_SCFG.h" #include "siod.h" static EST_String outfile = "-"; static int scfg_train_main(int argc, char **argv); /** @name scfg_train Train the parameters of a stochastic context free grammar @id scfg-make-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** scfg_train takes a stochastic context free grammar (SCFG) and trains the probabilities with respect to a given bracket corpus using the inside-outside algorithm. This is basically an implementation of Pereira and Schabes 1992. Note using this program properly may require months of CPU time. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { scfg_train_main(argc,argv); exit(0); return 0; } static int scfg_train_main(int argc, char **argv) { // Top level function generates a probabilistic grammar EST_Option al; EST_StrList files; int spread; parse_command_line (argc, argv, EST_String("[options\n")+ "Summary: Train a stochastic context free grammar from a (bracketed) corpus\n"+ "-grammar Grammar file, one rule per line.\n"+ "-corpus Corpus file, one bracketed sentence per line.\n"+ "-method {inout}\n"+ " Method for training: inout.\n"+ "-passes {50}\n"+ " Number of training passes.\n"+ "-startpass {0}\n"+ " Starting at pass N.\n"+ "-spread Spread training data over N passes.\n"+ "-checkpoint Save grammar every N passes\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, needed for large corpora\n"+ "-o Output file for trained grammar.\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; siod_init(al.ival("-heap")); EST_SCFG_traintest grammar; if (al.present("-grammar")) { grammar.load(al.val("-grammar")); } else { cerr << "scfg_train: no grammar specified" << endl; exit(1); } if (al.present("-corpus")) { grammar.load_corpus(al.val("-corpus")); } else { cerr << "scfg_train: no corpus specified" << endl; exit(1); } if (al.present("-spread")) spread = al.ival("-spread"); else spread = 0; if (al.val("-method") == "inout") { int checkpoint = -1; if (al.present("-checkpoint")) checkpoint = al.ival("-checkpoint"); grammar.train_inout(al.ival("-passes"), al.ival("-startpass"), checkpoint,spread,outfile); } else { cerr << "scfg_train: unknown training method \"" << al.val("-method") << "\"" << endl; exit(1); } if (grammar.save(outfile) != write_ok) { cerr << "scfg_train: failed to write grammar to \"" << outfile << "\"" << endl; exit(1); } return 0; } speech_tools/main/scfg_test_main.cc0000644000076400007640000001216510127000720016073 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* Test a stochastic context free grammar with respect to a given */ /* corpus. */ /* */ /* Can test against a bracket corpus or simply parse it */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_SCFG.h" #include "siod.h" static EST_String outfile = "-"; static int scfg_test_main(int argc, char **argv); /** @name scfg_test Test the output of a parser @id scfg-make-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** This program applies a stochastic context free grammar to a given corpus and reports the parsing accuracy and cross bracketing accuracy of the grammar with respect to the grammar. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { scfg_test_main(argc,argv); exit(0); return 0; } static int scfg_test_main(int argc, char **argv) { // Top level function generates a probabilistic grammar EST_Option al; EST_StrList files; parse_command_line (argc, argv, EST_String("[options]\n")+ "Summary: Test a stochastic context free grammar against a corpus\n"+ "-grammar Grammar file, one rule per line.\n"+ "-corpus Single Corpus file, one bracketed sentence per line.\n"+ "-crossbrackets Measure cross bracket performance.\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, needed for large corpora\n"+ "-o Output file for parsed sentences.\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; siod_init(al.ival("-heap")); EST_SCFG_traintest grammar; if (al.present("-grammar")) { grammar.load(al.val("-grammar")); } else { cerr << "scfg_test: no grammar specified" << endl; exit(1); } if (al.present("-corpus")) { grammar.load_corpus(al.val("-corpus")); } else { cerr << "scfg_test: no corpus specified" << endl; exit(1); } // Test and summarise parsing of corpus if (al.present("-crossbrackets")) grammar.test_crossbrackets(); // parse and test brackets else grammar.test_corpus(); // only cross entropy return 0; } speech_tools/main/scfg_parse_main.cc0000644000076400007640000001357010127000720016227 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1997 */ /*-----------------------------------------------------------------------*/ /* Parse a list of sentences with a given stochastic context free */ /* grammar */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_SCFG.h" #include "EST_SCFG_Chart.h" #include "siod.h" static EST_String outfile = "-"; static int scfg_parse_main(int argc, char **argv); /** @name scfg_parse Parse text using a pre-trained stochastic context free grammar @id scfg-parse-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** This parses given text with a given stochastic context free grammar. Note this program is not designed as an arbitrary parser for unrestricted English. It simply parses the input non-terminals with the given grammar. If you want to English (or other language) parses consider using the festival script scfg_parse which does proper tokenization and part of speech tagging, before passing it to a SCFG. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { scfg_parse_main(argc,argv); exit(0); return 0; } static int scfg_parse_main(int argc, char **argv) { // Top level function generates a probabilistic grammar EST_Option al; EST_StrList files; EST_SCFG_Chart chart; LISP rules,s,parse; FILE *corpus,*output; int i; parse_command_line (argc, argv, EST_String("[options]\n")+ "Summary: Parse a corpus with a stochastic context free grammar\n"+ "-grammar Grammar file, one rule per line.\n"+ "-corpus Corpus file, one bracketed sentence per line.\n"+ "-brackets Output bracketing only.\n"+ "-o Output file for parsed sentences.\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; siod_init(); if (al.present("-grammar")) { rules = vload(al.val("-grammar"),1); gc_protect(&rules); } else { cerr << "scfg_parse: no grammar specified" << endl; exit(1); } if (al.present("-corpus")) { if ((corpus = fopen(al.val("-corpus"),"r")) == NULL) { cerr << "scfg_parse: can't open corpus file \"" << al.val("-corpus") << "\" for reading " << endl; exit(1); } } else { cerr << "scfg_parse: no corpus specified" << endl; exit(1); } if (al.present("-o")) { if ((output=fopen(al.val("-o"),"w")) == NULL) { cerr << "scfg_parse: can't open output file \"" << al.val("-o") << "\" for writing " << endl; exit(1); } } else output = stdout; gc_protect(&s); gc_protect(&parse); for (i=0; ((s=lreadf(corpus)) != get_eof_val()); i++) { parse = scfg_parse(s,rules); if (al.present("-brackets")) { LISP bparse = scfg_bracketing_only(parse); if (bparse == NIL) bparse = s; pprint_to_fd(output,bparse); } else pprint_to_fd(output,parse); if (i%100 == 99) user_gc(NIL); } if (output != stdout) fclose(output); gc_unprotect(&s); gc_unprotect(&parse); gc_unprotect(&rules); return 0; } speech_tools/main/wfst_build_main.cc0000644000076400007640000002371510127000720016257 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : November 1997 */ /*-----------------------------------------------------------------------*/ /* Build a WFST from some base: */ /* 1 a set of context dependent rewrite rules using the */ /* the algorithms from "An Efficient Compiler for Weighted Rewrite */ /* Rules", by Mehryar Mohri and Richard Sproat ACL 1996 */ /* and information from the techniques in Rithie el al. 1992 */ /* 2 A regular grammar (but can be written as a CFG as long as it */ /* contains no centre embedding */ /* 3 A regular expression */ /* 4 lts rules (but that doesn't work yet) */ /* */ /* or apply some operator on existing wfst(s): compose, concatenate, */ /* difference, union, */ /* */ /* Also allow determinizing and minimization as required */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_WFST.h" static int wfst_build_main(int argc, char **argv); /** @name wfst_build Build a weighted finite-state transducer @id wfst-build-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** Build and.or process weighted finite state transducers (WFSTs) form various input formats. This program accepts descriptions in the following formats and converts them to WFSTs regular expressions regular grammars Koskenniemi/Kay/Kaplan context restriction rules In addition various operations can be performed on two WFSTs compose: form new WFST feeding output of first WFSTs into second WFSTs. union: form new WFST accepting the language both WFSTs intersect: form new WFST accepting only the language common to both WFSTs concat: form new WFST accepting the language from the concatenation of all strings in the first WFST to all strings in the second. The newly formed WFSTs can be optionally determinized and minimzed. The option asis allows a single WFSTs to be loaded and determinized and/or minimized */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { wfst_build_main(argc,argv); exit(0); return 0; } static int wfst_build_main(int argc, char **argv) { // Top level function generates a WFST from rules EST_Option al; EST_StrList files; EST_String outfile; parse_command_line (argc, argv, EST_String("[option] [rulefile0] [rulefile1] ...\n")+ "Summary: Build a weighted finite state transducer from rules/wfsts\n"+ "-type {kk} Input rule type: kk, lts, rg, tl, compose, regex\n"+ " union, intersect, concat, asis\n"+ "-determinize Determinize WFST before saving it\n"+ "-detmin Determinize and minimize WFST before saving it\n"+ "-o Output file for saved WFST (default stdout)\n"+ "-otype {ascii}\n"+ " Output type, ascii or binary\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, needed for large rulesets\n"+ "-q Quiet mode, no summary generated\n", files, al); if (al.present("-o")) outfile = al.val("-o"); else outfile = "-"; siod_init(al.ival("-heap")); LISP ruleset; LISP inalpha, outalpha; EST_WFST *wfst = new EST_WFST; gc_protect(&ruleset); if (al.val("-type") == "kk") { ruleset = car(vload(files(files.head()),1)); kkcompile(ruleset,*wfst); } else if (al.val("-type") == "lts") { ruleset = car(vload(files(files.head()),1)); ltscompile(ruleset,*wfst); } else if (al.val("-type") == "rg") { ruleset = car(vload(files(files.head()),1)); rgcompile(ruleset,*wfst); } else if (al.val("-type") == "tl") { ruleset = car(vload(files(files.head()),1)); tlcompile(ruleset,*wfst); } else if (al.val("-type") == "asis") { if (wfst->load(files.nth(0)) != format_ok) exit(-1); } else if (al.val("-type") == "compose") { EST_WFST a,b; if (files.length() != 2) EST_error("compose requires two WFSTs to combine"); if (a.load(files.nth(0)) != format_ok) exit(-1); if (b.load(files.nth(1)) != format_ok) exit(-1); wfst->compose(a,b); } else if (al.val("-type") == "union") { EST_WFST a,b; if (files.length() != 2) EST_error("union requires two WFSTs to combine"); if (a.load(files.nth(0)) != format_ok) exit(-1); if (b.load(files.nth(1)) != format_ok) exit(-1); wfst->uunion(a,b); } else if (al.val("-type") == "intersect") { EST_WFST a,b; if (files.length() != 2) EST_error("intersect requires two WFSTs to combine"); if (a.load(files.nth(0)) != format_ok) exit(-1); if (b.load(files.nth(1)) != format_ok) exit(-1); wfst->intersection(a,b); } else if (al.val("-type") == "concat") { EST_WFST a,b; if (files.length() != 2) EST_error("concat requires two WFSTs to combine"); if (a.load(files.nth(0)) != format_ok) exit(-1); if (b.load(files.nth(1)) != format_ok) exit(-1); wfst->concat(a,b); } else if (al.val("-type") == "difference") { EST_WFST a,b; if (files.length() != 2) EST_error("difference requires two WFSTs to combine"); if (a.load(files.nth(0)) != format_ok) exit(-1); if (b.load(files.nth(1)) != format_ok) exit(-1); wfst->difference(a,b); } else if (al.val("-type") == "regex") { ruleset = car(vload(files(files.head()),1)); inalpha = siod_nth(0,ruleset); outalpha = siod_nth(1,ruleset); wfst->build_from_regex(inalpha,outalpha,car(cdr(cdr(ruleset)))); } else { cerr << "wfst_build: unknown rule type \"" << al.val("-type") << "\"" << endl; exit(-1); } if (al.present("-determinize")) { EST_WFST *dwfst = new EST_WFST; dwfst->determinize(*wfst); if (!al.present("-q")) { cout << "wfst_build summary: " << endl; cout << " non-deterministic wfst: " << wfst->summary() << endl; cout << " deterministic wfst: " << dwfst->summary() << endl; } delete wfst; wfst = dwfst; } else if (al.present("-detmin")) { if (!al.present("-q")) { cout << "wfst_build summary: " << endl; cout << " non-deterministic wfst: " << wfst->summary() << endl; } EST_WFST *dwfst = new EST_WFST; dwfst->determinize(*wfst); delete wfst; if (!al.present("-q")) cout << " deterministic wfst: " << dwfst->summary() << endl; EST_WFST *mwfst = new EST_WFST; mwfst->minimize(*dwfst); if (!al.present("-q")) cout << " minimized wfst: " << mwfst->summary() << endl; delete dwfst; wfst = mwfst; } else { if (!al.present("-q")) cout << "wfst_build: " << wfst->summary() << endl; } wfst->save(outfile,al.val("-otype")); delete wfst; gc_unprotect(&ruleset); return 0; } speech_tools/main/wfst_run_main.cc0000644000076400007640000001537111465017155016003 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1997 */ /*-----------------------------------------------------------------------*/ /* Run a WFST on some data, either as a recognizer or as a transducer */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_simplestats.h" #include "EST_WFST.h" static int wfst_run_main(int argc, char **argv); /** @name wfst_run Run a weighted finite-state transducer @id wfst-run-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** This program runs a WFST on some given data. It works in either recognize mode where both inputs and output are specified, but also in transduction mode where an input is transduced to the output. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { wfst_run_main(argc,argv); exit(0); return 0; } static int wfst_run_main(int argc, char **argv) { // recognize/transduce EST_Option al; EST_StrList files; EST_Litem *f; EST_String wfstfile; FILE *ofd; int r; EST_SuffStats R; float sumlogp=0,isumlogp; float count=0,icount; parse_command_line (argc, argv, EST_String("[WFSTFILE] [input file0] ... [-o output file]\n")+ "Summary: Recognize/transduce using a WFST on data\n"+ "-wfst The WFST to use\n"+ "-transduce Transduce input to output (default)\n"+ "-recog Recognize input consists of pairs\n"+ "-cumulate_into \n"+ " Cumulate transitions to give new weights\n"+ " save new WFST into ofile\n"+ "-itype char or token\n"+ "-quiet No extraneous messages\n"+ "-perplexity Calculate perplexity on given data set\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, needed for large wfsts\n"+ "-o Output file for transduced forms\n", files, al); if (al.present("-o")) { if ((ofd=fopen(al.val("-o"),"w")) == NULL) EST_error("can't open output file for writing \"%s\"", (const char *)al.val("-o")); } else ofd = stdout; if (al.present("-wfst")) wfstfile = al.val("-wfst"); else EST_error("no WFST specified"); siod_init(al.ival("-heap")); EST_WFST wfst; EST_TokenStream ts; if (wfst.load(wfstfile) != format_ok) EST_error("failed to read WFST from \"%s\"", (const char *)wfstfile); if (al.present("-cumulate_into")) wfst.start_cumulate(); for (f=files.head(); f != 0; f=f->next()) { if (files(f) == "-") ts.open(stdin,FALSE); else if (ts.open(files(f)) != 0) EST_error("failed to read WFST data file from \"%s\"", (const char *)files(f)); // Not the best way to input things but will do the the present while(!ts.eof()) { EST_StrList ostrs,istrs; do istrs.append(ts.get()); while((!ts.eof()) && (!ts.eoln())); if (al.present("-recog")) { if (al.present("-perplexity")) { r = recognize_for_perplexity(wfst,istrs, al.present("-quiet"), icount, isumlogp); if (r) { count += icount; sumlogp += isumlogp; } } else r = recognize(wfst,istrs,al.present("-quiet")); } else { r = transduce(wfst,istrs,ostrs); if (r) { cout << ostrs; cout << endl; } } R += r; if (!al.present("-quiet")) { if (r) cout << "OK." << endl; else cout << "failed." << endl; } } ts.close(); } if (al.present("-cumulate_into")) { wfst.stop_cumulate(); if (wfst.save(al.val("-cumulate_into")) != write_ok) EST_error("failed to write cumulated WFST to \"%s\"", (const char *)al.val("-cumulate_into")); } printf("total %d OK %f%% failed %f%%\n", (int)R.samples(),R.mean()*100,(1-R.mean())*100); if (al.present("-perplexity")) { printf("perplexity is %f\n", pow(float(2.0),float(-1.0 * (sumlogp/count)))); } if (ofd != stdout) fclose(ofd); if (R.mean() == 1) // true is *all* files were recognized return 0; else return -1; } speech_tools/main/wfst_train_main.cc0000644000076400007640000001172310127000720016271 0ustar awbawb/*************************************************************************/ /* */ /* Language Technologies Institute */ /* Carnegie Mellon University */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : October 1999 */ /*-----------------------------------------------------------------------*/ /* A training method for splitting states in a WFST from data */ /* */ /*=======================================================================*/ #include #include #include #include #include #include "EST.h" #include "EST_simplestats.h" #include "EST_WFST.h" LISP load_string_data(EST_WFST &wfst,EST_String &filename); void wfst_train(EST_WFST &wfst, LISP data); static int wfst_train_main(int argc, char **argv); /** @name wfst_train Train a weighted finite-state transducer @id wfst-train-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** This takes an existing WFST and data and splits states in an entropy reduce way to produced a new WFST that better models the given data. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { wfst_train_main(argc,argv); exit(0); return 0; } static int wfst_train_main(int argc, char **argv) { // Train a WFST from data building new states EST_Option al; EST_StrList files; EST_String wfstfile; FILE *ofd; parse_command_line (argc, argv, EST_String("[WFSTFILE] [input file0] ... [-o output file]\n")+ "Summary: Train a WFST on data\n"+ "-wfst The WFST to start from\n"+ "-data Sentences in the language recognised by WFST\n"+ "-o Output file for trained WFST\n"+ "-heap {210000}\n"+ " Set size of Lisp heap, needed for large rulesets\n", files, al); if (al.present("-o")) { if ((ofd=fopen(al.val("-o"),"w")) == NULL) EST_error("can't open output file for writing \"%s\"", (const char *)al.val("-o")); } else ofd = stdout; if (al.present("-wfst")) wfstfile = al.val("-wfst"); else EST_error("no WFST specified"); siod_init(al.ival("-heap")); siod_est_init(); EST_WFST wfst; LISP data; if (wfst.load(wfstfile) != format_ok) EST_error("failed to read WFST from \"%s\"", (const char *)wfstfile); data = load_string_data(wfst,al.val("-data")); wfst_train(wfst,data); if (wfst.save(al.val("-o")) != write_ok) EST_error("failed to write trained WFST to \"%s\"", (const char *)al.val("-o")); return 0; } speech_tools/main/siod_main.cc0000644000076400007640000001674211465017155015075 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1999 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Authors: Alan W Black */ /* Date : February 1999 */ /*-----------------------------------------------------------------------*/ /* A simple wrap-around for SIOD giving a basic command line SIOD */ /* interpreter */ /* */ /*=======================================================================*/ #include #include "EST_cmd_line.h" #include "EST_cutils.h" #include "EST_Pathname.h" #include "siod.h" static void siod_lisp_vars(void); static void siod_load_default_files(void); void siod_server_init(void); /** @name siod Scheme Interpreter @id siod-manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** siod is a command line interface to the Scheme In One Defun Scheme interpreter, as modified by CSTR for use in &theEST;. It is essentially &festival; without the speech synthesis code. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char **argv) { EST_Option al; EST_StrList files; EST_Litem *p; int stdin_input,interactive; int heap_size = DEFAULT_HEAP_SIZE; parse_command_line (argc, argv, EST_String("[options] [input files]\n")+ "Summary: Scheme in one Defun interpreter, file arguments are loaded\n"+ "-b Run in batch mode (no interaction)\n"+ "--batch Run in batch mode (no interaction)\n"+ "-i Run in interactive mode (default)\n"+ "--interactive\n"+ " Run in interactive mode (default)\n"+ "--pipe Run in pipe mode, reading commands from\n"+ " stdin, but no prompt or return values\n"+ " are printed (default if stdin not a tty)\n"+ "-heap {512000}\n"+ " Initial size of heap\n", files, al); if (al.present("-heap")) heap_size = al.ival("-heap"); // What to do about standard input and producing prompts etc. if ((al.present("-i")) || (al.present("--interactive"))) { interactive = TRUE; stdin_input = TRUE; } else if ((al.present("--pipe"))) { interactive=FALSE; stdin_input = TRUE; } else if ((al.present("-b")) || (al.present("--batch"))) { interactive=FALSE; stdin_input=FALSE; } else if (isatty(0)) // if stdin is a terminal assume interactive { interactive = TRUE; stdin_input = TRUE; } else // else assume pipe mode { interactive = FALSE; stdin_input = TRUE; } siod_init(heap_size); siod_est_init(); siod_server_init(); siod_fringe_init(); siod_prog_name = "siod"; siod_lisp_vars(); if (interactive) siod_load_default_files(); for (p=files.head(); p != 0; p=p->next()) { if (files(p) == "-") continue; else if (files(p).matches(make_regex("^(.*"))) { LISP l; l = read_from_string(files(p)); leval(l,NIL); } else vload(files(p),0); } if (stdin_input) { siod_print_welcome(EST_String::cat("Modified for ", est_name, " v", est_tools_version)); siod_repl(interactive); // expect input from stdin } return 0; } static void siod_load_default_files(void) { // Load in default files, init.scm. Users ~/.festivalrc // (or whatever you wish to call it) is loaded by init.scm EST_Pathname initfile; // Load library init first initfile = EST_Pathname(est_libdir).as_directory(); initfile += "siod"; initfile += "init.scm"; if (access((const char *)initfile,R_OK) == 0) vload(initfile,FALSE); else cerr << "Initialization file " << initfile << " not found" << endl; } static void siod_lisp_vars(void) { // set up specific lisp variables int major=0,minor=0,subminor=0; EST_Pathname lib; lib = EST_Pathname(est_libdir).as_directory(); lib += "siod"; siod_set_lval("libdir",strintern(lib)); if (!strcmp(est_ostype,"")) siod_set_lval("*ostype*",rintern(est_ostype)); siod_set_lval("est_version", strcons(strlen(est_tools_version),est_tools_version)); EST_String bits[4]; EST_Regex sep = "[^0-9]+"; int nbits = split(est_tools_version, bits, 4, sep); if (nbits>0) major = bits[0].Int(); if (nbits>1) minor = bits[1].Int(); if (nbits>2) subminor = bits[2].Int(); siod_set_lval("est_version_number", cons(flocons(major), cons(flocons(minor), cons(flocons(subminor),NIL)))); EST_Pathname etcdircommon = est_libdir; etcdircommon += "etc"; EST_Pathname etcdir = etcdircommon; etcdir += est_ostype; // Modify my PATH to include these directories siod_set_lval("etc-path",cons(rintern(etcdir), cons(rintern(etcdircommon),NIL))); EST_String path = getenv("PATH"); path += ":" + EST_String(etcdir) + ":" + EST_String(etcdircommon); putenv(wstrdup("PATH=" + path)); siod_set_lval("*modules*",NIL); return; } speech_tools/main/xml_parser_main.cc0000644000076400007640000002056510127000720016271 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Simple XML parsing mainline. */ /* */ /*************************************************************************/ #include #include #include #include "EST_error.h" #include "EST_cutils.h" #include "EST_cmd_line.h" #include "EST_cmd_line_options.h" #include "rxp/XML_Parser.h" struct Parse_State { int depth; }; class My_Parser_Class : public XML_Parser_Class { protected: virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); }; /** @name xml_parser @id xml_parser_manual * @toc */ //@{ /**@name Synopsis */ //@{ //@synopsis /** xml_parser is a simple program giving access to the RXP &xml; parser. It parses an input file and prints the results out in a simple indented format. It's main use is as a development tool, to check that files intended for input to an &xml; application, for instance &festival;, parse as you expect. */ //@} /**@name OPTIONS */ //@{ //@options //@} int main(int argc, char *argv[]) { My_Parser_Class pclass; EST_Option al; EST_StrList files; EST_String filename; Parse_State state; parse_command_line (argc, argv, EST_String("[file] [options]\n")+ "Summary: parse xml and output a tree.\n" "use \"-\" to make input file stdin\n" "-sysdir Look for unqualified system entities in this directory" "-h Options help\n", files, al); switch (files.length()) { case 0: filename="-"; break; case 1: filename=files.first(); break; default: EST_error("Expected only one filename"); break; } if (al.present("-sysdir")) pclass.register_id("^\\([^/]*\\)", al.sval("-sysdir") + "/\\1"); pclass.register_id("//CSTR//EST \\(.*\\)", EST_String::cat(est_libdir, "/\\1.dtd")); /* An individual parser runs over a single source. */ XML_Parser *parser = pclass.make_parser(filename, &state); /* Run the parser. */ parser->go(); exit(0); } static void print_attributes(XML_Attribute_List &attributes) { XML_Attribute_List::Entries them; for(them.begin(attributes); them ; them++) printf(" %s='%s'", (const char *)them->k, (const char *)them->v); } /* Now we define the callbacks. */ void My_Parser_Class::document_open(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; (void)print_attributes; Parse_State *state = (Parse_State *)data; state->depth=1; printf("%*s document %d\n", state->depth*4, ">", state->depth); } void My_Parser_Class::document_close(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s depth*4, ">", state->depth); } void My_Parser_Class::element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; state->depth++; printf("%*s %s %d", state->depth*4, ">", name, state->depth); print_attributes(attributes); printf("\n"); } void My_Parser_Class::element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; printf("%*s %s %d", state->depth*4, ":", name, state->depth); print_attributes(attributes); printf("\n"); } void My_Parser_Class::element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s %s %d\n", state->depth*4, "<", name, state->depth); state->depth--; } void My_Parser_Class::pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [pcdata[%s]] %d\n", state->depth*4, "", chars, state->depth); } void My_Parser_Class::cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [cdata[%s]] %d\n", state->depth*4, "", chars, state->depth); } void My_Parser_Class::processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [proc[%s]] %d\n", state->depth*4, "", instruction, state->depth); } void My_Parser_Class::error(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [error[%s]] %d\n", state->depth*4, "", get_error(p), state->depth); } speech_tools/main/Makefile0000644000076400007640000001116510273741027014254 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1994,1995,1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Author : Paul Taylor # # Date : June 1994 # #-------------------------------------------------------------------------# # Makefile for directory for stand alone programs # # # #=========================================================================# TOP=.. DIRNAME=main ALL_DIRS = # main_development BUILD_DIRS = H = TSRCS = BASESRCS = ch_lab_main.cc ch_track_main.cc ch_wave_main.cc \ na_play_main.cc na_record_main.cc \ sigfilter_main.cc sig2fv_main.cc spectgen_main.cc \ pda_main.cc pitchmark_main.cc \ ngram_test_main.cc ngram_build_main.cc \ tilt_synthesis_main.cc tilt_analysis_main.cc \ viterbi_main.cc dp_main.cc bcat_main.cc ch_utt_main.cc \ fringe_client_main.cc design_filter_main.cc align_main.cc MAINSRCS = $(BASESRCS) MODMAINSRCS = # Part of the distribution but only optionally compiled EXTRASRCS = wagon_main.cc wagon_test_main.cc \ ols_main.cc ols_test_main.cc \ scfg_make_main.cc scfg_train_main.cc scfg_test_main.cc \ scfg_parse_main.cc \ wfst_build_main.cc wfst_run_main.cc wfst_train_main.cc \ siod_main.cc \ xml_parser_main.cc CPPSRCS = $(MAINSRCS) $(TSRCS) $(EXTRASRCS) OBJS = $(CPPSRCS:.cc=.o) # Specific extra LIBS for specific programs na_play_LIBS = $(AUDIO_LIBS) $(AUDIO_EXTRA_LIBS) ch_lab_LIBS = $(FILEFORMATLIBS) ch_track_LIBS = $(FILEFORMATLIBS) MAIN_EXECS = $(MAINSRCS:_main.cc=) MOD_EXECS = $(notdir $(MODMAINSRCS:_main.cc=)) ALL_EXECS = $(MAIN_EXECS) $(MOD_EXECS) ALL = .make_execs .sub_directories SRCS = $(CPPSRCS) FILES= $(BASESRCS) $(EXTRASRCS) $(TSRCS) Makefile include $(TOP)/config/common_make_rules include $(TOP)/config/rules/bin_process.mak MAIN_O = $(MAIN_EXECS:%=%_main.o) $(MAIN_O) : %_main.o : %_main.cc $(CXX_COMMAND) -o $@ $< MOD_O = $(MOD_EXECS:=_main.o) $(MOD_O) : %_main.o : $(SRC_FOR_%) $(CXX_COMMAND) -o $@ -DESTLIBDIR=\"$(EST_HOME)/lib\" $($*_SRC) $(ALL_EXECS) : % : $(LIBDEPS) %_main.o $(strip $(LINK_COMMAND) -o $@ $@_main.o $(LIBS) $($(@:=_LIBS))) .make_execs : $(ALL_EXECS) speech_tools/scripts/Makefile0000644000076400007640000000653307262605664015034 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makfile for script directory ## ## --------------------------------------------------------------------- ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: June 1997 ## ## ## ########################################################################### TOP=.. DIRNAME=scripts SCRIPTS= example_to_doc++.prl resynth.sh pm.prl\ make_wagon_desc.sh raw_to_xgraph.prl \ est_examples.sh est_gdb.sh est_program.sh \ cxx_to_docbook.prl \ build_docbook_index.prl \ tex_to_images.prl FILES = Makefile shared_setup_sh shared_setup_prl shared_script $(SCRIPTS) INSTALL = ALL = $(SCRIPTS) include $(TOP)/config/common_make_rules include $(TOP)/config/rules/bin_process.mak speech_tools/scripts/shared_setup_sh0000644000076400007640000000035707262605664016475 0ustar awbawb # EST shared setup extend() { var="$1" extra="$2" eval "val=\$$var" if [ -n "$val" ] then val="$extra:$val" else val="$extra" fi eval "$var='$val'" eval "export $var" } extend LD_LIBRARY_PATH "__TOP__/lib:__LDPATH__" speech_tools/scripts/shared_setup_prl0000644000076400007640000000025107262605664016651 0ustar awbawb if (defined($ENV{LD_LIBRARY_PATH})) { $ENV{LD_LIBRARY_PATH} = "__TOP__/lib:__LDPATH__:$ENV{LD_LIBRARY_PATH}"; } else { $ENV{LD_LIBRARY_PATH} = "__TOP__/lib"; } speech_tools/scripts/shared_script0000644000076400007640000000042711332265737016141 0ustar awbawb#!/bin/sh # EST shared script extend() { var="$1" extra="$2" eval "val=\$$var" if [ -n "$val" ] then val="$extra:$val" else val="$extra" fi eval "$var='$val'" eval "export $var" } extend __LDVAR__ "__LIB__:__LDPATH__" exec __MAIN__/__PROGRAM__ "$@" exit 0 speech_tools/scripts/example_to_doc++.prl0000644000076400007640000000626410044502523017202 0ustar awbawb#!__PERL__ -w ########################################################################### ## ## ## Extract the doc++ comments and any grouped code from an example ## ## program. ## ## ## ## This is very hacky and probably doesn't generalise properly. ## ## I'll try and rewrite it as a full parse and recreate system at some ## ## point. ## ## ## ########################################################################### $comment_bottom = undef; $code = undef; $state='outside'; $filename = $ARGV[0]; open(F, $filename) || die "can't open $filename - $!"; $filename =~ m%([^/]+)$%; $name = $1; @decls=(); @pending_decls=(); while () { push (@pending_decls, "$1\n") if (m%^\s*(.*)//\s*decl\s*$%); if ($state eq 'outside' && m%^\s*/\*\*[^*]%) { $state = 'comment_top'; print $_; $comment_bottom = undef; $code = undef; next; } if ($state eq 'outside' && m%^\s*//\s*\@\{\s*code%i) { $state = 'code'; $code = []; next; } if ($state eq 'outside' && m%^\s*//\s*\@\{%) { dump_it(); $state = 'outside'; next; } if ($state eq 'outside' && m%^\s*//\s*\@\}%) { print $_; $state = 'outside'; next; } if ($state eq 'comment_top') { if (m%^\s*\*/%) { $comment_bottom = ''; $state = 'outside'; } elsif (m%^\s*\*\s*\@%) { $comment_bottom = $_; $state = 'comment_bottom'; } else { print $_; } next; } if ($state eq 'comment_bottom') { if (m%^\s*\*/%) { $state = 'outside'; } else { $comment_bottom .= $_; } next; } if ($state eq 'code') { if (m%^\s*//\@\}%) { $state = 'outside'; dump_it(); print "$_\n"; } else { $_ =~ s/\t/ /; push (@$code, $_); } next; } } dump_it() if defined($comment_bottom); sub dump_it { if ($code) { print " *\n"; print " * {\\it Example code from {\\tt $name}}\\\\\n"; print_code($code); push (@decls, @pending_decls); @pending_decls = (); } print $comment_bottom; print " */\n //\@{\n"; $comment_bottom=undef; $code=undef; } sub print_code { my($code) = @_; my ($comment) = 0; print " *\\begin{verbatim}"; print "--- + --- + --- + --- + --- + --- + --- + --- + ---\n"; if ($#decls >=0) { print @decls; print "\n// [...]\n"; } foreach $line (@$code) { if ($line =~ m%^\s*$%) { print "\n"; } elsif ($line =~ m%^(\s*//\s*)(.*)%) { my ($p, $t) = ($1, $2); if (!$comment) { $comment =1; print "\\end{verbatim} "; } print "#$p#{\\bf $t}\\\\\n"; } else { if ($comment) { $comment = 0; print "\\begin{verbatim}"; } if ($line =~ m%^(.*)//\s*decl\s*$%) { $line = "$1\n"; } print $line; } } print "--- + --- + --- + --- + --- + --- + --- + --- + --- "; print "\\end{verbatim}\n"; } speech_tools/scripts/resynth.sh0000755000076400007640000001064707262605664015430 0ustar awbawb#!/bin/sh -eu ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard caley (rjc@cstr.ed.ac.uk) ## ## Date: June 1997 ## ## --------------------------------------------------------------------- ## ## Script to resynthesise a waveform, for example to impose a new ## ## intonation contour. Requires pitchmarks for the waveform. ## ## ## ########################################################################### useage() { cat <=0) { if ($ARGV[0] eq "-f") { $forcelpc=1; shift @ARGV; } elsif ($ARGV[0] eq "-i") { $invert=1; shift @ARGV; } elsif ($ARGV[0] eq "-d") { $debug=1; shift @ARGV; } else { last; } } if ($#ARGV != 1) { useage(); exit(1); } $name=$ARGV[0]; $pmfile=$ARGV[1]; $name =~ m%([^/.]*)(\..*)?%; $root = $1; run("ch_wave $name -o $root.raw -otype raw"); open(W, "$root.raw") || die "can't open $ARGV[0]"; if ( $forcelpc || ! -f "${root}_res.raw") { run("lpc_analysis $name -o ${root}_slpc.esps -otype esps -r ${root}_res.nist -rtype nist -shift 0.005 -length 0.005 -window rectangle"); run("ch_wave ${root}_res.nist -o ${root}_res.raw -otype raw"); } open(R, "${root}_res.raw") || die "can't open ${root}_res.raw"; open(PM, ">$pmfile") || die "can't write $root.pm"; if ($debug) { open(RMS, ">${root}_rrms.ascii") || die "can't write ${root}_rrms.ascii"; open(P, ">${root}_peak.ascii") || die "can't write ${root}_peak.ascii"; } print "reading\n"; while(1) { $n=sysread(W, $buf, 2000)/2; push(@samps, unpack("s$n", $buf)); last if $n < 1000; } if ($invert) { print "inverting\n"; for($i=0; $i<= $#samps; $i++) { $samps[$i] = - $samps[$i]; } } while(1) { $n=sysread(R, $buf, 2000)/2; push(@resid, unpack("s$n", $buf)); last if $n < 1000; } print STDERR $#resid+1, " samples\n"; print "calculating\n"; for($i=0; $i <= $#samps; $i+=16) { $rsum = 0; $sum = 0; $max = 0; $zeroc = 0; $n = 0; for($j=$i-20; $j < $i+20; $j++) { next if $j < 0 || $j >= $#samps; $max = $samps[$j] if $samps[$j] > $max; $zeroc++ if $j > 0 && $samps[$j] * $samps[$j+1] < 0; $sum += $samps[$j] * $samps[$j]; $n++; next if $j < 0 || $j >= $#resid; $rsum += $resid[$j] * $resid[$j]; } push(@max, $max); push(@rms, sqrt($sum/$n)); push(@rrms, sqrt($rsum/$n)); push(@zeroc, $zeroc); print RMS $rrms[$#rrms] * 10, "\n" if $debug; } if ($debug) { close(RMS); run("ch_track ${root}_rrms.ascii -o ${root}_rrms.esps -otype esps -s 0.001"); unlink "${root}_rrms.ascii"; print "residual RMS track in ${root}_rrms.esps\n"; } print "finding\n"; for($i=0; $i <= $#rms; $i++) { if ($i>1 && $i < $#rms && $rrms[$i-1] < $rrms[$i] && $rrms[$i] > $rrms[$i+1] && $zeroc[$i] < 15 && $rms[$i] > 500) { push(@peaks, 2000); } else { push(@peaks, 0); } } print "picking\n"; unshift(@pm, 0); for($i=0; $i <= $#peaks; $i++) { print P "$peaks[$i]\n" if $debug; if ($peaks[$i] > 0) { $pm = find_peak(\@samps, ($i-1)*16, ($i+2)*16); push(@pm, $pm); } } push(@pm, $#samps); if ($debug) { close(P); run("ch_track ${root}_peak.ascii -o ${root}_peak.esps -otype esps -s 0.001"); unlink "${root}_peak.ascii"; print "potential peaks in ${root}_peak.esps\n"; } print "output\n"; $last_pm=0; for($i=1; $i <= $#pm; $i++) { next if $pm[$i] - $last_pm < 50; if ($pm[$i] - $last_pm > 250) { $extra = ($pm[$i] - $last_pm) % 100; $num = int(($pm[$i] - $last_pm) / 100); $chunk = 160+$extra/$num; for($j=$last_pm+$chunk; $j < $pm[$i] - 50; $j += $chunk) { print PM ($j)/16.0, "\n"; } } print PM $pm[$i]/16.0, "\n"; $last_pm = $pm[$i]; } sub find_peak { my ($samps, $from, $to) = @_; my ($center) = ($to+$from)/2; my ($peak) = $from; my ($pwval) = $$samps[$peak]*(1-abs($from-$center)/32); my ($i); for($i=$from; $i < $to; $i++) { my ($wval) = $$samps[$i]*(1-abs($from-$center)/32); if ($wval > $pwval) { $peak = $i; $pwval = $wval; } } $peak; } sub run { my ($command) = @_; print "\ndoing:\n $command\n\n"; system $command; } speech_tools/scripts/make_wagon_desc.sh0000755000076400007640000000604110205715331017013 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996,1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # # Make (a guess at the) wagon description file from a data file # and a list of field names # # Usage: make_desc DATAFILE FIELDSFILE DESCFILE # if [ $# != 3 ] then echo "Usage: make_desc DATAFILE FIELDSFILE DESCFILE" exit 1 fi rm -f $3 echo "(" >$3 fnum=1 for i in `cat $2` do echo "(" $i >> $3 awk '{n=$'$fnum' if (n ~ /,/) printf("\"%s\"\n",n) else if (n ~ /'"'"'/) printf("\"%s\"\n",n) else if (n ~ /"/) printf("\"\\%s\"\n",n) else printf("%s\n",n)}' $1 | sort -u | fold -s >> $3 echo ")" >>$3 fnum=`expr $fnum + 1` done echo ")" >>$3 exit 0 speech_tools/scripts/raw_to_xgraph.prl0000644000076400007640000000704407262616577016762 0ustar awbawb#!__PERL__ -w ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # /*@name raw_to_xgraph # * # * A simple script to convert raw sample data to something # * xgraph can plot. # * # * @author Richard Caley # * @version $Id: raw_to_xgraph.prl,v 1.2 2001/04/04 13:11:27 awb Exp $ # */ sub useage { print <=0) { if ($ARGV[0] =~ /-+h(elp)?/) { useage(); exit(0); } elsif ($ARGV[0] =~ /-+s(ample)?-?r?(ate)?/) { shift @ARGV; $sample_rate = $ARGV[0]; shift @ARGV; } else { last; } } if ($#ARGV>=0) { open(INPUT, $ARGV[0]) || die "can't open '$ARGV[0]' - $!"; $stream = INPUT; } if ($#ARGV >= 0) { useage(); exit(1); } binmode $stream; $c=0; while(sysread($stream, $buf, 256)) { foreach $i (unpack("s*", $buf)) { print "",($c++ + 0.0)/$sample_rate, " ", $i, "\n"; } } if ($stream eq INPUT) { close(INPUT); } exit(0); speech_tools/scripts/est_examples.sh0000755000076400007640000001032207262605664016413 0ustar awbawb#! /bin/sh -eu ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # # # Author: Richard caley (rjc@cstr.ed.ac.uk) # # --------------------------------------------------------------------- # # Simple script which runs a shell for the user with some environment # # set up so they can be sure to be able to do the example commands from # # the documentation. # # # ########################################################################### useage() { cat < Makefile.new cp Makefile Makefile.old cp Makefile.new Makefile } add_executable() { exec_name="$1" main="$2" shift 2 ensure_entry_for "$exec_name" } #__SHARED_SETUP__ UNDERLINE="sed -e '{p;s/[^ ]/=/g;}'" while [ $# -gt 0 ] do case "$1" in -h* | '-?' ) useage 0;; * ) break;; esac done if [ $# -gt 1 ] then useage 1 fi exec_name="$1" shift main="$exec_name.cc" if [ -f Makefile ] then check_makefile else create_empty_makefile fi if [ -f "$main" ] then check_mainline "$main" else create_mainline "$main" fi if [ -n "${*-}" ] then add_executable "$exec_name" "$main" "$@" else add_executable "$exec_name" "$main" fi exit 0 speech_tools/scripts/cxx_to_docbook.prl0000644000076400007640000002730210045556421017101 0ustar awbawb#!__PERL__ -w $rcsId=' $Id: cxx_to_docbook.prl,v 1.3 2004/05/04 00:00:17 awb Exp $ '; ########################################################################### ## ## ## Extract the doc++ comments and any grouped code from an example ## ## program. ## ## ## ## This is very hacky and probably doesn't generalise properly. ## ## I'll try and rewrite it as a full parse and recreate system at some ## ## point. ## ## ## ########################################################################### sub useage { print < chapter. -a Appendix rather than chapter if relevant. -t TITLE Title of the resulting text. -special \@NAME BEFORE COMM AFTER If we see //\@NAME, run COMMAND and include the output at this point. -special PATTERN BEFORE COMM AFTER If we see PATTERN, run COMMAND and include the output at this point. END } #__SHARED_SETUP__ $level=0; $title=undef; $chapter='chapter'; %patterns = (); while ($#ARGV>=0) { if ($ARGV[0] =~ /^-+t/) { shift @ARGV; $title = shift @ARGV; } elsif ($ARGV[0] =~ /^-+special/) { shift @ARGV; my ($pat, $comm); $pat = shift @ARGV; $before = shift @ARGV; $comm = shift @ARGV; $after = shift @ARGV; $patterns{$pat} = [ $before, $comm, $after ]; } elsif ($ARGV[0] =~ /^-+s/) { shift @ARGV; $level = shift @ARGV; } elsif ($ARGV[0] =~ /^-+a/) { shift @ARGV; $chapter = 'appendix'; } elsif ($ARGV[0] =~ /^-+h/) { useage(); exit(0); } else { last; } } if ($#ARGV != 0) { useage(); exit(1); } $filename = shift @ARGV; $special_pattern=build_pattern(\%patterns); print STDERR "SP $special_pattern\n"; open(F, $filename) || die "can't open $filename - $!"; $filename =~ m%([^/]+)$%; # $name = $1; $state='outside'; $top = $current = new Chunk "top"; set $top 'title', $title if defined($title); $count_blahs=0; while () { if ($state eq 'outside' && m%\s*/\*\*\s*((.?).*)% && $2 ne '*') { my ($rest) = $1; my ($new) = new Chunk "comment"; add $current $new; $current=$new; $state='comment'; add_comment_line($new, $rest); } elsif ($state eq 'comment' && m%\s*(.*)\*/\s*$%) { add_comment_line($current, $1) if $1 ne ''; $current = parent $current; $state='outside'; } elsif ($state eq 'comment') { /^\s*\**(.*)$/; add_comment_line($current, $1) if $1 ne ''; } elsif ($state eq 'outside' && m%\s*//\@\{*\s*code%) { my ($rest) = $1; my ($new) = new Chunk "code"; add $current $new; $current=$new; $state='code'; } elsif ($state eq 'code' && m%\s*//\@\}\s*code%) { $current = parent $current; $state='outside'; } elsif ($state eq 'code' && m%\s*//\@\s*([a-z]+)\s+(.*)%) { set $current 'example', $2 if $1 eq 'example'; set $current 'title', $2 if $1 eq 'title'; } elsif ($state eq 'code') { chop; add $current $_; } elsif ($state eq 'outside' && m%\s*//\@\{\s*$%) { my ($rest) = $1; my ($new) = new Chunk "group"; add $current $new; $current=$new; set $new 'title', 'Unnamed Group ' . ++$count_blahs; $state='outside'; } elsif ($state eq 'outside' && m%\s*//\@\}\s*$%) { $current = parent $current; die "//\@} outside any group" if !defined($current); $state='outside'; } elsif ($state eq 'outside' && $special_pattern && m/$special_pattern/) { my ($match) = $1; my ($before, $command, $after); foreach $p (keys(%patterns)) { if ($match =~ /^$p$/) { ($before, $command, $after)=@{$patterns{$p}}; print STDERR "DO '$match' '$p' '$command'\n"; last; } } if (defined($command)) { my ($new) = new Chunk "command"; set $new 'before', $before; set $new 'command', $command; set $new 'after', $after; add $current $new; } } elsif ($state eq 'outside' && m!^\s*//\s*\@\s*(\S*)!) { my ($tag) = $1; my ($before, $command, $after) = @{$patterns{"\@$tag"}}; if (defined($command)) { print STDERR "DO '$tag' '$command'\n"; my ($new) = new Chunk "command"; set $new 'before', $before; set $new 'command', $command; set $new 'after', $after; add $current $new; } else { print STDERR "UNKNOWN '$tag'\n"; } } } massage($top); print_docbook(STDOUT, $top, $level); exit(0); sub massage { my ($chunk) = @_; my ($bits) = get $chunk 'bits'; if (ref($chunk) && ((type $chunk) eq 'group' || (type $chunk) eq 'top' ) && $#$bits == 0 && ref($$bits[0]) && (($$bits[0]->type()) eq 'group'|| ($$bits[0]->type()) eq 'group1') ) { print STDERR "collapse {@{[%$chunk]}} // {@{[%{$$bits[0]}]}}\n"; foreach $k (keys(%{$$bits[0]})) { print STDERR " $k ${$$bits[0]}{$k}\n"; ${$chunk}{$k} = ${$$bits[0]}{$k} if defined (${$$bits[0]}{$k}) && ${$$bits[0]}{$k} && $k ne 'type'; } print STDERR "gives {@{[%$chunk]}}\n"; massage($top); return; } elsif ((type $chunk) eq 'code') { while ($#$bits >= 0 && $$bits[0] eq '') { shift(@{$bits}); } while ($#$bits >= 0 && $$bits[$#$bits] eq '') { pop(@{$bits}); } } else { my ($i); for($i=0; $i <= $#$bits;$i++) { my ($bit) = $$bits[$i]; if ($i+1 <= $#$bits) { my ($next) = $$bits[$i+1]; if (ref($bit) && (type $bit) eq 'comment' && ref($next) && (type $next) eq 'group') { print STDERR "combine {@{[%$bit]}} // {@{[%$next]}}\n"; set $next 'title', (title $bit); set $bit 'title', undef; set $next 'toc', (get $bit 'toc'); set $bit 'toc', undef; set $next 'id', (get $bit 'id'); set $bit 'id', undef; add_first $next $bit; splice(@$bits, $i, 1, ()); $bit= $next; set $bit 'type', 'group1'; massage($top); return; } } massage($bit) if ref($bit); } } } sub print_docbook { my ($s, $chunk, $level) = @_; print STDERR "P $chunk\n"; unless (ref($chunk)) { print $s " "x$level, "$chunk\n"; return; } my ($type) = type $chunk; my ($title) = get $chunk 'title'; my ($id) = get $chunk 'id'; if ($type eq 'top') { print_level_tag($s, $level, $id); print $s "\t$title\n\n" if defined($title); print $s " "x$level, " \n" if defined(get $chunk 'toc'); foreach $bit (@{get $chunk 'bits'}) { print_docbook($s, $bit, $level+1); } print_level_tag($s, $level, "/"); } elsif ($type eq 'command') { my ($before) = get $chunk 'before'; my ($command) = get $chunk 'command'; my ($after) = get $chunk 'after'; print STDERR "COMMAND $command\n"; $|=1; print ""; print $s " "x$level, " \n"; print $s " "x$level, " $before\n" if $before ne ''; system($command); print $s " "x$level, " $after\n" if $after ne ''; print $s " "x$level, " \n"; } elsif ($type eq 'group' || $type eq 'group1') { print_level_tag($s, $level, $id); print $s " "x$level, " $title\n" if defined($title); print $s " "x$level, " \n" if defined(get $chunk 'toc'); foreach $bit (@{get $chunk 'bits'}) { print_docbook($s, $bit, $level+1); } print_level_tag($s, $level, "/"); } elsif ($type eq 'comment') { if (defined($title)) { print $s " "x$level, "\n"; print $s " "x$level, " $title\n"; } print $s " "x$level, "\n"; foreach $line (@{get $chunk 'bits'}) { print $s $line, "\n"; } print $s " "x$level, "\n"; my ($refs) = get $chunk 'refs'; if ($#$refs >=0) { print $s " "x$level, " \n"; print $s " "x$level, " See also\n"; print $s " "x$level, " \n"; foreach $ref (@$refs) { print $s " "x$level, " $ref\n"; } print $s " "x$level, " \n"; print $s " "x$level, " \n"; } if (defined($title)) { print $s " "x$level, "\n"; } } elsif ($type eq 'code') { my ($exampleid) = get $chunk 'example'; if (defined($exampleid)) { print $s " "x$level, "\n"; if (defined($title)) { print $s " "x$level, " $title\n"; } else { print $s " "x$level, " Example $exampleid\n"; } } print $s " "x$level, ""; my ($first) = 1; foreach $line (@{get $chunk 'bits'}) { print "\n" unless $first; local ($_) = $line; s/&/&/g; s//>/g; s%//\s*(.*)$%// $1%; print $s $_; $first=0; } print $s " "x$level, "\n"; if (defined($exampleid)) { print $s " "x$level, "\n"; } } } sub print_level_tag { my ($s, $l, $end) = @_; if(defined($end)) { if ($end eq '/') { $id=''; } else { $id=" id='$end'"; $end=''; } } else { $id=$end=''; } my ($what) = $l==0?$chapter:"sect$l"; print $s " "x$l, "<$end$what$id>\n"; } sub add_comment_line { my ($chunk, $line) = @_; if ($line =~ /^\s*\@\s*([a-z]+)(\s+(.*))?/) { my ($op, $arg) = ($1, $3); print STDERR "OP=$op ARG=$arg\n"; if ($op eq 'name' || $op eq 'title') { set $chunk 'title', $arg; } elsif ($op eq 'see') { add $chunk 'refs', $arg; } elsif ($op eq 'id') { set $chunk 'id', id_munge($arg); } elsif ($op eq 'toc') { if (defined($arg)) { set $chunk 'toc', $arg; } else { set $chunk 'toc', 1; } } } else { add $chunk $line; } } sub build_pattern { my ($patterns) = @_; my (@alts) = grep ($_ !~ /^\@/, keys(%$patterns)); return @alts?"(" . join("|", @alts) . ")":''; } sub id_munge { my ($id) = @_; $id =~ s/[^-A-Za-z0-9]+/-/g; return $id; } package Chunk; sub new { my ($class, $type) = @_; my ($self) = { bits => [], refs=> [], decls => [], type => $type}; return bless $self, $class; } sub add { my ($self, $what, $new) = @_; if (!defined($new)) { $new=$what; $$new{parent} = $self if ref($new) eq 'Chunk'; push (@{$$self{bits}}, $new); } else { push (@{$$self{$what}}, $new); } } sub add_first { my ($self, $what, $new) = @_; if (!defined($new)) { $new=$what; $$new{parent} = $self if ref($new) eq 'Chunk'; unshift (@{$$self{bits}}, $new); } else { unshift (@{$$self{$what}}, $new); } } sub last_bit { my ($self) = @_; return ${$$self{bits}}[$#{$$self{bits}}] if $#{$$self{bits}} >=0; return undef; } sub drop_last_bit { my ($self) = @_; pop(@{$$self{bits}}); } sub last_bit_type { my ($self, $type) = @_; return $$self{type} eq $type; } sub set { my ($self, $key, $val) = @_; $$self{$key} = $val; } sub get { my ($self, $key) = @_; return $$self{$key}; } sub parent { my ($self) = @_; return $$self{parent}; } sub type { my ($self) = @_; return $$self{type}; } sub title { my ($self) = @_; return $$self{title}; } speech_tools/scripts/build_docbook_index.prl0000644000076400007640000001064107262616577020101 0ustar awbawb#!__PERL__ $rcsId=' $Id: build_docbook_index.prl,v 1.2 2001/04/04 13:11:27 awb Exp $ '; =head1 build_html_index [-v] =over 4 =item Created by Richard Caley, Sun Feb 14 1999 =item Last Modification $Date: 2001/04/04 13:11:27 $ by $Author: awb $ =item Locked by $Locker: $ =back =cut sub useage { print <=0) { if ($ARGV[0] eq '-v') { $verbose++; shift @ARGV; } elsif ($ARGV[0] eq '-t') { shift @ARGV; $title=shift @ARGV; } elsif ($ARGV[0] eq '-m') { shift @ARGV; $mode=shift @ARGV; } elsif ($ARGV[0] eq '-h') { useage(); exit 0; } else { last; } } if ($#ARGV != 1) { useage(); exit(1); } if (!defined(&{"print_tree_as_$mode"})) { useage(); exit(1); } $datafile= shift @ARGV; $indexfile= shift @ARGV; open(DATA, $datafile) || die "can't open $datafile - $!"; open(INDEX, ">$indexfile") || die "can't create $indexfile - $!"; @entries=(); while() { if (/^INDEXTERM\s+(.*)/) { $current = {}; $$current{INDEXTERM}=$1; } elsif (/^\/INDEXTERM/) { push(@entries, $current); } elsif (/^([a-z]+)\s+(.*)/i) { $$current{lc $1}=$2; } } close(DATA); @entries = sort entry_order @entries; $tree=build_tree(\@entries); &{"print_tree_as_$mode"}($tree, INDEX); close(INDEX); exit 0; sub entry_order { my ($o) = lc $$a{primary} cmp lc $$b{primary}; $o = (lc $$a{secondary} cmp lc $$b{secondary}) if $o ==0; $o = (lc $$a{tertiary} cmp lc $$b{tertiary}) if $o ==0; $o = (lc $$a{id} cmp lc $$b{id}) if $o ==0; return $o; } sub build_tree { my ($entries) = @_; my ($root) = []; foreach $e (@$entries) { if ($#$root<0 || $$e{primary} ne $root->[$#$root][0]) { push (@$root, [ $$e{primary}, []]); } my ($p) = $root->[$#$root][1]; if ($#$p<0 || $$e{secondary} ne $p->[$#$p][0]) { push (@$p, [ $$e{secondary}, []]); } my ($s) = $p->[$#$p][1]; if ($#$s<0 || $$e{tertiary} ne $s->[$#$s][0]) { push (@$s, [ $$e{tertiary}, []]); } my ($t) = $s->[$#$s][1]; push(@$t, $e); } return $root; } sub print_tree_as_debug { my ($root) = @_; print "[\n"; foreach $p (@$root) { print $$p[0], "\n"; print " [\n"; foreach $s (@{$$p[1]}) { print " ", $$s[0], "\n"; print " [\n"; foreach $t (@{$$s[1]}) { print " ", $$t[0], "\n"; print " {"; foreach $e (@{$$t[1]}) { print " $$e{id}"; } print "}\n"; } print " ]\n"; } print " ]\n"; } print "]\n"; } sub print_tree_as_html { my ($root, $s) = @_; my ($div) = ''; print $s "\n"; print $s "$title\n" if $title; foreach $p (@$root) { my ($pname) = $$p[0]; my ($initial) = lc substr($pname, 0, 1); if ($initial ne $div) { print $s "" if $div; print $s " $initial \n"; $div=$initial; } print $s " \n"; print_node($s, $p, " ", "primary", "secondary", "tertiary"); print $s " \n"; } print $s "\n" if $div; print $s "\n"; } sub print_node { my ($s, $node, $ind, $which, @rest) = @_; my ($name) = $$node[0]; my ($bits) = $$node[1]; my ($i)=0; my (@links) = (); unless (ref($bits->[0]) eq 'ARRAY' && $bits->[0]->[0]) { $i++; @links = @{get_links($bits)}; } print_ie($s, $ind, $which, \@links, $name); if ($#rest >=0) { my ($next) = shift @rest; for(; $i <= $#$bits; $i++) { print_node($s, $$bits[$i], $ind." ", $next, @rest); } } } sub print_ie { my ($s, $ind, $which, $links, $name) = @_; my ($c) =1; my ($lab) = $name; print $s "$ind<${which}ie>"; if ($#$links >=0 ) { foreach $e (@$links) { print $s "$lab "; $c++; $lab = "ref $c"; } } else { print $s "$lab"; } print $s "\n"; } sub get_links { my ($node) = @_; while (ref($$node[0]) eq 'ARRAY') { $node = $node->[0]->[1]; } return $node; } sub setup { } speech_tools/scripts/tex_to_images.prl0000644000076400007640000001526507262616577016751 0ustar awbawb#!__PERL__ -w ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # /*@name tex_to_images # * # * Converts maths (one formula per line) into gifs. # * # * @author Richard Caley # * @version $Id: tex_to_images.prl,v 1.2 2001/04/04 13:11:27 awb Exp $ # */ sub useage { print <=0) { if ($ARGV[0] =~ /-+[h?](elp)?/) { useage(0); } elsif ($ARGV[0] =~ /-+o(utput)?/) { shift @ARGV; $out_pattern = $ARGV[0]; shift @ARGV; } elsif ($ARGV[0] =~ /-+d(ir)?/) { shift @ARGV; $dir = $ARGV[0]; shift @ARGV; } elsif ($ARGV[0] =~ /-+s(cale)?/) { shift @ARGV; $scale = $ARGV[0]; shift @ARGV; } elsif ($ARGV[0] =~ /-+u(pscale)?/) { shift @ARGV; $over = $ARGV[0]; shift @ARGV; } elsif ($ARGV[0] =~ /-+f(ormat)?/) { shift @ARGV; $format= $ARGV[0]; shift @ARGV; } else { last; } } $scale *= $over; $post_scale = 1.0/$over; if ($format eq 'gif') { $conv = 'ppmtogif -i -t 1,1,1'; } elsif ($format eq 'ppm') { $conv = 'cat'; } elsif ($format eq 'jpg') { $conv = 'cjpeg'; } elsif ($format eq 'eps') { $conv = ''; } else { useage(1); } $tmp="mti$$"; $tex="$tmp.tex"; $dvi="$tmp.dvi"; $dvipage="${tmp}_page.dvi"; $ps="$tmp.ps"; $ppm="${tmp}.ppm"; $psres=int(72*$scale+0.5); open(TEX, ">$tex") || die "can't create $tex - $!"; print TEX <) { chomp; if (/^\@Name\s+([A-Za-z0-9_.\/]+)\s*$/) { $out=$1; } elsif (/^\@Start\s*$/) { $form=''; } elsif (/^\@End\s*$/) { got_formula($dir, $out, $form); $form=undef; $out=$out_pattern; } elsif (defined($form)) { $form .= "\n"; $form .= $_; } else { got_formula($dir, $out, $_); $out=$out_pattern; } } print TEX < $out[$i]\n"; execute("dviselect -i $dvi -o $dvipage $in", 1); execute("dvips -E -o$ps $dvipage"); ($x, $y, $w, $h) = get_bb($ps); $w = int($w*$scale+0.5); $h = int($h*$scale+0.5); if ($conv) { execute("echo '$x neg $y neg translate'|gs -sDEVICE=ppmraw -sOutputFile=$ppm " . ($w>0?"-g${w}x$h":"") . " -r$psres -dNOPAUSE -dBATCH - $ps"); execute("cat $ppm|pnmscale $post_scale |ppmnorm| ppmquant 255 | $conv > $out[$i]"); } else { rename($ps, $out[$i]); } } while (defined($f=<$tmp*>)) { unlink($f); } exit(0); sub execute { my ($command, $ignore) = @_; print "DOING $command\n"; (system($command)>>8)==0 || defined($ignore) || die "FAILED - $!"; } sub get_bb { my ($ps) = @_; local (*PS); open(PS, $ps) || die " can't read $ps - $!"; while () { if (/%%BoundingBox:\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)/) { close(PS); return ($1, $2, $3-$1, $4-$2); } } close(PS); return (0,0,0,0); } sub got_formula { my ($dir, $out, $form) = @_; $n++; $out =~ s/NNN/$n/; $out =~ s/FFF/$format/; $out = "$dir/$out" if ($dir); $form =~ s/&#([0-9]+);/chr(hex($1))/ge; push(@out, $out); push(@formula, $form); if ($out =~ m!^(.*)/([^/]*)$!) { system "mkdir", "-p", $1; } print TEX "\\[ $form \\] \\pagebreak \n\n"; } speech_tools/testsuite/Makefile0000644000076400007640000001062011363311340015344 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Testsuite Directory Makefile ## ########################################################################### # To quickly rebuld the tests: # make # To run the tests # make test # To run a specific test # make hash_module_build_and_test # or just # make hash_module_rebuild # make hash_module_test TOP=.. DIRNAME=testsuite ALL_DIRS = correct # Place to find test data DATA=$(EST_HOME)/lib/example_data VC_LOCAL_DEFINES = /DDATAC=$(EST_HOME)/lib # tests performed by shell scripts TEST_SCRIPTS = ch_wave ch_track viterbi wagon tilt lpc # tests performed by C++ programs #TEST_MODULES = string list hash pathname named_enum track_map token TEST_MODULES = string hash pathname \ track token complex list kvl \ handle named_enum deq ling feature TMP_OMITTED = track_map error # These don't compile on some systems (due to compiler problems) OTHERS=sigpr_example.cc sigpr_regression.cc # define any arguments for the scripts or programs here (for instance # if they need to be passed the name of a data file). hash_regression_args = $(DATA)/alice TEST_OPTIMISE=3 # by default we just rebuild the C++ tests to catch typos etc. ALL = build_test_programs ALL_EXECS = $(TEST_MODULES:%=%_example) $(TEST_MODULES:%=%_regression) LOCAL_CLEAN = tmp include $(TOP)/config/test_make_rules ifdef INCLUDE_RXP ALL = foobar $(shell echo help>/dev/tty) endif MODULES = $(TEST_MODULES:%=%_example) foo: : $(ALL_EXECS) OPTIMISE=$(TEST_OPTIMISE) LOCAL_DEFINES +=-DTVECTOR_BOUNDS_CHECKING override WARN=1 just_test test: $(MAKE) --no-print-directory $@s 2>&1 | tee .test_out @if egrep 'FAILED|INCORRECT|Warning' .test_out >/dev/null;\ then \ echo "-------------" ;\ echo "Tests failed:" ;\ egrep 'FAILED|INCORRECT|Warning' .test_out ;\ else \ echo "-------------" ;\ echo "Test OK" ;\ fi tmpdir: rm -rf tmp mkdir tmp tests: tmpdir test_modules test_scripts just_tests: tmpdir just_test_modules just_test_scripts build_test_programs: $(TEST_PROGRAMS) @: speech_tools/testsuite/xml_example.cc0000644000076400007640000001637710127000721016540 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Simple XML processing example. */ /* */ /*************************************************************************/ #include #include #include #include "rxp/XML_Parser.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif /**@name XML_Parser:example * * Simple XML processing example. * * @see XML_Parser */ //@{ /** Any data needed during processing has to be passed around, * here we just keep track of the nesting depth. */ struct Parse_State { int depth; }; /** Define a subset of XML_Parser_Class which which has callbacks for * what we want to do. In a real application we might not need * to define them all. */ class My_Parser_Class : public XML_Parser_Class { protected: virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data); virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes); virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name); virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars); virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction); virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data); }; int main(void) { My_Parser_Class pclass; Parse_State state; /** Rewriting rules for public and system IDs can be * used to locate local copies etc. */ pclass.register_id("//EST//Test/\\(.*\\)", DATA "/\\1.dtd"); /** An individual parser runs over a single source. */ XML_Parser *parser = pclass.make_parser(DATA "/eg.xml", &state); /** Run the parser. */ parser->go(); exit(0); } /** Now we define the callbacks. */ void My_Parser_Class::document_open(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; state->depth=1; printf("%*s document %d\n", state->depth*4, ">", state->depth); } void My_Parser_Class::document_close(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s depth*4, ">", state->depth); } void My_Parser_Class::element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; state->depth++; printf("%*s %s %d\n", state->depth*4, ">", name, state->depth); } void My_Parser_Class::element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) { (void)c; (void)p; (void)attributes; Parse_State *state = (Parse_State *)data; printf("%*s %s %d\n", state->depth*4, ":", name, state->depth); } void My_Parser_Class::element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s %s %d\n", state->depth*4, "<", name, state->depth); state->depth--; } void My_Parser_Class::pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [pcdata[%s]] %d\n", state->depth*4, "", chars, state->depth); } void My_Parser_Class::cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [cdata[%s]] %d\n", state->depth*4, "", chars, state->depth); } void My_Parser_Class::processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [proc[%s]] %d\n", state->depth*4, "", instruction, state->depth); } void My_Parser_Class::error(XML_Parser_Class &c, XML_Parser &p, void *data) { (void)c; (void)p; Parse_State *state = (Parse_State *)data; printf("%*s [error[%s]] %d\n", state->depth*4, "", get_error(p), state->depth); } //@} speech_tools/testsuite/string_example.cc0000644000076400007640000001063710127000721017237 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley */ /* Date: May 1997 */ /************************************************************************/ #include "EST_String.h" #include #include int main() { EST_String example("hello world"); EST_Regex exclamation("\\(wow\\|yey\\|lo\\)[^a-z]"); cout << example << "\n"; cout.flush(); printf("stdio version %s\n", (const char *)example); fflush(stdout); if (example.contains(exclamation)) cout << "\nYes, it contains a match for " << exclamation << "\n"; // find a match and extract the thing in brackets int start_br[EST_Regex_max_subexpressions]; int end_br[EST_Regex_max_subexpressions]; int len; if (example.search(exclamation, len, 0, start_br, end_br)>=0) { // whole match is item 0 cout << "match was '" << example.at(start_br[0], end_br[0]- start_br[0]) << "'\n"; // first set of brackets. cout << " word was '" << example.at(start_br[1], end_br[1]- start_br[1]) << "'\n"; } cout << "\n"; // substituting into a string based on a regular expression EST_String source("http://www.cstr.ed.ac.uk/speech_tools"); EST_Regex url_re("\\([a-z]*\\)://\\([^/]*\\)\\(.*\\)"); EST_String target("protocol=\\1 host=\\2 path=\\3 dummy=\\6"); cout << "processing '" < #include #include #include "EST_THash.h" #include "EST_String.h" // a very boring thing to do to a pair, see map below static void look_at(EST_String &s, int &l) { (void)s; (void)l; cout << "."; } int main(void) { // Map from strings to numbers, hashed by default method. EST_TStringHash lengths(100); lengths.add_item("fred", 4); lengths.add_item("bill", 4); lengths.add_item("harry", 5); const EST_TStringHash const_lengths = lengths; // Map from ints to floats. Note, the other way around is alomst // certainly a mistake. EST_THash logs(100); logs.add_item(12, log(12.0)); logs.add_item(34, log(34.0)); cout << "length of `fred' = " << lengths.val("fred") << "\n"; cout << "log of 34' = " << logs.val(34) << "\n"; // remove items with the remove_item() method. logs.remove_item(34); cout << "now don't know log of 34' = " << logs.val(34) << "\n"; // the second argument to val can be used to // ask whether the result was actually found. Useful // when the dummy value returned for an unknown key is // actually a valid value for the application. int found; float val = logs.val(123, found); cout << "log of 123"; if (found) cout << " = " << val; else cout << " not found"; cout << "\n"; // dump puts out a human readable version of the table for debugging lengths.dump(cout); // map calls a function on each pair, in this case just prints one dot per // pair (see definition of look_at earlier). lengths.map(look_at); cout << "\n"; // We can step through the table with an iterator. EST_THash::Entries them; for(them.begin(const_lengths); them; them++) { cout << them->k << " " << them->v << " "; } cout << "\n"; EST_THash::RwEntries rwthem; for(rwthem.begin(lengths); rwthem; rwthem++) { rwthem->v *= 3; cout << rwthem->k << " " << rwthem->v << " "; } cout << "\n"; return 0; } template <> int EST_THash::Dummy_Key = 0; template <> float EST_THash::Dummy_Value = 0.0; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_THash(int,float) #endif speech_tools/testsuite/pathname_example.cc0000644000076400007640000001027211465017156017541 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 29 1997 */ /************************************************************************/ /* */ /* Test of EST_Pathname class. */ /* */ /************************************************************************/ #include #include "EST_Pathname.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif int main(void) { // a relative pathname EST_Pathname f; f= "baz/ptooie"; // can be used as a file or a directory cout << "file f = " << f.as_file() << "\n"; cout << "dir f = " << f.as_directory() << "\n"; // and absolute one EST_Pathname d; d = "/foo/bar/"; // we can combine paths as expected cout << "combine = " << d+f << "\n"; cout << "combine = " << f+f << "\n"; // and can build up paths from components EST_Pathname built(EST_Pathname::construct(d,f,"test")); cout << " build = " << built << "\n"; cout << " filename = " << built.filename() << "\n"; cout << "extension = " << built.extension() << "\n"; cout << " basename = " << built.basename() << "\n"; cout << "basename1 = " << built.basename(1) << "\n"; EST_Pathname data(DATA); // getting the contents of a directory... EST_TList contents(data.entries()); sort(contents); cout << "listing " << data.filename() << ":\n"; EST_Litem *item; for(item=contents.head(); item; item=item->next()) if (EST_Pathname(contents(item)).is_filename()) cout << " " << contents(item) << "\n"; cout << "done.\n"; return (0); } speech_tools/testsuite/track_example.cc0000644000076400007640000004247010127000721017035 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri May 9 1997 */ /* ------------------------------------------------------------------- */ /* Example of declaration and use of tracks. */ /* */ /*************************************************************************/ #include #include #include "EST_Track.h" #include "EST_Wave.h" #include "EST_sigpr.h" #include "EST_error.h" /** @name EST_Track class example code * @toc * Some examples of track manipulations. * */ //@{ int main(void) { int i, j; /* This program is designed as an example not as something to run so for testing purpose it simply exists */ exit(0); /**@name Initialising and Resizing a Track The constructor functions can be used to create a track with zero frames and channels or a track with a specified number of frames and channels */ //@{ //@{ code EST_Track tr; // default track declaration EST_Track tra(500, 10); // allocate track with 500 frames and 10 channels //@} code /** tracks can be resized at any time: */ //@{ code tr.resize(10, 500); // resize track to have 10 frames and 500 channels tr.resize(500, 10); // resize track to have 500 frames and 10 channels //@} code /** by default, resizing preserves values in the track. This may involve copying some information, so if the existing values are not needed, a flag can be set which usually results in quicker resizing */ //@{ code tr.resize(250, 5, 0); // throw away any existing values //@} code /** If only the number of channels or the number of frames needs to be changed, this an be done with the following functions: */ //@{ code tr.set_num_channels(10); // makes 10 channels, keeps same no of frames tr.set_num_frames(400); // makes 400 frames, keeps same no of channels //@} code /** The preserve flag works in the same way with these functions */ //@} /** @name Simple Access Values in the track can be accessed and set by frame number and channel number. The following resizes a track to have 500 frames and 10 channels and fills every position with -5. */ //@{ //@{ code tr.resize(500, 10); for (i = 0; i < tr.num_frames(); ++i) for (j = 0; j < tr.num_channels(); ++j) tr.a(i, j) = -5.0; //@} code /** A well formed track will have a time value, specified in seconds, for every frame. The time array can be filled directly: */ //@{ code for (i = 0; i < tr.num_frames(); ++i) tr.t(i) = (float) i * 0.01; //@} code /** which fills the time array with values 0.01, 0.02, 0.03... 5.0. However, A shortcut function is provided for fixed frame spacing: */ //@{ code tr.fill_time(0.1); //@} code /** which performs the same operation as above. Frames do not have to be evenly spaced, in pitch synchronous processing the time array holds the time position of each pitch period. In such cases each position in the time array must obviously be set individually. Some representations have undefined values during certain sections of the track, for example the F0 value during unvoiced speech. The break/value array can be used to specify if a frame has an undefined value.. If a frame in this array is 1, that means the amplitude is defined at that point. If 0, the amplitude is undefined. By default, every frame has a value. Breaks (undefined values) can be set by set_break() . The following sets every frame from 50 to 99 as a break: */ //@{ code for (i = 50; i < 100; ++i) tr.set_break(i); //@} code /** frames can be turned back to values as follows: */ //@{ code for (i = 50; i < 100; ++i) tr.set_value(i); //@} code /** It is up to individual functions to decide how to interpret breaks. A frame's status can be checked as follows: */ //@{ code if (tr.val(60)) cout << "Frame 60 is not a break\n"; if (tr.track_break(60)) cout << "Frame 60 is a break\n"; //@} code //@} /** @name Naming Channels @id tr-example-naming-channels While channels can be accessed by their index, it is often useful to give them names and refer to them by those names. The set_channel_name() function sets the name of a single channel: */ //@{ //@{ code tr.set_channel_name("F0", 0); tr.set_channel_name("energy", 1); //@} code /** An alternative is to use a predefined set of channel names stored in a map.A track map is simply a String List strings which describe a channel name configuration. The resize function can take this and resize the number of channels to the number of channels indicated in the map, and give each channel its name from the map. For example: */ //@{ code EST_StrList map; map.append("F0"); map.append("energy"); tr.resize(500, map); // this makes a 2 channel track and sets the names to F0 and energy //@} code /** A convention is used for channels which comprise components of a multi-dimensional analysis such as cepstra. In such cases the channels are named TYPE_I. The last coefficient is always names TYPE_N regardless of the number of coefficients. This is very useful in extracting a set of related channels without needing to know the order of the analysis. For example, a track map might look like: */ //@{ code map.clear(); map.append("F0"); map.append("energy"); map.append("cep_0"); map.append("cep_1"); map.append("cep_2"); map.append("cep_3"); map.append("cep_4"); map.append("cep_5"); map.append("cep_6"); map.append("cep_7"); map.append("cep_N"); tr.resize(500, map); // makes a 11 channel track and sets the names //@} code /** This obviously gets unwieldy quite quickly, so the mapping mechanism provides a short hand for multi-dimensional data. */ //@{ code map.clear(); map.append("F0"); map.append("energy"); map.append("$cep-0+8"); tr.resize(500, map); // does exactly as above //@} code /** Here $ indicates the special status, "cep" the name of the coefficients, "-0" that the first is number 0 and "+8" that there are 8 more to follow. */ //@} /** @name Access single frames or single channels. @id tr-example-frames-and-channels Often functions perform their operations on only a single frame or channel, and the track class provides a general mechanism for doing this. Single frames or channels can be accessed as EST_FVectors: Given a track with 500 frames and 10 channels, the 50th frame can be accessed as: */ //@{ //@{ code EST_FVector tmp_frame; tr.frame(tmp_frame, 50); //@} code /** now tmp_frame is 10 element vector, which is a window into tr: any changes to the contents of tmp_frame will change tr. tmp_frame cannot be resized. (This operation can be thought in standard C terms as tmp_frame being a pointer to the 5th frame of tr). Likewise with channels: */ //@{ code EST_FVector tmp_channel; tr.channel(tmp_channel, 5); //@} code /** Again, tmp_channel is 500 element vector, which is a window into tr: any changes to the contents of tmp_channel will change tr. tmp_channel cannot be resized. Channels can also be extracted by name: */ //@{ code tr.channel(tmp_channel, "energy"); //@} code /** not all the channels need be put into the temporary frame. Imagine we have a track with a F0 channel,a energy channel and 10 cepstrum channels. The following makes a frame from the 50th frame, which only includes the cepstral information in channels 2 through 11 */ //@{ code tr.frame(tmp_frame, 50, 2, 9); //@} code /** Likewise, the 5th channel with only the last 100 frames can be set up as: */ //@{ code tr.channel(tmp_channel, 5, 400, 100); //@} code //@} /** @name Access multiple frames or channels. @id tr-example-sub-tracks In addition to extracting single frames and channels, multiple frame and channel portions can be extracted in a similar way. In the following example, we make a sub-track sub, which points to the entire cepstrum portion of a track (channels 2 through 11) */ //@{ //@{ code EST_Track sub; tr.sub_track(sub, 0, EST_ALL, 2, 9); //@} code /** sub behaves exactly like a normal track in every way, except that it cannot be resized. Its contents behave like a point into the designated portion of tr, so changing sub will change tr. The first argument is the sub track. The second states the start frame and the total number of frames required. EST_ALL is a special constant that specifies that all the frames are required here. The next argument is the start channel number (remember channels are numbered from 0), and the last argument is the total number of channels required. This facility is particularly useful for using standard signal processing functions efficiently. For example, the melcep in the signal processing library takes a waveform and produces a mel-scale cepstrum. It determines the order of the cepstral analysis by the number of channels in the track it is given, which has already been allocated to have the correct number of frames and channels. The following will process the waveform sig, produce a 10th order mel cepstrum and place the output in sub. (For explanation of the other options see melcep */ //@{ code EST_Wave sig; melcep(sig, sub, 1.0, 20, 22); //@} code /** because we have madesub a window into tr, the melcep function writes its output into the correct location, i.e. channels 2-11 of tr. If it were no for the sub_track facility, either a separate track of the right size would be passed into melcep and then it would be copied into tr (wasteful), or else tr would be passed in and other arguments would have to specify which channels should be written to (messy). Sub-tracks can also be set using channel names. The following example does exactly as above, but is referenced by the name of the first channel required and the number of channels to follow: */ //@{ code tr.sub_track(sub, 0, EST_ALL, "cep_0", "cep_N"); //@} code /** and this specifies the end by a string also: */ //@{ code tr.sub_track(sub, 0, EST_ALL, "cep_0", "cep_N"); //@} code /** sub_tracks can be any set of continuous frames and channels. For example if a word started at frame 43 and ended and frame 86, the following would set a sub track to that portion: */ //@{ code tr.sub_track(sub, 47, 39, "cep_0", "cep_N"); //@} code /** We can step through the frames of a Track using a standard * iterator. The frames are returned as one-frame sub-tracks. */ //@{ code EST_Track::Entries frames; // print out the time of every 50th track cout << "Times:"; for (frames.begin(tr); frames; ++frames) { const EST_Track &frame = *frames; if (frames.n() % 50 ==0) cout << " " << frames.n() << "[" << frame.t() << "]"; } cout << "\n"; //@} code /** The channel, frame and sub_track functions are most commonly used to write into a track using a convenient sub-portion. Sometimes, however a simple copy is required whose contents can be written without affecting the original. The copy_cub_track function does this */ //@{ code EST_Track tr_copy; // tr.copy_sub_track(tr_copy, 47, 39, "cep_0", "cep_N"); //@} code /** Individual frames and channels can be copied out into pre-allocated float * arrays as follows: */ //@{ code float *channel_buf, *frame_buf; channel_buf = new float[tr.num_frames()]; frame_buf = new float[tr.num_channels()]; tr.copy_channel_out(5, channel_buf); // copy channel 5 into channel_buf tr.copy_frame_out(43, frame_buf); // copy frame 4 into frame_buf //@} code /** Individual frames and channels can be copied into the track from float * arrays as follows: */ //@{ code tr.copy_channel_in(5, channel_buf); // copy channel_buf into channel 5 tr.copy_frame_in(43, frame_buf); // copy frame_buf into frame 4 //@} code //@} /** @name Auxiliary Channels Auxiliary channels are used for storing frame information other than amplitude coefficients, for example voicing decisions and points of interest in the track. Auxiliary channels always have the same number of frames as the amplitude channels. They are resized by assigning names to the channels that need to be created: */ //@{ //@{ code EST_StrList aux_names; aux_names.append("voicing"); aux_names.append("join_points"); aux_names.append("cost"); tr.resize_aux(aux_names); //@} code /** The following fills in these three channels with some values: */ //@{ code for (i = 0; i < 500; ++i) { tr.aux(i, "voicing") = i; tr.aux(i, "join_points") = EST_String("stuff"); tr.aux(i, "cost") = 0.111; } //@} code //@} /** @name File I/O Tracks in various formats can be saved and loaded: Save as a HTK file: */ //@{ //@{ code if (tr.save("tmp/track.htk", "htk") != write_ok) EST_error("can't save htk file\n"); //@} code /** Save as a EST file: */ //@{ code if (tr.save("tmp/track.est", "est") != write_ok) EST_error("can't save est file\n"); //@} code /** Save as an ascii file: */ //@{ code if (tr.save("tmp/track.ascii", "ascii") != write_ok) EST_error("can't save ascii file\n"); //@} code /** The file type is automatically determined from the file's header during loading: */ //@{ code EST_Track tr2; if (tr2.load("tmp/track.htk") != read_ok) EST_error("can't reload htk\n"); //@} code /** If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function: */ //@{ code if (tr.load("tmp/track.ascii", 0.01) != read_ok) EST_error("can't reload ascii file\n"); //@} code //@} exit(0); } //@} speech_tools/testsuite/token_example.cc0000644000076400007640000001073110127000721017044 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Alan W Black */ /* Date: May 1997 */ /************************************************************************/ /* */ /* Example of reading a file using the tokenizer */ /* */ /************************************************************************/ #include #include "EST_Token.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif int main(int argc,char **argv) { // Simple program to read all the tokens in the named file // a print a summary of them EST_TokenStream ts; int tokens, alices, quotes; EST_Token t; EST_String fname; if (argc > 2) { cerr << argv[0] << ": wrong number of arguments\n"; exit(-1); } else if (argc == 2) fname = argv[1]; else fname = DATA "/alice"; if (ts.open(fname) == -1) { cerr << argv[0] << ": can't open input file \"" << argv[1] << "\"\n"; exit(-1); } // Control of whitespace characters, single character symbols, // pre and post punctuation may be set here. // The defaults are standard whitespace, and nothing for the rest // (this is like awk's basic tokenizer). For language analysis // you'll probably want to modify the punctuation // \173 is '{', it is inserted by number because of a doc++ problem. ts.set_PrePunctuationSymbols("\173[(\"'"); ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols); // Note you may set quotes so quoted tokens are read as single // tokens (a la C) for (tokens=quotes=alices=0; !ts.eof(); tokens++) { t = ts.get(); if (t == "Alice") alices++; if (t.prepunctuation().contains("\"")) quotes++; } printf("Input file contains:\n"); printf(" %5d tokens\n",tokens); printf(" %5d tokens preceeded by double quotes\n",quotes); printf(" %5d occurrences of Alice\n",alices); return 0; } speech_tools/testsuite/complex_example.cc0000644000076400007640000000737210127000721017402 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Paul Taylor */ /* Date: December 1997 */ /************************************************************************/ #include "EST_Complex.h" #include #include int main() { EST_Complex z1(4.0, 3.0); cout << z1 << "\n"; cout << "real " << z1.real() << endl; cout << "imag " << z1.imag() << endl; cout << "mag " << z1.mag() << endl; cout << "ang in radians" << z1.ang() << endl; cout << "ang in degress " << z1.ang(1) << endl; EST_Complex z2(2.0, 2.0); EST_Complex z3; float x = 10.0; cout << "z1 = " << z1 << endl; cout << "z2 = " << z2 << endl; z3 = z1 + z2; cout << "z1 + z2 = " << z3 << endl; z3 = z1 + x; cout << "z3 + 10= " << z3 << endl; z3 = x + z1; cout << "10 + z3 = " << z3 << endl; z3 = z1 - z2; cout << "z1 - z2 = " << z3 << endl; z3 = z1 - x; cout << "z1 - 10= " << z3 << endl; z3 = x - z1; cout << "10 - z1 = " << z3 << endl; z3 = z1 * z2; cout << "z1 * z2 = " << z3 << endl; z3 = z1 * x; cout << "z1 * 10= " << z3 << endl; z3 = x * z1; cout << "10 * z1 = " << z3 << endl; z3 = z1 / z2; cout << "z1 / z2 = " << z3 << endl; z3 = z1 / x; cout << "z1 / 10= " << z3 << endl; z3 = x / z1; cout << "10 / z1 = " << z3 << endl; return 0; } speech_tools/testsuite/list_example.cc0000644000076400007640000002267711465017156016733 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Example of list class use. */ /* */ /*************************************************************************/ #include #include #include "EST_bool.h" #include "EST_TList.h" #include "EST_String.h" #include "EST_util_class.h" #include "EST_types.h" bool second_char_gt(const EST_UItem *uv1, const EST_UItem *uv2); /**@name EST_TList:example * * some stuff about lists * * @see EST_TList * @see EST_TKVL * @see EST_Option */ //@{ int main(void) { EST_String strings[] = {"quail", "wood pigeon", "eagle", "emu", "rook" }; //decl // There are a number of predefined list types for EST_TList. // EST_StrList is EST_TList. EST_StrList slist; // decl EST_Litem *p; //decl /**@name Inserting items into a list There is no easy way to initialise a list so we'll just set it from the strings array. */ //@{ code // append adds items on to the end of a list for (unsigned int i1 = 0; i1 < sizeof(strings) /sizeof(strings[0]); i1++) slist.append(strings[i1]); // add item to start of list slist.prepend("dove"); // find pointer to "eagle", add "hawk" before it, and then add sparrow // after "hawk" for (p = slist.head(); p != 0; p = p->next()) if (slist(p) == "eagle") { p = slist.insert_before(p,"hawk"); p = slist.insert_after(p,"sparrow"); } //@} code /**@name Iteration over a list A dummy pointer of type \Ref{EST_Litem} is used to iterate through a list. This acts somewhat like the index in an array in that it is used to access an item, in the list but does not contain a value itself. Iteration is usually done in a for loop. Initialisation involves setting the pointer to the head() function. Increments are done by the next() function. At the end of the list, the pointer will be set to null, and this can be used to check for the end. Items in the list are accessed by passing the pointer is as the argument to the function operator(), as in the following example. */ //@{ code cout << "[ List Accessed by LItem\n"; // print out contents of array. for (p = slist.head(); p != 0; p = p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; // items can also be accessed by their position in the list by using the // nth() function. The length() function returns the number of items // in a list. cout << "\n[ List Accessed by integer index\n"; for (int i2 = 0; i2 < slist.length(); ++i2) cout << " " << slist.nth(i2) << "\n"; cout << "]\n"; //@} code /**@name Accessing elements of a list The normal way to access an item is to use the \Ref{EST_Litem} in conjunction with the () operator. Other functions also exist, eg. first(), last() and nth(). Const and non-const version of each access function exist, allowing both reading and writing. */ //@{ code // Capital;ise all 'e's in all strings for (p = slist.head(); p != 0; p = p->next()) slist(p).gsub("e", "E"); // print out last item in list p = slist.tail(); cout << "Last item: " << slist(p) << endl; // but a more direct method is cout << "Last item: " << slist.last() << endl; // likewise with the head of the list: cout << "First item: " << slist.first() << endl; // print out the 4th item: cout << "4th item: " << slist.nth(4) << endl; // All these can be used for overwriting existing members in the list. // To add new members use append(), prepend(), insert_before() or // insert_after() as shown in \Ref{Addition} slist.first() = "Swallow"; slist.last() = "TurkEy"; slist.nth(2) = "SEagull"; //@} code cout << "\n[ List After Substitutions and Replacements\n"; for (p = slist.head(); p != 0; p = p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; /**@name Removing items from a list. Removing items from lists is done by having the EST_Litem point to a particular item, and then passing this pointer to the remove function. This can be tricky as this leaves the EST_Litem pointer pointing to a non-existent item. To get round this, the remove() function returns a pointer to the previous item in the list. */ //@{ code // In the following example, the item "eagle" is removed and a // pointer to the previous item is returned. The for loop then // points this to the next item in the loop, giving the appearance // of seamless iteration. for (p = slist.head(); p != 0; p = p->next()) if (slist(p) == "EaglE") p = slist.remove(p); //@} code cout << "\n[ List After Removing Eagle\n"; for (p = slist.head(); p != 0; p = p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; /**@name reverse the list. */ //@{ slist.reverse(); //@} cout << "\n[ List After Reverse\n"; for (p = slist.head(); p != 0; p = p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; /**@name Sorting a list * * A number of sort routines for lists are defined. The most useful * are probably sort (a simple bubble sort, quick for small lists) * and qsort (quick-sort, faster for long lists). * * If the default collation order is not what you want you can pass * a comparison operator to the sort routine. */ //@{ code // Sort into alphabetical order sort(slist); cout << "\n[ Sorted\n"; for(p=slist.head(); p ; p=p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; // Sort by second character. qsort(slist,&second_char_gt ); cout << "\n[ Sorted by second character\n"; for(p=slist.head(); p ; p=p->next()) cout << " " << slist(p) << "\n"; cout << "]\n"; //@} code } /**@name Comparison Operation Used in Sort * * Compares the second character of Strings. */ //@{ code bool second_char_gt(const EST_UItem *uv1, const EST_UItem *uv2) { const EST_TItem *val1 = (const EST_TItem *)uv1; const EST_TItem *val2 = (const EST_TItem *)uv2; return (bool)(val1->val(1) > val2->val(1)); } //@} code //@} // we would need to include the following template // declarations if lists of strings weren't already declared. // then this is only useful for and legal for // things which have < == and > defined // template class EST_TList; // template class EST_TItem; // template class EST_TSortable; // declare the template routines we use. //template void sort(EST_TList &a, // bool (*gt)(const EST_UItem *, const EST_UItem *)); //template void qsort(EST_TList &a, // bool (*gt)(const EST_UItem *, const EST_UItem *)); speech_tools/testsuite/kvl_example.cc0000644000076400007640000001652111465017156016543 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Example of list class use. */ /* */ /*************************************************************************/ #include #include #include "EST_TKVL.h" #include "EST_Option.h" #include "EST_util_class.h" #include "EST_types.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif /**@name EST_KVL:example * * some stuff about lists * * @see EST_KVL * @see EST_KVI * @see EST_Option */ //@{ int main(void) { EST_StrStr_KVL kvl; // decl EST_Litem *p; //decl EST_Option al; //decl EST_Option op; //decl /**@name KVL_Addition */ //@{ code // add item simply appends key value pairs onto the end of the list. // This function is useful for the initial building of a list. kvl.add_item("street", "South Bbridge"); kvl.add_item("city", "Edinburgh"); kvl.add_item("post code", "EH1 1HN"); kvl.add_item("country", "United Kingdom"); // by default, if a new entry has the same key name as an existing key, // it will not overwrite this, leaving 2 items with the same key. // The first will be the one accessed. // You can overwrite existing keys by adding a flag to this function. // Note that this is much slower as all the existing keys must // be checked. kvl.add_item("country", "Scotland", 1); // This is equivalent to the change_item function, which is // used to overwrite existing entries: kvl.change_val("country", "Caledonia"); //@} code /**@name KVL_Access The usual way to access the list is to pass in the name of the key to the {\tt val} function, which then returns the value associated with that key. */ //@{ code // Items are accessed by the val function, indexed by the key: // This prints the value associated with the key "country". cout << kvl.val("country") << endl; // An error is given if the key doesn't exist: cout << kvl.val("state") << endl; // This can be turned off by use of a flag. In this case the default // value is returned. cout << kvl.val("state", 0) << endl; // A on-the fly default value can be specified by putting using the // val_def function: cout << kvl.val_def("state", "unknown") << endl; // present() returns true of the key exists: if (kvl.present("state")) cout << kvl.val("state") << endl;; // Normally, direct access to the list is not needed, but for // efficiency's sake, it is sometimes useful to be able to directly // access items. The {\tt list} variable contains the key/value // list, from this, \Ref{EST_Litem} pointers can be set to items, and // then used in access functions: for (p=kvl.head(); p != 0; p=p->next()) cout << kvl.val(p) << " " << kvl.key(p) << endl; // this can also be used to change values: the following changes the // value of the pair pointed to by p to "Scotland". kvl.change_val(p, "Scotland"); // The name of the key can be changed similarly: kvl.change_key(p, "Nation"); //@} code /**@name EST_Option_General The EST_Option class is a high level version of the EST_KVL class with strings for both keys and values. It is often used for lists of options, especially command line arguments. */ //@{ code // load in options from file. The file is in the form of one key // value pair per line. The key ends at the end of the first // whitespace delimited token, which allows the values to have // spaces. Eg. // Country Scotland // Street South Bridge // Number 80 // Height 23.45 // load in file op.load(DATA "/options.file"); // All the normal EST_KVL accessing and addition functions // work. Although the type of the value is a String, functions are // provided to allow easy casting to ints and floats. cout << op.val("Street") << endl; // print out number as an integer cout << op.ival("Number") << endl; // print out height as a float cout << op.fval("Height") << endl; // Often, one wishes to override an existing value if a new value // has been set. The override_val function is useful for this. In // the following example, the command line argument is held in the // {\tt al} object. A default value is put in the length field. If // the command line option is present, it overrides "length", // otherwise "length" is left unchanged: op.add_fitem("length", 39.78); op.override_fval("length", al.fval("-l", 0)); // This is quicker than the alternative: op.add_fitem("length", 39.78); if (al.present("-l")) op.override_fval("length", al.fval("-l", 0)); //@} code } //@} speech_tools/testsuite/handle_example.cc0000644000076400007640000001514710127000721017165 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Mar 18 1998 */ /* */ /* -------------------------------------------------------------------- */ /* Example of using the THandle reference counted pointer type. */ /* */ /*************************************************************************/ #include #include #include #include "EST_Handleable.h" #include "EST_THandle.h" #include "EST_TBox.h" #include "EST_String.h" /**@name EST_THandle:example * * Example of using the THandle reference counted pointer type. * * @see EST_THandle */ //@{ /** A simple object which can be handled and reference counted. */ class HandleableThing : public EST_Handleable { private: EST_String p_name; public: HandleableThing(EST_String name) { p_name=name; start_refcounting(); cout << "[create-" << name << "]\n"; } ~HandleableThing(void) { cout << "[destroy-" << p_name << "]\n"; } EST_String name(void) const { return p_name; } friend ostream& operator << (ostream &st, const HandleableThing &t); HandleableThing *object_ptr() { return this; } const HandleableThing *object_ptr() const { return this; } }; ostream &operator << (ostream &st, const HandleableThing &t) { return st << "<<" << (const char *)t.name() << "/" << t.refcount() << ">>"; } typedef EST_THandle HandleableThingP; // decl /** A simple object which doesn't understand reference counting. */ class Thing { private: EST_String p_name; public: Thing(EST_String name) { p_name=name; cout << "[create-" << name << "]\n"; } ~Thing(void) { cout << "[destroy-" << p_name << "]\n"; } EST_String name(void) const { return p_name; } friend ostream& operator << (ostream &st, const EST_TBox &t); friend ostream& operator << (ostream &st, const Thing &t); Thing *object_ptr() { return this; } const Thing *object_ptr() const { return this; } }; ostream &operator << (ostream &st, const EST_TBox &t) { return st << "<<[[" << t.c()->name() << "/" << t.refcount() << "]]>>"; } ostream &operator << (ostream &st, const Thing &t) { return st << "{" << t.name() << "}"; } typedef EST_TBox BoxedThing; // decl typedef EST_THandle BoxedThingP; // decl void unboxed(void) { cout << "\n\nUnboxed Examples\n"; HandleableThingP pa; HandleableThingP pb; pa = new HandleableThing("apple"); pb = new HandleableThing("banana"); HandleableThingP pc = new HandleableThing("cherry"); cout << *pa << " " << *pb << "\n"; pc=pa; cout << *pa << " " << *pb << "\n"; pc = pb; cout << *pa << " " << *pb << "\n"; pa = NULL; cout << "NULL" << " " << *pb << "\n"; pa = new HandleableThing("pie"); cout << *pa << " " << *pb << "\n"; pb = new HandleableThing("split"); pc = new HandleableThing("cheesecake"); cout << *pa << " " << *pb << "\n"; } void boxed(void) { cout << "\n\nBoxed Examples\n"; BoxedThingP pa; BoxedThingP pb; pa = new BoxedThing(new Thing("aubergene")); pb = new BoxedThing(new Thing("brocoli")); BoxedThingP pc = new BoxedThing(new Thing("cauliflower")); cout << *pa << " " << *pb << "\n"; pc=pa; cout << *pa << " " << *pb << "\n"; pc = pb; cout << *pa << " " << *pb << "\n"; pa = NULL; cout << "NULL" << " " << *pb << "\n"; pa = new BoxedThing(new Thing("pate")); cout << *pa << " " << *pb << "\n"; pb = new BoxedThing(new Thing("quiche")); pc = new BoxedThing(new Thing("cheese")); cout << *pa << " " << *pb << "\n"; } int main(void) { unboxed(); boxed(); exit(0); } #ifdef INSTANTIATE_TEMPLATES template class EST_THandle; template class EST_THandle; template class EST_TBox; #endif //@} speech_tools/testsuite/named_enum_example.cc0000644000076400007640000002311710127000721020036 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 29 1997 */ /************************************************************************/ /* */ /* Example of the declaration and use fo the named enum type. */ /* */ /************************************************************************/ #include #include #include "EST_TNamedEnum.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif // the named enum class provides an easy way to associate strings with // the values of and enumerated type, for instance for IO. It's type safe and // as readable as seems possible in C++. // A single enum element can have multiple names (eg synonyms or common typos) // Named enums are defined in terms of the more general valued enums which // associates enum elements with members of an arbitrary type. // Both named enums and valued enums can have an additional piece of // information (eg a struct containing creation functions or another // representation) associated with each enum element. // --------- Declaration (eg in header or class) ------------ // the enumerated type used in C code. typedef enum { c_red=1, c_blue=2, c_green=3, c_unknown=666} Colour; // the mapping used to get names and so on extern EST_TNamedEnum ColourMap; // ---------- Definition --------------------------------------- // In a .C file somewhere we have to give the names in a table. // The table has to be given a name and is then used to initialise the mapping. // The definition table ends with a repeat of the first entry and some // value. This last pair gives the unknown enum value and unknown // value for use when lookup fails // For reasons of C++ brain death we have to declare this as a // ValuedEnumDefinition rather than a // NamedEnum::Definition or some other saner version Start_TNamedEnum(Colour, ColourMap) // enum element list of names { c_unknown, {"kinda brownish"}}, { c_red, {"red", "scarlet"}}, { c_blue, {"blue", "navy", "sad"}}, { c_unknown, {NULL}} // looking up unknown names gives c_unknown // looking up unknown enum values gives NULL End_TNamedEnum(Colour, ColourMap) // Here is a different table for the same enum type. // Perhaps we want to accept input in Spanish, but not get Spanish and // English names mixed up Start_TNamedEnum(Colour, SpanishColourMap) // enum element list of names { c_unknown, {"no conocido"}}, { c_red, {"rojo", "escarlata", "sangre"}}, { c_blue, {"azul", "piscina", "mar", "cielo"}}, { c_unknown, {NULL}} End_TNamedEnum(Colour, SpanishColourMap) // ------- Alternative including extra information --------------- // Sometimes you may want to associate information with each element. // The following variant associates three small integers with each // colour, perhaps to enable them to be displayed. struct colour_info { int red, green, blue; }; // a map including this extra information is declared as extern EST_TNamedEnumI RGBColourMap; // and here is how the values are defined. Start_TNamedEnumI(Colour, colour_info, RGBColourMap) // enum element list of names extra info (red, green, blue) { c_unknown, {"kinda grey"}, {0x7f, 0x7f, 0x7f}}, { c_red, {"red", "scarlet"}, {0xff, 0, 0}}, { c_blue, {"blue", "navy", "sad"}, {0, 0, 0xff}}, { c_unknown, {NULL}} End_TNamedEnumI(Colour, colour_info, RGBColourMap) // --------- Use ----------------------------------------------- int main(void) { Colour c1 = c_red; Colour c2 = c_green; const char *n; // get the default name for colours. n = ColourMap.name(c1); cout << "c1 is " << (n?n:"[NULL]") << "\n"; n = ColourMap.name(c2); cout << "c2 is " << (n?n:"[NULL]") << "\n"; // look up some names to see what they correspond to const char *colours[] = { "red", "navy", "puce"}; for(int i=0; i<3; i++) { // note since enum values are universal // we can get the colour by assuming English, get the // information from the other map and get the name for output in // spanish const char *nm= colours[i]; Colour c = ColourMap.token(nm); colour_info &info = RGBColourMap.info(c); const char *spanish = SpanishColourMap.name(c); cout << nm << " is " << (int)c << " = " << ColourMap.name(c) << " (" << (spanish?spanish:"[NULL]") << " in Spanish)" << " = {" << info.red << ", " << info.green << ", " << info.blue << "}\n"; } // In the special case of EST_TNamedEnum (i.e. simple mappings from // enum to (const char *) with no extra information) we can save // mappings to files and read them back // There are two ways to save a mapping, we can have the file say how // names map to numeric values... if (ColourMap.save("tmp/colour.map") != write_ok) cout << "\n\nname map write failed\n"; else { cout << "\n\ncolour name map\n"; cout.flush(); system("cat tmp/colour.map"); } // Of course this can result in the file not being valid when the // enumerated type definition changes and so the assigned numbers change. // If there is a standard mapping defined and we are saving an // alternative, the standard one can provide names for the enumerated // values, meaning the file will be valid so long as the default // mapping is correct. // For instance we can assume someone maintains the English names // as the type is extended and save the Spanish names as a translation. if (SpanishColourMap.save("tmp/colour_spanish.map", ColourMap) != write_ok) cout << "\n\nname map write failed\n"; else { cout << "\n\ncolour name map (spanish)\n"; cout.flush(); system("cat tmp/colour_spanish.map"); } // There are two corresponding ways to read in a map. // If the map is defined in the file by numbers we load it like this... EST_TNamedEnum LoadedColourMap(c_unknown); if (LoadedColourMap.load(DATA "/colours.map") !=format_ok) cout << "\n\nname map read failed\n"; else { cout << "\n\nread in table\n"; LoadedColourMap.save("tmp/tmp.map"); cout.flush(); system("cat tmp/tmp.map"); } // If it's defined in the file using the names... if (LoadedColourMap.load(DATA "/colours_translation.map", ColourMap) !=format_ok) cout << "\n\nname map read failed\n"; else { cout << "\n\nread in table (translation)\n"; LoadedColourMap.save("tmp/tmp.map"); cout.flush(); system("cat tmp/tmp.map"); } exit(0); } // ----------- Template Brain Death -------------------- // Declaration of the template use for GCC // Just which variants need to be declared is sometimes unpredictable, // especially between versions of gcc. // Best just compile and then find out which ones aren't there. Declare_TNamedEnumI(Colour, colour_info) Declare_TNamedEnum(Colour) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" Instantiate_TNamedEnumI(Colour, colour_info) Instantiate_TNamedEnum(Colour) #endif speech_tools/testsuite/deq_example.cc0000644000076400007640000001136010127000721016474 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Example of list class use. */ /* */ /*************************************************************************/ #include #include #include "EST_TDeque.h" #include "EST_String.h" /**@name EST_TDeque:example * * Examples of stack and queue use. * * @see EST_TDeque */ //@{ //{ code int main(void) { EST_String strings[] = { "Argyle", "Bute", "Cumbernauld", "Dundee", "Edinburgh", "Fife", "Glasgow", "Harris", "Iona", "Jura", "Kirkwald", "Lewis", "Mull", "Newhaven", "Orkney", "Pitlochry", "Queensferry", }; EST_TDeque deq(5,2); int i=0; deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); cout << deq << "\n"; cout << "0: " << deq.nth(0) << "\n"; cout << "1: " << deq.nth(1) << "\n"; cout << deq.pop() << "\n"; cout << deq.pop() << "\n"; cout << deq << "\n"; deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); cout << deq << "\n"; cout << deq.back_pop() << "\n"; cout << deq.back_pop() << "\n"; cout << deq.back_pop() << "\n"; cout << deq.back_pop() << "\n"; cout << deq << "\n"; deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); cout << deq << "\n"; cout << "0: " << deq.nth(0) << "\n"; cout << "1: " << deq.nth(1) << "\n"; cout << "2: " << deq.nth(2) << "\n"; cout << "3: " << deq.nth(3) << "\n"; deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); deq.push(strings[i++]); cout << deq << "\n"; deq.clear(); i=0; deq.push(strings[i++]); deq.push(strings[i++]); cout << deq << "\n"; deq.back_push(strings[i++]); deq.back_push(strings[i++]); cout << deq << "\n"; } //@} code //@} // we would need to include the following template // declarations if deqs of strings weren't already declared // Declare_TDEQ_Class(EST_String, "FILLER") // #if defined(INSTANTIATE_TEMPLATES) // #include "../base_class/EST_TDeque.cc" // Instantiate_TDEQ(EST_String) // #endif speech_tools/testsuite/ling_example.cc0000644000076400007640000004162311465017156016701 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #include "EST_unix.h" #include "EST_ling_class.h" /** @name Linguistic Classes Example Code */ //@{ int main(void) { /** @name Adding basic information to an EST_Item * * An item such as * * is constructed as follows: (note that * the attributes are in capitals by linguistic convention only: * attribute names are case sensitive and can be upper or lower * case). */ //@{ //@{ code EST_Item p; p.set("POS", "Noun"); p.set("NAME", "example"); p.set("FOCUS", "+"); p.set("DURATION", 2.76); p.set("STRESS", 2); //@} code /** The type of the values in features is a * EST_Val class, which is a union which can * store ints, floats, EST_Strings, void pointers, and * EST_Features. The overloaded function * facility of C++ means that the set() can be * used for all of these. */ //@} /** @name Accessing basic information in an Item * * When accessing the features, the type must be * specified. This is done most easily by using of a series of * functions whose type is coded by a capital letter: * * <function>F()</function> return value as a * float * <function>I()</function> return value as a * integer * <function>S()</function> return value as a * <function>A()</function> return value as a * EST_Features * */ //@{ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Duration for p is " << p.F("DURATION") << endl; cout << "Stress value for p is " << p.I("STRESS") << endl; //@} code /** * * Output * * "Noun" * 2.75 * 1 * * * * A optional default value can be given if a result is always desired */ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Syntactic Category for p is " << p.S("CAT", "Noun") << endl; // noerror //@} code //@} /** @name Nested feature structures in items * * Nested feature structures such as * * Example eq11 * * * can be created in a number of ways: */ //@{ //@{ code p.set("NAME", "d"); p.set("VOICE", "+"); p.set("CONTINUANT", "-"); p.set("SONORANT", "-"); EST_Features f; p.set("PLACE OF ARTICULATION", f); // copy in empty feature set here p.A("PLACE OF ARTICULATION").set("CORONAL", "+"); p.A("PLACE OF ARTICULATION").set("ANTERIOR", "+"); //@} code /** or by filling the values in an EST_Features object and * copying it in: */ //@{ code EST_Features f2; f2.set("CORONAL", "+"); f2.set("ANTERIOR", "+"); p.set("PLACE OF ARTICULATION", f2); //@} code /** Nested features can be accessed by multiple calls to the * accessing commands: */ //@{ code cout << "Anterior value is: " << p.A("PLACE OF ARTICULATION").S("ANTERIOR"); cout << "Coronal value is: " << p.A("PLACE OF ARTICULATION").S("CORONAL"); //@} code /** The first command is A() because PLACE is a * feature structure, and the second command is * S() because it returns a string (the * value or ANTRIOR or CORONAL). A shorthand is provided to * extract the value in a single statement: */ //@{ code cout << "Anterior value is: " << p.S("PLACE OF ARTICULATION.ANTERIOR"); cout << "Coronal value is: " << p.S("PLACE OF ARTICULATION.CORONAL"); //@} code /** Again, as the last value to be returned is a string * S() must be used. This shorthand can also be used * to set the features: */ //@{ code p.set("PLACE OF ARTICULATION.CORONAL", "+"); p.set("PLACE OF ARTICULATION.ANTERIOR", "+"); //@} code /** this is the easiest and most commonly used method. */ //@} /** @name Utility functions for items * * The presence of a attribute can be checked using * f_present(), which returns true if the * attribute is in the item: */ //@{ //@{ code cout << "This is true: " << p.f_present("PLACE OF ARTICULATION"); cout << "This is false: " << p.f_present("MANNER"); //@} code /** A attribute can be removed by f_remove */ //@{ code p.f_remove("PLACE OF ARTICULATION"); //@} code //@} /** @name Building a linear list relation * * * It is standard to store the phones for an utterance as a linear list * in a EST_Relation object. Each phone is represented by one * EST_Item, whereas the complete list is stored as a * EST_Relation. * * The easiest way to build a linear list is by using the * EST_Relation.append(), which when called * without arguments, makes a new empty EST_Item, adds it onto * the end of the relation and returns a pointer to it. The * information relevant to that phone can then be added to the * returned item. */ //@{ //@{ code EST_Relation phones; EST_Item *a; a = phones.append(); a->set("NAME", "f"); a->set("TYPE", "consonant"); a = phones.append(); a->set("NAME", "o"); a->set("TYPE", "vowel"); a = phones.append(); a->set("NAME", "r"); a->set("TYPE", "consonant"); //@} code /** Note that the -> operator is used because the EST_Item a is a * pointer here. The same pointer variable can be used multiple * times because every time append() is * called it allocates a new item and returns a pointer to it. * * If you already have a EST_Item pointer and want to add it to a * relation, you can give it as an argument to * append(), but this is generally * inadvisable as it involves some unnecessary copying, and also * you have to allocate the memory for the next EST_Item pointer * yourself every time (if you don't you will overwrite the * previous one): */ //@{ code a = new EST_Item; a->set("NAME", "m"); a->set("TYPE", "consonant"); phones.append(a); a = new EST_Item; a->set("NAME", "ei"); a->set("TYPE", "vowel"); //@} code /** Items can be prepended in exactly the same way: */ //@{ code a = phones.prepend(); a->set("NAME", "n"); a->set("TYPE", "consonant"); a = phones.prepend(); a->set("NAME", "i"); a->set("TYPE", "vowel"); //@} code //@} /** @name Iterating through a linear list relation * Iteration in lists is performed with * next() and prev(), and * an EST_Item, used as an iteration pointer. */ //@{ //@{ code EST_Item *s; for (s = phones.head(); s != 0; s = s->next()) cout << s->S("NAME") << endl; //@} code /** * * Output * * name:i type:vowel * name:n type:consonant * name:f type:consonant * name:o type:vowel * name:r type:consonant * name:m type:consonant * * * */ //@{ code for (s = phones.tail(); s != 0; s = s->prev()) cout << s->S("NAME") << endl; //@} code /** * * Output * * name:m type:consonant * name:r type:consonant * name:o type:vowel * name:f type:consonant * name:n type:consonant * name:i type:vowel * * * * * head() and tail() * return EST_Item pointers to the start and end of the list. * next() and prev() * returns the next or previous item in the list, and returns * 0 when the end or start of the list is * reached. Hence checking for 0 is a useful * termination condition of the iteration. Taking advantage of C * shorthand allows us to write: */ //@{ code for (s = phones.head(); s; s = s->next()) cout << s->S("NAME") << endl; //@} code //@} /** @name Building a tree relation * * * * It is standard to store information such as syntax as a tree * in a EST_Relation object. Each tree node is represented by one * EST_Item, whereas the complete tree is stored as a * EST_Relation. * * The easiest way to build a tree is by using the * append_daughter(), which when called * without arguments, makes a new empty EST_Item, adds it as a * daughter to an existing item and returns a pointer to it. The * information relevant to that node can then be added to the * returned item. The root node of the tree must be added * directly to the EST_Relation. */ //@{ //@{ code //@example prog01 EST_Relation tree; EST_Item *r, *np, *vp, *n; r = tree.append(); r->set("CAT", "S"); np = append_daughter(r); np->set("CAT", "NP"); n = append_daughter(np); n->set("CAT", "PRO"); n = append_daughter(n); n->set("NAME", "John"); vp = append_daughter(r); vp->set("CAT", "VP"); n = append_daughter(vp); n->set("CAT", "VERB"); n = append_daughter(n); n->set("NAME", "loves"); np = append_daughter(vp); np->set("CAT", "NP"); n = append_daughter(np); n->set("CAT", "DET"); n = append_daughter(n); n->set("NAME", "the"); n = append_daughter(np); n->set("CAT", "NOUN"); n = append_daughter(n); n->set("NAME", "woman"); cout << tree; //@} code /** * * Output * * (S * (NP * (N (John)) * ) * (VP * (V (loves)) * (NP * (DET the) * (NOUN woman)) * ) *) * * * * Obviously, the use of recursive functions in building trees is more * efficient and would eliminate the need for the large number of * temporary variables used in the above example. */ //@} /** @name Iterating through a tree relation * * Iteration in trees is done with daughter1() * daughter2() daughtern() and * parent(). Pre-order traversal can be achieved * iteratively as follows: */ //@{ //@{ code n = tree.head(); // initialise iteration variable to head of tree while (n) { if (daughter1(n) != 0) // if daughter exists, make n its daughter n = daughter1(n); else if (n->next() != 0)//otherwise visit its sisters n = n->next(); else // if no sisters are left, go back up the tree { // until a sister to a parent is found bool found=FALSE; for (EST_Item *pp = parent(n); pp != 0; pp = parent(pp)) if (pp->next()) { n = pp->next(); found=TRUE; break; } if (!found) { n = 0; break; } } cout << *n; } //@} code /** A special set of iterators are available for traversal of the leaf * (terminal) nodes of a tree: */ //@{ code //@ example prog02 //@ title Leaf iteration for (s = first_leaf(tree.head()); s != last_leaf(tree.head()); s = next_leaf(s)) cout << s->S("NAME") << endl; //@} code //@} /** @name Building a multi-linear relation */ //@{ //@} /** @name Iterating through a multi-linear relation */ //@{ //@} /** @name Relations in Utterances * * The EST_Utterance class is used to store all * the items and relations relevant to a single utterance. (Here * utterance is used as a general linguistic entity - it doesn't have to * relate to a well formed complete linguistic unit such as a sentence or * phrase). * * Instead of storing relations separately, they are stored in * utterances: */ //@{ //@{ code EST_Utterance utt; utt.create_relation("Word"); utt.create_relation("Syntax"); //@} code /** EST_Relations can be accessed though the utterance object either * directly or by use of a temporary EST_Relation pointer: */ //@{ code EST_Relation *word, *syntax; word = utt.relation("Word"); syntax = utt.relation("Syntax"); //@} code /** The contents of the relation can be filled by the methods described * above. */ //@} /** @name Adding items into multiple relations * * A major aspect of this system is that an item can be in two relations * at once, as shown in . * * In the following example, using the syntax relation as already created * in , * shows how to put the terminal nodes of this * tree into a word relation: */ //@{ //@{ code //@example prog03 //@title adding existing items to a new relation word = utt.relation("Word"); syntax = utt.relation("Syntax"); for (s = first_leaf(syntax->head()); s != last_leaf(syntax->head()); s = next_leaf(s)) word->append(s); //@} code /** * Thus the terminal nodes in the syntax relation are now stored as a * linear list in the word relation. * * Hence */ //@{ code cout << *utt.relation("Syntax") << "\n"; //@} code /** produces * * * Output * *(S * (NP * (N (John)) * ) * (VP * (V (loves)) * (NP * (DET the) * (NOUN woman)) * ) *) * * * *whereas */ //@{ code cout << *utt.relation("Word") << "\n"; //@} code /** produces * * * Output * *John *loves *the *woman * * * */ //@} /** @name Changing the relation an item is in as_relation, in relation etc */ //@{ //@} /** @name Feature functions evaluate functions setting functions */ //@{ //@} exit(0); } //@} speech_tools/testsuite/feature_example.cc0000644000076400007640000001621010044502523017362 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #include "EST_unix.h" #include "EST_ling_class.h" /** @name Feature and Val Classes Example Code */ //@{ int main(void) { /** @name Adding basic information to an EST_Item * * An item such as * * is constructed as follows: (note that * the attributes are in capitals by linguistic convention only: * attribute names are case sensitive and can be upper or lower * case). */ //@{ //@{ code EST_Item p; p.set("POS", "Noun"); p.set("NAME", "example"); p.set("FOCUS", "+"); p.set("DURATION", 2.76); p.set("STRESS", 2); //@} code /** The type of the values in features is a * EST_Val class, which is a union which can * store ints, floats, EST_Strings, void pointers, and * EST_Features. The overloaded function * facility of C++ means that the set() can be * used for all of these. */ //@} /** @name Accessing basic information in an Item * * When accessing the features, the type must be * specified. This is done most easily by using of a series of * functions whose type is coded by a capital letter: * * <function>F()</function> return value as a * float * <function>I()</function> return value as a * integer * <function>S()</function> return value as a * <function>A()</function> return value as a * EST_Features * */ //@{ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Duration for p is " << p.F("DURATION") << endl; cout << "Stress value for p is " << p.I("STRESS") << endl; //@} code /** * * Output * * "Noun" * 2.75 * 1 * * * * A optional default value can be given if a result is always desired */ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Syntactic Category for p is " << p.S("CAT", "Noun") << endl; // noerror //@} code //@} /** @name Nested feature structures in items * * Nested feature structures such as * * Example eq11 * * * can be created in a number of ways: */ //@{ //@{ code p.set("NAME", "d"); p.set("VOICE", "+"); p.set("CONTINUANT", "-"); p.set("SONORANT", "-"); EST_Features f; p.set("PLACE OF ARTICULATION", f); // copy in empty feature set here p.A("PLACE OF ARTICULATION").set("CORONAL", "+"); p.A("PLACE OF ARTICULATION").set("ANTERIOR", "+"); //@} code /** or by filling the values in an EST_Features object and * copying it in: */ //@{ code EST_Features f2; f2.set("CORONAL", "+"); f2.set("ANTERIOR", "+"); p.set("PLACE OF ARTICULATION", f2); //@} code /** Nested features can be accessed by multiple calls to the * accessing commands: */ //@{ code cout << "Anterior value is: " << p.A("PLACE OF ARTICULATION").S("ANTERIOR"); cout << "Coronal value is: " << p.A("PLACE OF ARTICULATION").S("CORONAL"); //@} code /** The first command is A() because PLACE is a * feature structure, and the second command is * S() because it returns a string (the * value or ANTRIOR or CORONAL). A shorthand is provided to * extract the value in a single statement: */ //@{ code cout << "Anterior value is: " << p.S("PLACE OF ARTICULATION.ANTERIOR"); cout << "Coronal value is: " << p.S("PLACE OF ARTICULATION.CORONAL"); //@} code /** Again, as the last value to be returned is a string * S() must be used. This shorthand can also be used * to set the features: */ //@{ code p.set("PLACE OF ARTICULATION.CORONAL", "+"); p.set("PLACE OF ARTICULATION.ANTERIOR", "+"); //@} code /** this is the easiest and most commonly used method. */ //@} /** @name Utility functions for items * * The presence of a attribute can be checked using * f_present(), which returns true if the * attribute is in the item: */ //@{ //@{ code cout << "This is true: " << p.f_present("PLACE OF ARTICULATION"); cout << "This is false: " << p.f_present("MANNER"); //@} code /** A attribute can be removed by f_remove */ //@{ code p.f_remove("PLACE OF ARTICULATION"); //@} code //@} exit(0); } //@} speech_tools/testsuite/xml_regression.cc0000644000076400007640000000563110127000721017254 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Mar 18 1998 */ /* */ /* -------------------------------------------------------------------- */ /*************************************************************************/ #include #include int main(void) { return 0; } speech_tools/testsuite/string_regression.cc0000644000076400007640000002130310127000721017754 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley */ /* Date: May 1997 */ /************************************************************************/ #include "EST_String.h" #include int main() { EST_String line("\n"); EST_String zeroth(""); EST_String first("hello world"); EST_String second("lo w"); EST_String third("l"); EST_String fourth("the lazy dog."); EST_String fifth("two\nlines"); EST_String sixth("-o:F"); EST_String seventh("-o"); EST_String eighth("some,words-with[punctuation]left..after,a-vowel!"); EST_String space(" "); EST_String quoted("\"some tokens\" which are \"quoted with \"\"\""); EST_String bits1[10], bits2[10], bits3[10], bits4[10], bits5[10], bits6[2]; EST_String sub1 = first; EST_String sub2 = first; EST_Regex reg0(".*"); EST_Regex reg1("l+"); EST_Regex reg2("l\\(l+\\|azy\\)"); EST_Regex reg3("lll+"); EST_Regex reg4(second); EST_Regex reg5(".*l+.*l+.*"); EST_Regex reg6(".. .."); EST_Regex reg7("[a-z]\\.[a-z]"); EST_Regex reg8("o\\>"); EST_Regex reg9("ll\nrr"); EST_Regex reg10("o\nl"); EST_Regex reg11("\\([^aeiou]\\)\\(\\]\\|[-[.,!?]\\)+"); EST_String result0 = zeroth.before(".", -1); EST_String result1 = first.before(second); EST_String result2 = first.before(second,4); EST_String result3 = first.before(third,4); EST_String result4 = first.before(third, -6); EST_String result5 = first.before(third, -7); EST_String result6b = first.before(5); EST_String result1a = first.after(second); EST_String result2a = first.after(second,4); EST_String result3a = first.after(third,4); EST_String result4a = first.after(third, -6); EST_String result5a = first.after(third, -7); EST_String result6a = first.after(5); EST_String result6 = second; EST_String result7 = second; result6 += " sw eet"; result7 += third; int test0 = zeroth.contains(reg0); int test1 = first.contains(reg1); int test2 = first.contains(reg2); int test3 = first.contains(reg3); int test4 = first.contains(second); int test5 = fourth.contains(reg2); int test6 = fourth.contains(reg7); int test7 = first.contains(reg8); int test8 = fourth.contains(reg8); int test9 = first.contains(reg9); int test10 = fifth.contains(reg10); int test11 = first.contains(second,3); int test12 = first.contains(second,0); int test13 = second.contains(third, 0); int test14 = sixth.contains(seventh, 0); int test15 = seventh.contains(seventh, 0); int test0m = zeroth.matches(reg0); int test1m = first.matches(reg4); int test2m = second.matches(reg4); int test3m = first.matches(reg5); EST_String result1r = first.before(second); EST_String result2r = first.before(third, -1); EST_String result3r = first.after(third, 5); EST_String result1at = first.at(second); EST_String result2at = first.at(reg6); EST_String result3at = first.at(2,4); EST_String result8 = eighth; result8.gsub(reg11,1); int num1 = split(first, bits1, 10, reg1); int num2 = split(first, bits2, 2, reg1); int num7 = split(first, bits3, 10, space); int num8 = split(quoted, bits4, 10, space, '"'); int num9 = split(quoted, bits5, 10, RXwhite, '"'); int num10 = split(first, bits6, 2, "."); int num3 = first.freq("o"); int num4 = first.freq(third); // numx = first.freq(reg1); // GNU can't do this int num5 = sub1.gsub("l", "[an ell]"); int num6 = sub2.gsub(reg1, "[some ells]"); cout << "First '"<< first << "'\n"; cout << "Second '"<< second << "'\n"; cout << "Third '"<< third << "'\n"; cout << "Result 0 '"<< result0 << "'\n"; cout << "Result 1 '"<< result1 << "'\n"; cout << "Result 2 '"<< result2 << "'\n"; cout << "Result 3 '"<< result3 << "'\n"; cout << "Result 4 '"<< result4 << "'\n"; cout << "Result 5 '"<< result5 << "'\n"; cout << "Result 6b '"<< result6b << "'\n"; cout << "Result 1a '"<< result1a << "'\n"; cout << "Result 2a '"<< result2a << "'\n"; cout << "Result 3a '"<< result3a << "'\n"; cout << "Result 4a '"<< result4a << "'\n"; cout << "Result 5a '"<< result5a << "'\n"; cout << "Result 6a '"<< result6a << "'\n"; cout << "Result 6 '"<< result6 << "'\n"; cout << "Result 7 '"<< result7 << "'\n"; cout << "Result 8 '"<< result8 << "'\n"; cout << "Test 0 '"<< test0 << "'\n"; cout << "Test 1 '"<< test1 << "'\n"; cout << "Test 2 '"<< test2 << "'\n"; cout << "Test 3 '"<< test3 << "'\n"; cout << "Test 4 '"<< test4 << "'\n"; cout << "Test 5 '"<< test5 << "'\n"; cout << "Test 6 '"<< test6 << "'\n"; cout << "Test 7 '"<< test7 << "'\n"; cout << "Test 8 '"<< test8 << "'\n"; cout << "Test 9 '"<< test9 << "'\n"; cout << "Test 10 '"<< test10 << "'\n"; cout << "Test 11 '"<< test11 << "'\n"; cout << "Test 12 '"<< test12 << "'\n"; cout << "Test 13 '"<< test13 << "'\n"; cout << "Test 14 '"<< test14 << "'\n"; cout << "Test 15 '"<< test15 << "'\n"; cout << "Test 0m '"<< test0m << "'\n"; cout << "Test 1m '"<< test1m << "'\n"; cout << "Test 2m '"<< test2m << "'\n"; cout << "Test 3m '"<< test3m << "'\n"; cout << "Result 1r '"<< result1r << "'\n"; cout << "Result 2r '"<< result2r << "'\n"; cout << "Result 3r '"<< result3r << "'\n"; cout << "Result 1at '"<< result1at << "'\n"; cout << "Result 2at '"<< result2at << "'\n"; cout << "Result 3at '"<< result3at << "'\n"; cout << "Num 1 '"<< num1 << "'\n"; cout << "bits1[0] '"< #include #include "EST_String.h" #include "EST_Token.h" #include "EST_THash.h" #define LINE_LENGTH 1000 EST_Regex RX_Word("[A-Z]?[a-z]+\\('[a-z]+\\)?"); #define WORD "Latitude" int main(int argc, const char *argv[]) { EST_TStringHash places(10); int line_no = 1; EST_TokenStream file; if (argc != 2) return 1; file.open(argv[1]); file.set_WhiteSpaceChars(""); file.set_SingleCharSymbols("\n"); file.set_PunctuationSymbols(""); file.set_PrePunctuationSymbols(""); while(! file.eof()) { EST_String line; line = (EST_String)file.get(); if (file.eof()) break; if (line == "\n") line_no++; int p=0, len; while((p = line.search(RX_Word, len, p)) >= 0) { EST_String word(line.at(p, len)); places.add_item(word, line_no); p += len; } } cout << WORD " is on line " << places.val(WORD) << "\n"; places.dump(cout); return 0; } speech_tools/testsuite/pathname_regression.cc0000644000076400007640000001027510127000721020251 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 29 1997 */ /************************************************************************/ /* */ /* Test of EST_Pathname class. */ /* */ /************************************************************************/ #include #include "EST_Pathname.h" int main(void) { EST_Pathname f, g, abs("/tmp"); f = EST_Pathname::construct("section", "test", "foo"); g = "dir/subdir/"; cout << " f = " << f << "\n"; cout << " g = " << g << "\n"; cout << " abs = " << abs << "\n"; cout << " f.as_directory() = " << f.as_directory() << "\n"; cout << " f.as_file() = " << f.as_file() << "\n"; cout << " g.as_directory() = " << g.as_directory() << "\n"; cout << " g.as_file() = " << g.as_file() << "\n"; cout << " f"; if (f.is_dirname()) cout << " is directory\n"; else if ( f.is_filename()) cout << " is file\n"; else cout << "is weird!\n"; cout << " g"; if (g.is_dirname()) cout << " is directory\n"; else if ( g.is_filename()) cout << " is file\n"; else cout << "is weird!\n"; cout << " g"; if (g.is_absolute()) cout << " is absolute\n"; else if ( g.is_relative()) cout << " is relative\n"; else cout << "is weird!\n"; cout << " abs"; if (abs.is_absolute()) cout << " is absolute\n"; else if ( abs.is_relative()) cout << " is relative\n"; else cout << "is weird!\n"; cout << " g + f = " << g + f << "\n"; cout << " g + abs = " << g + abs << "\n"; cout << " abs + g + f = " << abs + (g + f) << "\n"; return 0; } speech_tools/testsuite/track_regression.cc0000644000076400007640000001072710127000721017562 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Fri May 9 1997 */ /* ------------------------------------------------------------------- */ /* Example of declaration and use of tracks. */ /* */ /*************************************************************************/ #include #include #include "EST_TrackMap.h" #include "EST_Track.h" void dump_track(EST_Track &tr, EST_String comment) { printf("[ Track %s\n", (const char *)comment); for (int f=0; f #include "EST_Token.h" static void binary_read_test(); static void find_tokens(EST_TokenStream &ts) { // Count and display the tokens in this stream int tokens; for (tokens=0; !ts.eof(); tokens++) cout << ts.get().string() << endl; cout << "Total: " << tokens << endl << endl;; } int main(int argc,char **argv) { // Simple program to read all the tokens in the named file // a print a summary of them (void)argc; (void)argv; EST_TokenStream ts; EST_String s; // Basic tokenizing tasks changing punctuation, whitespace and // single character symbols etc. s = "This is a test."; cout << "Test 1: " << quote_string(s) << endl; ts.open_string(s); find_tokens(ts); ts.close(); s = "This (is) a test."; cout << "Test 2: " << quote_string(s) << endl; ts.open_string(s); find_tokens(ts); ts.close(); s = "This (is) a test."; cout << "Test 3: " << quote_string(s) << endl; ts.open_string("This (is) a test."); ts.set_PrePunctuationSymbols("({["); ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols); find_tokens(ts); ts.close(); s = "This (is) a test."; cout << "Test 4: " << quote_string(s) << endl; ts.open_string(s); ts.set_SingleCharSymbols("()"); ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols); find_tokens(ts); ts.close(); s = "This \"is a\" te\\\"st."; cout << "Test 5: " << quote_string(s) << endl; ts.open_string(s); ts.set_PrePunctuationSymbols(EST_Token_Default_PrePunctuationSymbols); ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols); find_tokens(ts); ts.close(); s = "This \"is a\" te\\\"st."; cout << "Test 6: " << quote_string(s) << endl; ts.open_string(s); ts.set_quotes('"','\\'); find_tokens(ts); ts.close(); s = "This \"is \n\ a\" te\\\"st."; cout << "Test 7: " << quote_string(s) << endl; ts.open_string(s); ts.set_quotes('"','\\'); find_tokens(ts); ts.close(); // test of reading binary data binary_read_test(); return 0; } EST_String make_tokbins(const EST_String& filename) { FILE *fd; char buff[64]; int a[2]; int numbytes; // Make a buffer with both tokens and binary data sprintf(buff,"a buffer BINARY "); a[0] = 7; a[1] = -34; memmove(buff+16,a,sizeof(int)*2); sprintf(buff+16+(sizeof(int)*2)," and tokens"); if ((fd=fopen(filename,"w")) == NULL) { cerr << "Token_regression: failed to open " << filename << endl; exit(-1); } numbytes = fwrite(buff,1,16+(sizeof(int)*2)+11,fd); fclose(fd); // Special constructions as the string contains nulls return EST_String(buff,numbytes,0,numbytes); } static void binary_read_test() { // You can use fread to read directly from a token stream // but care should be take at the boundaries. Reading a // token will always read the character following it. By // convention it is recommended you include the single token // BINARY follow by a single space in the stream before each // binary section. int b[2]; EST_String tokbinbuf; EST_TokenStream ts; tokbinbuf = make_tokbins("tmp/tokbin.dat"); // Do the reading cout << "Reading tokens and binary from string\n"; ts.open_string(tokbinbuf); cout << ts.get() << endl; cout << ts.get() << endl; if (ts.get() != "BINARY") { cout << "failed to read binary data, missing BINARY token." << endl; exit(-1); } ts.fread(b,sizeof(int),2); cout << b[0] << endl; cout << b[1] << endl; cout << ts.get() << endl; cout << ts.get() << endl; ts.close(); cout << "Reading tokens and binary from file\n"; ts.open("tmp/tokbin.dat"); cout << ts.get() << endl; cout << ts.get() << endl; if (ts.get() != "BINARY") { cout << "failed to read binary data, missing BINARY token." << endl; exit(-1); } ts.fread(b,sizeof(int),2); cout << b[0] << endl; cout << b[1] << endl; cout << ts.get() << endl; cout << ts.get() << endl; ts.close(); } speech_tools/testsuite/complex_regression.cc0000644000076400007640000000532510127000721020123 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Paul Taylor */ /* Date: December 1997 */ /************************************************************************/ #include "EST_Complex.h" #include #include int main() { EST_Complex z(4.0, 3.0); cout << z << "\n"; return 0; } speech_tools/testsuite/list_regression.cc0000644000076400007640000000604310127000721017425 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Regression test for list class. */ /* */ /*************************************************************************/ #include #include #include "EST_TList.h" #include "EST_String.h" Declare_TList(EST_String) int main(void) { return 0; } #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" Instantiate_TList(EST_String) #endif speech_tools/testsuite/kvl_regression.cc0000644000076400007640000001123610127000721017246 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Example of list class use. */ /* */ /*************************************************************************/ #include #include #include "EST_TKVL.h" #include "EST_Option.h" #include "EST_util_class.h" #include "EST_types.h" /**@name key_value_example * * some stuff about lists * * @see EST_KVL * @see EST_KVI * @see EST_Option */ //@{ int main(void) { EST_StrStr_KVL kvl; // decl /**@name Addition */ //@{ // add item simply appends key value pairs onto the end of the list. // This function is useful for the initial building of a list. kvl.add_item("street", "South Bbridge"); kvl.add_item("city", "Edinburgh"); kvl.add_item("post code", "EH1 1HN"); kvl.add_item("country", "United Kingdom"); // by default, if a new entry has the same key name as an existing key, // it will not overwrite this, leaving 2 items with the same key. // The first will be the one accessed. // You can overwrite existing keys by adding a flag to this function. // Note that this is much slower as all the existing keys must // be checked. kvl.add_item("country", "Scotland", 1); // This is equivalent to the change_item function, which is // used to overwrite existing entries: kvl.add_item("country", "Caledonia", 1); // Items are accessed by the val function, indexed by the key: // This prints the value associated with the key "country". cout << kvl.val("country") << endl; // An error is given if the key doesn't exist: cout << kvl.val("state") << endl; // This can be turned off by use of a flag. In this case the default // value is returned. cout << kvl.val("state", 0) << endl; // A on-the fly default value can be specified by putting using the // val_def function: cout << kvl.val_def("state", "unknown") << endl; // present() returns true of the key exists: if (kvl.present("state")) cout << kvl.val("state") << endl; //@} } speech_tools/testsuite/handle_regression.cc0000644000076400007640000000614410127000721017707 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Wed Mar 18 1998 */ /* */ /* -------------------------------------------------------------------- */ /* Example of using the THandle reference counted pointer type. */ /* */ /*************************************************************************/ #include #include #include "EST_THandle.h" #include "EST_String.h" int main(void) { return 0; } speech_tools/testsuite/named_enum_regression.cc0000644000076400007640000001173210127000721020563 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Apr 29 1997 */ /************************************************************************/ /* */ /* Regression test for named enum type. */ /* */ /************************************************************************/ #include #include "EST_TNamedEnum.h" #include "EST_String.h" // #if defined(__GNUC__) // # define InfoType EST_String // #else # define InfoType const char * // #endif typedef enum { c_red=1, c_blue=2, c_green=3, c_unknown=666} Colour; Start_TNamedEnumI(Colour, InfoType, ColourMap) { c_unknown, {"grey"}, "Xenon"}, { c_red, {"red", "scarlet"}, "Mercury"}, { c_blue, {"blue", "navy", "sad"}, "Steel"}, { c_unknown, {"UNKNOWN COLOUR"}, "x"} End_TNamedEnumI(Colour, InfoType, ColourMap) typedef void (*PrintFn)(void); void print_q(void) { cout << "???\n"; } void print_1(void) { cout << "111\n"; } void print_2(void) { cout << "222\n"; } void print_3(void) { cout << "333\n"; } Start_TValuedEnum(Colour, PrintFn, FnColourMap) { c_unknown, {print_q}}, { c_red, {print_1, print_3}}, { c_blue, {print_2}}, { c_unknown, {NULL}} End_TValuedEnum(Colour, PrintFn, FnColourMap) int main(void) { Colour c1 = c_red; Colour c2 = c_green; Colour c3 = c_blue; const char *n; n = ColourMap.name(c1); cout << "c1 is " << (n?n:"[NULL]") << " " << (n?EST_String(ColourMap.info(c1)):EST_String("[NULL]")) << "\n"; n = ColourMap.name(c2); cout << "c2 is " << (n?n:"[NULL]") << "\n"; n = ColourMap.name(c3); cout << "c3 is " << (n?n:"[NULL]") << " " << (n?EST_String(ColourMap.info(c3)):EST_String("[NULL]")) << "\n"; PrintFn fn; cout << "print_3 "; if ((fn = FnColourMap.value(FnColourMap.token(print_3)))) (*fn)(); else cout << "---\n"; cout << "print_2 "; if ((fn = FnColourMap.value(FnColourMap.token(print_2)))) (*fn)(); else cout << "---\n"; cout << "c1 "; if ((fn = FnColourMap.value(c1))) (*fn)(); else cout << "---\n"; cout << "c2 "; if ((fn = FnColourMap.value(c2))) (*fn)(); else cout << "---\n"; cout << "c_unknown "; if ((fn = FnColourMap.value(c_unknown))) (*fn)(); else cout << "---\n"; exit(0); } #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TNamedEnum.cc" Instantiate_TNamedEnumI(Colour, InfoType) Instantiate_TValuedEnum(Colour, PrintFn) #endif speech_tools/testsuite/deq_regression.cc0000644000076400007640000000563210127000721017226 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jul 22 1997 */ /* --------------------------------------------------------------------- */ /* Regression test for list class. */ /* */ /*************************************************************************/ #include #include #include "EST_TDeque.h" #include "EST_String.h" int main(void) { return 0; } speech_tools/testsuite/ling_regression.cc0000644000076400007640000000570207262605664017433 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #include "EST_unix.h" #include "EST_ling_class.h" #include "ling_class/EST_item_aux.h" #if defined(DATAC) # define __STRINGIZE(X) #X # define DATA __STRINGIZE(DATAC) #endif /** @name Example Code */ //@{ int main(void) { EST_Utterance u; EST_Item *i; u.load(DATA "/ked_wr1_012.utt"); EST_Relation *ss = u.relation("SylStructure"); for(i = ss->head(); i!=NULL; i = next_item(i)) { EST_feat_status status; EST_String name = getString(*i, "name", EST_String::Empty, status); cout << "Name=" << name << "\n"; } exit(0); } //@} speech_tools/testsuite/feature_regression.cc0000644000076400007640000001621010044502523020107 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #include "EST_unix.h" #include "EST_ling_class.h" /** @name Feature and Val Classes Example Code */ //@{ int main(void) { /** @name Adding basic information to an EST_Item * * An item such as * * is constructed as follows: (note that * the attributes are in capitals by linguistic convention only: * attribute names are case sensitive and can be upper or lower * case). */ //@{ //@{ code EST_Item p; p.set("POS", "Noun"); p.set("NAME", "example"); p.set("FOCUS", "+"); p.set("DURATION", 2.76); p.set("STRESS", 2); //@} code /** The type of the values in features is a * EST_Val class, which is a union which can * store ints, floats, EST_Strings, void pointers, and * EST_Features. The overloaded function * facility of C++ means that the set() can be * used for all of these. */ //@} /** @name Accessing basic information in an Item * * When accessing the features, the type must be * specified. This is done most easily by using of a series of * functions whose type is coded by a capital letter: * * <function>F()</function> return value as a * float * <function>I()</function> return value as a * integer * <function>S()</function> return value as a * <function>A()</function> return value as a * EST_Features * */ //@{ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Duration for p is " << p.F("DURATION") << endl; cout << "Stress value for p is " << p.I("STRESS") << endl; //@} code /** * * Output * * "Noun" * 2.75 * 1 * * * * A optional default value can be given if a result is always desired */ //@{ code cout << "Part of speech for p is " << p.S("POS") << endl; cout << "Syntactic Category for p is " << p.S("CAT", "Noun") << endl; // noerror //@} code //@} /** @name Nested feature structures in items * * Nested feature structures such as * * Example eq11 * * * can be created in a number of ways: */ //@{ //@{ code p.set("NAME", "d"); p.set("VOICE", "+"); p.set("CONTINUANT", "-"); p.set("SONORANT", "-"); EST_Features f; p.set("PLACE OF ARTICULATION", f); // copy in empty feature set here p.A("PLACE OF ARTICULATION").set("CORONAL", "+"); p.A("PLACE OF ARTICULATION").set("ANTERIOR", "+"); //@} code /** or by filling the values in an EST_Features object and * copying it in: */ //@{ code EST_Features f2; f2.set("CORONAL", "+"); f2.set("ANTERIOR", "+"); p.set("PLACE OF ARTICULATION", f2); //@} code /** Nested features can be accessed by multiple calls to the * accessing commands: */ //@{ code cout << "Anterior value is: " << p.A("PLACE OF ARTICULATION").S("ANTERIOR"); cout << "Coronal value is: " << p.A("PLACE OF ARTICULATION").S("CORONAL"); //@} code /** The first command is A() because PLACE is a * feature structure, and the second command is * S() because it returns a string (the * value or ANTRIOR or CORONAL). A shorthand is provided to * extract the value in a single statement: */ //@{ code cout << "Anterior value is: " << p.S("PLACE OF ARTICULATION.ANTERIOR"); cout << "Coronal value is: " << p.S("PLACE OF ARTICULATION.CORONAL"); //@} code /** Again, as the last value to be returned is a string * S() must be used. This shorthand can also be used * to set the features: */ //@{ code p.set("PLACE OF ARTICULATION.CORONAL", "+"); p.set("PLACE OF ARTICULATION.ANTERIOR", "+"); //@} code /** this is the easiest and most commonly used method. */ //@} /** @name Utility functions for items * * The presence of a attribute can be checked using * f_present(), which returns true if the * attribute is in the item: */ //@{ //@{ code cout << "This is true: " << p.f_present("PLACE OF ARTICULATION"); cout << "This is false: " << p.f_present("MANNER"); //@} code /** A attribute can be removed by f_remove */ //@{ code p.f_remove("PLACE OF ARTICULATION"); //@} code //@} exit(0); } //@} speech_tools/testsuite/ch_wave.sh0000644000076400007640000002166310005561444015671 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### CH_WAVE=$TOP/bin/ch_wave BCAT=$TOP/bin/bcat test_conversion () { type=$1 echo "$type " >&2 /bin/rm -f tmp/ch_wave.wav tmp/ch_wave.nist $CH_WAVE -otype $type "$DATA"/ch_wave.wav -o tmp/ch_wave.wav || exit 1 $CH_WAVE -obo MSB -otype nist tmp/ch_wave.wav -o tmp/ch_wave.nist || exit 1 if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave nist to $type to nist: pass else echo ch_wave nist to $type to nist: fail fi } test_raw () { echo raw >&2 SAMPLE_RATE=`$CH_WAVE -info "$DATA"/ch_wave.wav | awk '{if ($1 == "Sample") print $3}'` $CH_WAVE -otype raw "$DATA"/ch_wave.wav -o tmp/ch_wave.raw $CH_WAVE -itype raw -istype short -f $SAMPLE_RATE tmp/ch_wave.raw -otype nist -ostype short -obo MSB -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave raw binary test: pass else echo ch_wave raw binary test: fail fi $CH_WAVE -otype raw -ostype ascii "$DATA"/ch_wave.wav -o tmp/ch_wave.raw $CH_WAVE -itype raw -istype ascii -f $SAMPLE_RATE tmp/ch_wave.raw -otype nist -obo MSB -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave raw ascii test: pass else echo ch_wave raw ascii test: fail fi } test_byte_order () { # Test byte order echo byte order >&2 SAMPLE_RATE=`$CH_WAVE -info "$DATA"/ch_wave.wav | awk '{if ($1 == "Sample") print $3}'` $CH_WAVE -obo MSB -otype raw "$DATA"/ch_wave.wav -o tmp/ch_wave.raw || exit 1 dd if=tmp/ch_wave.raw conv=swab of=tmp/ch_wave.swab $CH_WAVE -ibo LSB -itype raw -istype short -f $SAMPLE_RATE tmp/ch_wave.swab -obo MSB -otype nist -o tmp/ch_wave.raw || exit 1 if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave byte order test: pass else echo ch_wave byte order test: fail fi } test_stdio () { echo stdio >&2 $CH_WAVE -otype snd "$DATA"/ch_wave.wav | $CH_WAVE - -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave stdio test1: pass else echo ch_wave stdio test1: fail fi $CH_WAVE -otype riff "$DATA"/ch_wave.wav | $CH_WAVE -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave stdio test2: pass else echo ch_wave stdio test2: fail fi $CH_WAVE -otype nist -obo nonnative "$DATA"/ch_wave.wav -o - | $CH_WAVE -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave stdio test3: pass else echo ch_wave stdio test3: fail fi $CH_WAVE -otype esps -obo nonnative "$DATA"/ch_wave.wav -o - >tmp/ch_wave.esps cat tmp/ch_wave.esps | $CH_WAVE - -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave stdio test4: pass else echo ch_wave stdio test4: fail fi } test_subwaves () { # cut the file up and put it back together again echo subrange >&2 SAMPLE_RATE=`$CH_WAVE -info "$DATA"/ch_wave.wav | awk '{if ($1 == "Sample") print $3}'` $CH_WAVE -otype raw -from 0 -to 8073 "$DATA"/ch_wave.wav -o tmp/ch_wave.raw.1 $CH_WAVE -otype raw -from 8073 -to 16146 "$DATA"/ch_wave.wav -o tmp/ch_wave.raw.2 $BCAT tmp/ch_wave.raw.1 tmp/ch_wave.raw.2 -o tmp/ch_wave.cat $CH_WAVE tmp/ch_wave.cat -itype raw -istype short -f $SAMPLE_RATE -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave subwave test1: pass else echo ch_wave subwave test1: fail fi $CH_WAVE -otype raw -from 0 -to 10 "$DATA"/ch_wave.wav -o tmp/ch_wave.raw.1 $CH_WAVE -otype raw -from 10 -to 8073 "$DATA"/ch_wave.wav -o tmp/ch_wave.raw.2 $CH_WAVE -otype raw -from 8073 -to 16146 "$DATA"/ch_wave.wav -o tmp/ch_wave.raw.3 $BCAT tmp/ch_wave.raw.1 tmp/ch_wave.raw.2 tmp/ch_wave.raw.3 -o tmp/ch_wave.cat $CH_WAVE tmp/ch_wave.cat -itype raw -istype short -f $SAMPLE_RATE -obo MSB -otype nist -o tmp/ch_wave.nist if cmp "$DATA"/ch_wave.wav tmp/ch_wave.nist then echo ch_wave subwave test2: pass else echo ch_wave subwave test2: fail fi } test_channels () { # cut the file up and put it back together again echo channels >&2 SAMPLE_RATE=`$CH_WAVE -info "$DATA"/ch_wave.wav | awk '{if ($1 == "Sample") print $3}'` $CH_WAVE -from 10 -to 8073 "$DATA"/ch_wave.wav -otype nist -o tmp/ch_wave.t1 $CH_WAVE -from 8073 -to 8083 "$DATA"/ch_wave.wav -otype nist -o tmp/ch_wave.t2 $CH_WAVE tmp/ch_wave.t2 tmp/ch_wave.t1 "$DATA"/ch_wave.wav -otype nist -o tmp/ch_wave.nist $CH_WAVE -from 10 -to 8073 tmp/ch_wave.nist -otype nist -o tmp/ch_wave.t2 if cmp tmp/ch_wave.t1 tmp/ch_wave.t2 then echo ch_wave concat : pass else echo ch_wave concat : fail fi $CH_WAVE -pc longest "$DATA"/ch_wave.wav tmp/ch_wave.nist -o tmp/ch_wave.tc1 $CH_WAVE -from 10 -to 8073 tmp/ch_wave.tc1 -otype nist -o tmp/ch_wave.tc2 $CH_WAVE -c 0 tmp/ch_wave.tc2 -otype nist -o tmp/ch_wave.tc3 $CH_WAVE -from 10 -to 8073 "$DATA"/ch_wave.wav -otype nist -o tmp/ch_wave.tc4 if cmp tmp/ch_wave.tc4 tmp/ch_wave.tc3 then echo ch_wave channel combine/extract : pass else echo ch_wave channel combine/extract : fail fi } test_defft () { echo default file type >&2 # the following shouldn't complain $CH_WAVE -lpfilter 3000 -forder 19 "$DATA"/ch_wave.wav -o tmp/ch_wave.wav $CH_WAVE "$DATA"/ch_wave.wav -obo MSB -o tmp/ch_wave.wav if cmp "$DATA"/ch_wave.wav tmp/ch_wave.wav then echo ch_wave default file type: pass else echo ch_wave default file type: fail fi } test_keylab() { echo keylab divide and extract >&2 (cd tmp; ../$CH_WAVE -divide -key "$DATA"/key.lab "$DATA"/ch_wave.wav -otype nist -ext .wav) $CH_WAVE -info tmp/w*.wav (cd tmp; ../$CH_WAVE -extract w2 -key "$DATA"/key.lab "$DATA"/ch_wave.wav -otype nist -o w2.w2) if cmp tmp/w2.wav tmp/w2.w2 then echo ch_wave key extract : pass else echo ch_wave ket extract : fail fi } test_info () { echo info and help >&2 $CH_WAVE -info "$DATA"/ch_wave.wav $CH_WAVE -h $CH_WAVE -F 20000 "$DATA"/ch_wave.wav -o tmp/ch_wave.nist $CH_WAVE -F 8000 tmp/ch_wave.nist -o tmp/ch_wave.nist8 $CH_WAVE -info "$DATA"/ch_wave.wav tmp/ch_wave.nist tmp/ch_wave.nist8 } echo >$OUTPUT test_conversion esps 2>&1 >> $OUTPUT test_conversion snd 2>&1 >> $OUTPUT test_conversion riff 2>&1 >> $OUTPUT test_conversion audlab 2>&1 >> $OUTPUT test_conversion aiff 2>&1 >> $OUTPUT test_conversion est 2>&1 >> $OUTPUT test_raw 2>&1 >> $OUTPUT test_byte_order 2>&1 >> $OUTPUT test_stdio 2>&1 >> $OUTPUT test_subwaves 2>&1 >> $OUTPUT test_channels 2>&1 >> $OUTPUT test_defft 2>&1 >> $OUTPUT test_keylab 2>&1 >> $OUTPUT test_info 2>&1 >> $OUTPUT exit 0 speech_tools/testsuite/ch_track.sh0000644000076400007640000000776410005561513016036 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### CH_TRACK=$TOP/bin/ch_track DATA=../lib/example_data set -x test_conversions () { echo conversion >&2 /bin/rm -f tmp/ch_track.htk tmp/ch_track.track # Get htk version with basic header $CH_TRACK -otype htk "$DATA"/ch_track.htk -o tmp/ch_track.htk || exit 1 $CH_TRACK -otype esps tmp/ch_track.htk -o tmp/ch_track.track || exit 1 $CH_TRACK -otype htk tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1 if cmp tmp/ch_track.htk tmp/ch_track.htk2 then echo ch_track htk to esps to nist: pass else echo ch_track htk to esps to nist: fail fi $CH_TRACK -otype ascii tmp/ch_track.htk -o tmp/ch_track.track || exit 1 $CH_TRACK -itype ascii -s 0.010 -otype htk_fbank tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1 $CH_TRACK -otype ascii tmp/ch_track.htk2 -o tmp/ch_track.ascii || exit 1 if cmp tmp/ch_track.track tmp/ch_track.ascii then echo ch_track htk to ascii to htk: pass else echo ch_track htk to ascii to htk: fail fi $CH_TRACK -otype htk "$DATA"/ch_track.htk -o tmp/ch_track.htk || exit 1 $CH_TRACK -otype htk_user tmp/ch_track.htk -o tmp/ch_track.track || exit 1 $CH_TRACK -otype htk tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1 if cmp tmp/ch_track.htk tmp/ch_track.htk2 then echo ch_track htk to htk_user to htk: pass else echo ch_track htk to htk_user to htk: fail fi } test_info () { echo info and help >&2 $CH_TRACK -info "$DATA"/ch_track.htk $CH_TRACK -h $CH_TRACK "$DATA"/ch_track.htk -otype esps -o tmp/ch_track.esps $CH_TRACK -info "$DATA"/ch_track.htk tmp/ch_track.esps } echo >$OUTPUT test_conversions 2>&1 >> $OUTPUT test_info 2>&1 >> $OUTPUT exit 0 speech_tools/testsuite/viterbi.sh0000644000076400007640000000504310005561645015716 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### $TOP/bin/viterbi -ngram "$DATA/vit.B.ngram" \ "$DATA/vit.observes" \ -vocab "$DATA/vit.vocab" \ -prev_tag B \ -prev_prev_tag NB > $OUTPUT exit $? speech_tools/testsuite/wagon.sh0000644000076400007640000000546107262605664015404 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### WAGON=$TOP/bin/wagon DATA=../lib/example_data regress_tree () { echo "regression tree" >&2 /bin/rm -f tmp/wagon.tree $WAGON -desc $DATA/wagon.desc -data $DATA/wagon.data -output tmp/wagon.tree -stop 5 -quiet || exit 1 if diff $DATA/wagon.tree tmp/wagon.tree then echo wagon standard cart tree: pass else echo wagon standard cart tree: fail fi } echo >$OUTPUT regress_tree 2>&1 >> $OUTPUT exit 0 speech_tools/testsuite/tilt.sh0000644000076400007640000000657510067560447015250 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### PDA=$TOP/bin/pda TILT_ANALYSIS=$TOP/bin/tilt_analysis TILT_SYNTHESIS=$TOP/bin/tilt_synthesis CH_TRACK=$TOP/bin/ch_track DATA=$TOP/lib/example_data tilt_test () { /bin/rm -f tmp/kdt_001.f0 /bin/rm -f tmp/kdt_001.tilt /bin/rm -f tmp/kdt_001.tilt.f0 echo "F0 extraction" >&2 $PDA -shift 0.01 -o tmp/kdt_001.f0 -otype esps -fmax 180 -fmin 80 $DATA/kdt_001.wav $CH_TRACK -info tmp/kdt_001.f0 echo echo "Tilt analysis" >&2 $TILT_ANALYSIS -smooth -otype tilt -e $DATA/kdt_001.il tmp/kdt_001.f0 -w1 0.05 -w2 0.05 -o tmp/kdt_001.tilt -event_names "a afb" # Floats are different on different machines, do a hack to cover # Sun and Intel, may work for others too sed 's/0.0269821/0.026982/' tmp/kdt_001.tilt | diff - $DATA/kdt_001.tilt echo "Tilt synthesis" >&2 $TILT_SYNTHESIS tmp/kdt_001.tilt -o tmp/kdt_001.tilt.f0 -otype esps -event_names "a afb" $CH_TRACK -info tmp/kdt_001.tilt.f0 echo } echo >$OUTPUT echo Tilt Test no Longer run >>$OUTPUT #tilt_test 2>&1 >> $OUTPUT exit 0 speech_tools/testsuite/lpc.sh0000644000076400007640000000716310005561256015033 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### SIG2FV=$TOP/bin/sig2fv SIGFILTER=$TOP/bin/sigfilter CH_TRACK=$TOP/bin/ch_track CH_WAVE=$TOP/bin/ch_wave DATA=$TOP/lib/example_data lpc_test () { /bin/rm -f tmp/kdt_001.lpc /bin/rm -f tmp/kdt_001.res echo "LPC params" >&2 echo "LPC params" $SIG2FV "$DATA/kdt_001.wav" -o tmp/kdt_001.lpc -otype est -lpc_order 16 -coefs "lpc" -pm "$DATA/kdt_001.pm" -preemph 0.95 -factor 3 -window_type hamming $SIGFILTER "$DATA/kdt_001.wav" -o tmp/kdt_001.res -otype nist -lpcfilter tmp/kdt_001.lpc -inv_filter $CH_TRACK -info tmp/kdt_001.lpc $CH_WAVE -info tmp/kdt_001.res # Should not be any of these unless there is an error grep "0.000000" tmp/kdt_001.lpc grep "NaN" tmp/kdt_001.lpc grep -i "Infinity" tmp/kdt_001.lpc } mfcc_test () { /bin/rm -f tmp/kdt_001.mfcc echo "MFCC params" >&2 echo "MFCC params" $SIG2FV -coefs melcep -delta melcep -melcep_order 12 -fbank_order 24 -shift 0.005 -factor 5.0 -preemph 0.97 -otype est "$DATA/kdt_001.wav" -o tmp/kdt_001.mfcc $CH_TRACK -info tmp/kdt_001.mfcc echo "expect one line containing 0s (first delta params)" numzeros=`grep "0.000000" tmp/kdt_001.mfcc | wc -l` echo "Number of vectors with 0s is " $numzeros } echo >$OUTPUT lpc_test 2>&1 >> $OUTPUT mfcc_test 2>&1 >> $OUTPUT exit 0 speech_tools/testsuite/sigpr_example.cc0000644000076400007640000005211210127000721017047 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Paul Taylor (pault@cstr.ed.ac.uk) */ /* Date: Fri May 9 1997 */ /* ------------------------------------------------------------------- */ /* Examples of Generation of Acoustic Feature Vectors from Waveforms */ /* */ /************************************************************************/ #include #include "EST_sigpr.h" #include "EST_cmd_line.h" #include "EST_inline_utils.h" #include "EST_sigpr.h" /**@name Signal processing example code * * @toc */ //@{ EST_StrList empty; void print_map(EST_TrackMap &t); void print_track_map(EST_Track &t); int main(void) { EST_StrList base_list; // decl EST_StrList delta_list; // decl EST_StrList acc_list; // decl EST_Option op, al; // decl init_lib_ops(al, op); EST_Wave sig; // decl EST_Track fv, part; // decl float shift; // decl int i; cout << "position 1\n"; /**@name Producing a single type of feature vector for an utterance A number of types of signal processing can be performed by the sig2coef function. The following code demonstrates a simple case of calculating the linear prediction (LP) coefficients for a waveform. First set the order of the lpc analysis to 16 (this entails 17 actual coefficients) and then load in the waveform to be analysed. */ //@{ //@{ code int lpc_order = 16; sig.load(DATA "/kdt_001.wav"); //@} code /** Now allocate enough space in the track to hold the analysis. The following command resizes fv to have enough frames for analysis frames at 0.01 intervals up to the end of the waveform, (sig.end()), and enough channels to store lpc_order + 1 coefficients. The channels are named so as to take lpc coefficients. */ //@{ code int num_frames; num_frames = (int)ceil(sig.end() / 0.01); fv.resize(num_frames, lpc_order + 1); //@} code /** The positions of the frames, corresponding to the middel of their analysis window also needs to be set. For fixed frame analysis, this can be done with the fill_time() function: */ //@{ code fv.fill_time(0.01); //@} code /** The simplest way to do the actual analysis is as follows, which will fill the track with the values from the LP analysis using the default processing controls. */ //@{ code sig2coef(sig, fv, "lpc"); //@} code /** In this style of analysis, default values are used to control the windowing mechanisms which split the whole signal into frames. Specifically, each frame is defined to start a certain distance before the time interval, and extending the same distance after. This distance is calculated as a function of the local window spacing and can be adjusted as follows: Extending one time period before and one time period after the current time mark: */ //@{ code sig2coef(sig, fv, "lpc", 2.0); //@} code /** Extending 1.5 time periods before and after the current time mark, etc; */ //@{ code sig2coef(sig, fv, "lpc", 3.0); //@} code /** The type of windowing function may be changed also as this can be passed in as an optional argument. First we create a window function (This is explained more in \Ref{Windowing}). */ //@{ code EST_WindowFunc *wf = EST_Window::creator("hamming"); //@} code /** and then pass it in as the last argument */ //@{ code sig2coef(sig, fv, "lpc", 3.0, wf); //@} code //@} /**@name Pitch-Synchronous vs fixed frame analysis. Most of the core signal processing functions operate on individual frames of speech and are oblivious as to how these frames were extracted from the original speech. This allows us to take the frames from anywhere in the signal: specifically, this facilitates two common forms of analysis: fixed frame The time points are space at even intervals throughout the signal. pitch-synchronous The time points represent pitchmarks and correspond to a specific position in each pitch period, e.g. the instant of glottal closure. It is a simple matter to fill the time array, but normally pitchmarks are read from a file or taken from another signal processing algorithm (see \Ref{Pitchmark functions.}). There are many ways to fill the time array for fixed frame analysis. manually: */ //@{ //@{ code int num_frames = 300; fv.resize(num_frames, lpc_order + 1); shift = 0.01; // time interval in seconds for (i = 0; i < num_frames; ++i) fv.t(i) = shift * (float) i; //@} code /** or by use of the member function \Ref{EST_Track::fill_time} */ //@{ code fv.fill_time(0.01); //@} code /** Pitch synchronous values can simply be read from pitchmark files: */ //@{ code fv.load(DATA "/kdt_001.pm"); make_track(fv, "lpc", lpc_order + 1); //@} code /** Regardless of how the time points where obtain, the analysis function call is just the same: */ //@{ code sig2coef(sig, fv, "lpc"); //@} code //@} cout << "position 3\n"; /**@name Naming Channels @id sigpr-example-naming-channels Multiple types of feature vector can be stored in the same Track. Imagine that we want lpc, cepstrum and power coefficients in that order in a track. This can be achieved by using the \Ref{sig2coef} function multiple times, or by the wrap around \Ref{sigpr_base} function. It is vitally important here to ensure that before passing the track to the signal processing functions that it has the correct number of channels and that these are appropriately named. This is most easily done using the track map facility, explained in Naming Channels For each call, we only us the part of track that is relevant. The sub_track member function of \Ref{EST_Track} is used to get this. In the following example, we are assuming here that fv has sufficient space for 17 lpc coefficients, 8 cepstrum coefficients and power and that they are stored in that order. */ //@{ //@{ code int cep_order = 16; EST_StrList map; map.append("$lpc-0+" Stringtoi(lpc_order)); map.append("$cepc-0+" Stringtoi(cep_order)); map.append("power"); fv.resize(EST_CURRENT, map); //@} code /** An alternative is to use add_channels_to_map() which takes a list of coefficient types and makes a map. The order of each type of processing is extracted from op. */ //@{ code EST_StrList coef_types; coef_types.append("lpc"); coef_types.append("cep"); coef_types.append("power"); map.clear(); add_channels_to_map(map, coef_types, op); fv.resize(EST_CURRENT, map); //@} code /** After allocating the right number of frames and channels in {\tt fv}, we extract a sub_track, which has all the frames (i.e. between 0 and EST_ALL) and all the lpc channels */ //@{ code fv.sub_track(part, 0, EST_ALL, 0, "lpc_0", "lpc_N"); //@} code /** now call the signal processing function on this part: */ //@{ code sig2coef(sig, part, "lpc"); //@} code /** We repeat the procedure for the cepstral coefficients, but this time take the next 8 channels (17-24 inclusive) and calculate the coefficients: */ //@{ code fv.sub_track(part, 0, EST_ALL, "cep_0", "cep_N"); sig2coef(sig, part, "cep"); //@} code /** Extract the last channel for power and call the power function: */ //@{ code fv.sub_track(part, 0, EST_ALL, "power", 1); power(sig, part, 0.01); //@} code /** While the above technique is adequate for our needs and is a useful demonstration of sub_track extraction, the \Ref{sigpr_base} function is normally easier to use as it does all the sub track extraction itself. To perform the lpc, cepstrum and power analysis, we put these names into a StrList and call \Ref{sigpr_base}. */ //@{ code base_list.clear(); // empty the list, just in case base_list.append("lpc"); base_list.append("cep"); base_list.append("power"); sigpr_base(sig, fv, op, base_list); //@} code /** This will call \Ref{sigpr_track} as many times as is necessary. */ //@} /**@name Producing delta and acceleration coefficients Delta coefficients represent the numerical differentiation of a track, and acceleration coefficients represent the second order numerical differentiation. By convention, delta coefficients have a "_d" suffix and acceleration coefficients "_a". If the coefficient is multi-dimensional, the numbers go after the "_d" or "_a". */ //@{ //@{ code map.append("$cep_d-0+" Stringtoi(cep_order)); // add deltas map.append("$cep_a-0+" Stringtoi(cep_order)); // add accs fv.resize(EST_CURRENT, map); // resize the track. //@} code /** Given a EST_Track of coefficients {\tt fv}, the \Ref{delta} function is used to produce the delta equivalents {\tt del}. The following uses the track allocated above and generates a set of cepstral coefficients and then makes their delta and acc: */ //@{ code EST_Track del, acc; fv.sub_track(part, 0, EST_ALL, 0, "cep_0", "cep_N"); // make subtrack of coefs sig2coef(sig, part, "cep"); // fill with cepstra // make subtrack of deltas fv.sub_track(del, 0, EST_ALL, 0, "cep_d_0", "cep_d_N"); delta(part, del); // calculate deltas of part, and place answer in del // make subtrack of accs fv.sub_track(acc, 0, EST_ALL, 0, "cep_a_0", "cep_a_N"); delta(del, acc); // calculate deltas of del, and place answer in acc //@} code /** It is possible to directly calculate the delta coefficients of a type of coefficient, even if we don't have the base type. \Ref{sigpr_delta} will process the waveform, make a temporary track of the required type "lpc" and calculate the delta of this. The following makes a set of delta reflection coefficients: */ //@{ code map.append("$ref_d-0+" Stringtoi(lpc_order)); // add to map fv.resize(EST_CURRENT, map); // resize the track. sigpr_delta(sig, fv, op, "ref"); //@} code /** an equivalent function exists for acceleration coefficients: */ //@{ code map.append("$lsf_a-0+" Stringtoi(lpc_order)); // add acc lsf fv.resize(EST_CURRENT, map); // resize the track. sigpr_acc(sig, fv, op, "ref"); //@} code //@} /**@name Windowing The \Ref{EST_Window} class provides a variety of means to divide speech into frames using windowing mechanisms. A window function can be created from a window name using the \Ref{EST_Window::creator} function: */ //@{ //@{ code EST_WindowFunc *hamm = EST_Window::creator("hamming"); EST_WindowFunc *rect = EST_Window::creator("rectangular"); //@} code /** This function can then be used to create a EST_TBuffer of window values. In the following example the values from a 256 point hamming window are stored in the buffer win_vals: */ //@{ code EST_FVector frame; EST_FVector win_vals; hamm(256, win_vals); //@} code /** The make_window function also creates a window: */ //@{ code EST_Window::make_window(win_vals, 256, "hamming",-1); //@} code /** this can then be used to make a frame of speech from the main EST_Wave sig. The following example extracts speech starting at sample 1000: */ //@} code for (i = 0; i < 256; ++i) frame[i] = (float)sig.a(i + 1000) * win_vals[i]; //@} code /** Alternatively, exactly the same operation can be performed in a single step by passing the window function to the \Ref{EST_Window::window_signal} function which takes a \Ref{EST_Wave} and performs windowing on a section of it, storing the output in the \Ref{EST_FVector} {\tt frame}. */ //@{ code EST_Window::window_signal(sig, hamm, 1000, 256, frame, 1); //@} code /** The window function need not be explicitly created, the window signal can work on just the name of the window type: */ //@{ code EST_Window::window_signal(sig, "hamming", 1000, 256, frame, 1); //@} code //@} /**@name Frame based signal processing @id sigpr-example-frames The signal processing library provides an extensive set of functions which operate on a single frame of coefficients. The following example shows one method of splitting the signal into frames and calling a signal processing algorithm. First set up the track for 16 order LP analysis: */ //@{ //@{ code map.clear(); map.append("$lpc-0+16"); fv.resize(EST_CURRENT, map); //@} code /** In this example, we take the analysis frame length to be 256 samples long, and the shift in samples is just the shift in seconds times the sampling frequency. */ //@{ code int s_length = 256; int s_shift = int(shift * float(sig.sample_rate())); EST_FVector coefs; //@} code /** Now we set up a loop which calculates the frames one at a time. {\tt start} is the start position in samples of each frame. The \Ref{EST_Window::window_signal} function is called which makes a \Ref{EST_FVector} frame of the speech via a hamming window. Using the \Ref{EST_Track::frame} function, the EST_FVector {\tt coefs} is set to frame {\tt k} in the track. It is important to understand that this operation involves setting an internal smart pointer in {\tt coefs} to the memory of frame {\tt k}. This allows the signal processing function \Ref{sig2lpc} to operate on an input and output \Ref{EST_FVector}, without any copying to or from the main track. After the \Ref{sig2lpc} call, the kth frame of {\tt fv} is now filled with the LP coefficients. */ //@{ code for (int k1 = 0; k1 < fv.num_frames(); ++k1) { int start = (k1 * s_shift) - (s_length/2); EST_Window::window_signal(sig, "hamming", start, s_length, frame, 1); fv.frame(coefs, k1); // Extract a single frame sig2lpc(frame, coefs); // Pass this to actual algorithm } //@} code /** A slightly different tack can be taken for pitch-synchronous analysis. Setting up fv with the pitchmarks and channels: */ //@{ code fv.load(DATA "/kd1_001.pm"); fv.resize(EST_CURRENT, map); //@} code /** Set up as before, but this time calculate the window starts and lengths from the time points. In this example, the length is a {\tt factor} (twice) the local frame shift. Note that the only difference between this function and the fixed frame one is in the calculation of the start and end points - the windowing, frame extraction and call to \Ref{sig2lpc} are exactly the same. */ //@{ code float factor = 2.0; for (int k2 = 0; k2 < fv.num_frames(); ++k2) { s_length = irint(get_frame_size(fv, k2, sig.sample_rate())* factor); int start = (irint(fv.t(k2) * sig.sample_rate()) - (s_length/2)); EST_Window::window_signal(sig, wf, start, s_length, frame, 1); fv.frame(coefs, k2); sig2lpc(frame, coefs); } //@} code //@} /**@name Filtering In the EST library we so far have two main types of filter, {\bf finite impulse response (FIR)} filters and {\bf linear prediction (LP)} filters. {\bf infinite impulse response (IIR)} filters are not yet implemented, though LP filters are a special case of these. Filtering involves 2 stages: the design of the filter and the use of this filter on the waveform. First we examine a simple low-pass filter which attempts to suppress all frequencies about a cut-off. Imagine we want to low pass filter a signal at 400Hz. First we design the filter: */ //@{ //@{ code EST_FVector filter; int freq = 400; int filter_order = 99; filter = design_lowpass_FIR_filter(sig.sample_rate(), 400, 99); //@} code /** And now use this filter on the signal: */ //@{ code FIRfilter(sig, filter); //@} code /** For one-off filtering operations, the filter design can be done in the filter function itself. The \Ref{FIRlowpass_filter} function takes the signal, cut-off frequency and order as arguments and designs the filter on the fly. Because of the overhead of filter design, this function is expensive and should only be used for one-off operations. */ //@{ code FIRlowpass_filter(sig, 400, 99); //@} code /** The equivalent operations exist for high-pass filtering: */ //@{ code filter = design_highpass_FIR_filter(sig.sample_rate(), 50, 99); FIRfilter(sig, filter); FIRhighpass_filter(sig, 50, 99); //@} code /** Filters of arbitrary frequency response can also be designed using the \Ref{design_FIR_filter} function. This function takes a EST_FVector of order $2^{N}$ which specifies the desired frequency response up to 1/2 the sampling frequency. The function returns a set of filter coefficients that attempt to match the desired reponse. */ //@{ code EST_FVector response(16); response[0] = 1; response[1] = 1; response[2] = 1; response[3] = 1; response[4] = 0; response[5] = 0; response[6] = 0; response[7] = 0; response[8] = 1; response[9] = 1; response[10] = 1; response[11] = 1; response[12] = 0; response[13] = 0; response[14] = 0; response[15] = 0; filter = design_FIR_filter(response, 15); FIRfilter(sig, response); //@} code /**The normal filtering functions can cause a time delay in the filtered waveform. To attempt to eliminate this, a set of double filter function functions are provided which guarantees zero phase differences between the original and filtered waveform. */ //@{ code FIRlowpass_double_filter(sig, 400); FIRhighpass_double_filter(sig, 40); //@} code /** Sometimes it is undesirable to have the input signal overwritten. For these cases, a set of parallel functions exist which take a input waveform for reading and a output waveform for writing to. */ //@{ code EST_Wave sig_out; FIRfilter(sig, sig_out, response); FIRlowpass_filter(sig, sig_out, 400); FIRhighpass_filter(sig, sig_out, 40); //@} code //@} } //@} speech_tools/testsuite/sigpr_regression.cc0000644000076400007640000000706107262605664017626 0ustar awbawb/************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* */ /* Author: Paul Taylor (pault@cstr.ed.ac.uk) */ /* Date: Fri May 9 1997 */ /* ------------------------------------------------------------------- */ /* Examples of Generation of Acoustic Feature Vectors from Waveforms */ /* */ /************************************************************************/ #include "EST_sigpr.h" /**@name sig2fv:example * * Some examples of track manipulations. * * @see EST_Track * @see EST_TrackMap:example * @see EST_TMatrix * @see EST_TMatrix:example */ //@{ int main(void) { /* EST_StrList base_list; EST_StrList delta_list; EST_StrList acc_list; //@{ code // read in a waveform EST_Wave sig; EST_Wave fv; float shift = 0.01; float length = 0.02; sig.load("kdt_001.wav"); // using fixed frame analysis first: // lets do simple lpc analysis base_list.append("lpc"); // call fixed function sig2fv_fixed(sig, fv, op, base_list, delta_list, acc_list, shift, length); //@} code */ } //@} speech_tools/testsuite/correct/Makefile0000644000076400007640000000570207262605664017034 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Correct answers to tests ## ########################################################################### TOP=../.. DIRNAME=testsuite/correct MODULES = error ling xml handle kvl sigpr matrix complex list \ track_map track token deq named_enum string hash pathname \ feature SCRIPTS = ch_track ch_wave lpc wagon viterbi tilt OUTFILES = $(MODULES:%=%_example.out) \ $(MODULES:%=%_regression.out) \ $(SCRIPTS:%=%_script.out) FILES= Makefile $(OUTFILES) include $(TOP)/config/common_make_rules list: echo $(FILES) speech_tools/testsuite/correct/error_example.out0000644000076400007640000000120607262605664020764 0ustar awbawb-=-=-=-=-=- EST Warning -=-=-=-=-=- a non-fatal message: notice we can use printf style formatting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=- EST Error -=-=-=-=-=- A fatal error, this should be caught -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- error caught! -=-=-=-=-=- EST IO Error -=-=-=-=- Unable to open file, as expected - No such file or directory -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- error caught! In error throwing function: normal -=-=-=-=-=- EST Error -=-=-=-=-=- This error is expected: normal -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- error caught! In error throwing function: silent error caught! error message was 'This error is expected: silent' speech_tools/testsuite/correct/ling_example.out0000644000076400007640000000066407262605664020573 0ustar awbawbPart of speech for p is Noun Duration for p is 2.76 Stress value for p is 2 Part of speech for p is Noun Syntactic Category for p is Noun Anterior value is: +Coronal value is: +Anterior value is: +Coronal value is: +This is true: 1This is false: 0i n f o r m m r o f n i i n f o r m () CAT S ; CAT NP ; CAT PRO ; NAME John ; CAT VP ; CAT VERB ; NAME loves ; CAT NP ; CAT DET ; NAME the ; CAT NOUN ; NAME woman ; John loves the () () speech_tools/testsuite/correct/xml_example.out0000644000076400007640000000143607262605664020440 0ustar awbawb > document 1 > text 2 [pcdata[ ]] 2 > sentence 3 [pcdata[ ]] 3 > phrase 4 [pcdata[This]] 4 < phrase 4 [pcdata[ ]] 3 > phrase 4 [pcdata[is]] 4 < phrase 4 [pcdata[ ]] 3 > phrase 4 [pcdata[an example ]] 4 > phrase 5 [pcdata[of ]] 5 > phrase 6 [pcdata[an XML file]] 6 < phrase 6 < phrase 5 < phrase 4 [pcdata[ ]] 3 : punct 3 [pcdata[ ]] 3 < sentence 3 [pcdata[ ]] 2 < text 2 > > <> [destroy-cherry] <> <> <> <> [destroy-apple] NULL <> [create-pie] <> <> [create-split] [create-cheesecake] [destroy-banana] <> <> [destroy-cheesecake] [destroy-split] [destroy-pie] Boxed Examples [create-aubergene] [create-brocoli] [create-cauliflower] {aubergene} {brocoli} [destroy-cauliflower] {aubergene} {brocoli} {aubergene} {brocoli} [destroy-aubergene] NULL {brocoli} [create-pate] {pate} {brocoli} [create-quiche] [create-cheese] [destroy-brocoli] {pate} {quiche} [destroy-cheese] [destroy-quiche] [destroy-pate] speech_tools/testsuite/correct/kvl_example.out0000644000076400007640000000020307262605664020423 0ustar awbawbCaledonia unknown South Bbridge street Edinburgh city EH1 1HN post code Caledonia country Scotland country South Bridge 80 23.45 speech_tools/testsuite/correct/sigpr_example.out0000644000076400007640000000014707262605664020762 0ustar awbawb I've no idea what these are suppose to be but the other tests wont even run without this file -- awb speech_tools/testsuite/correct/matrix_example.out0000644000076400007640000001047707262605664021151 0ustar awbawbInitial Matrix 0 0.01 0.02 0.03 0.04 1 1.01 1.02 1.03 1.04 2 2.01 2.02 2.03 2.04 3 3.01 3.02 3.03 3.04 4 4.01 4.02 4.03 4.04 5 5.01 5.02 5.03 5.04 6 6.01 6.02 6.03 6.04 7 7.01 7.02 7.03 7.04 8 8.01 8.02 8.03 8.04 9 9.01 9.02 9.03 9.04 Resized Matrix 0 0.01 0.02 0.03 0.04 0 0 0 0 0 1 1.01 1.02 1.03 1.04 0 0 0 0 0 2 2.01 2.02 2.03 2.04 0 0 0 0 0 3 3.01 3.02 3.03 3.04 0 0 0 0 0 4 4.01 4.02 4.03 4.04 0 0 0 0 0 5 5.01 5.02 5.03 5.04 0 0 0 0 0 6 6.01 6.02 6.03 6.04 0 0 0 0 0 7 7.01 7.02 7.03 7.04 0 0 0 0 0 8 8.01 8.02 8.03 8.04 0 0 0 0 0 9 9.01 9.02 9.03 9.04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Full Matrix 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 1 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 2 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 3 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 4 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 5 5.01 5.02 5.03 5.04 5.05 5.06 5.07 5.08 5.09 6 6.01 6.02 6.03 6.04 6.05 6.06 6.07 6.08 6.09 7 7.01 7.02 7.03 7.04 7.05 7.06 7.07 7.08 7.09 8 8.01 8.02 8.03 8.04 8.05 8.06 8.07 8.08 8.09 9 9.01 9.02 9.03 9.04 9.05 9.06 9.07 9.08 9.09 10 10.01 10.02 10.03 10.04 10.05 10.06 10.07 10.08 10.09 11 11.01 11.02 11.03 11.04 11.05 11.06 11.07 11.08 11.09 12 12.01 12.02 12.03 12.04 12.05 12.06 12.07 12.08 12.09 13 13.01 13.02 13.03 13.04 13.05 13.06 13.07 13.08 13.09 14 14.01 14.02 14.03 14.04 14.05 14.06 14.07 14.08 14.09 15 15.01 15.02 15.03 15.04 15.05 15.06 15.07 15.08 15.09 16 16.01 16.02 16.03 16.04 16.05 16.06 16.07 16.08 16.09 17 17.01 17.02 17.03 17.04 17.05 17.06 17.07 17.08 17.09 18 18.01 18.02 18.03 18.04 18.05 18.06 18.07 18.08 18.09 19 19.01 19.02 19.03 19.04 19.05 19.06 19.07 19.08 19.09 Row 5 5 5.01 5.02 5.03 5.04 5.05 5.06 5.07 5.08 5.09 Updated Matrix (column 5 replaced with 100s from buffer) 0 0.01 0.02 0.03 0.04 100 0.06 0.07 0.08 0.09 1 1.01 1.02 1.03 1.04 101 1.06 1.07 1.08 1.09 2 2.01 2.02 2.03 2.04 102 2.06 2.07 2.08 2.09 3 3.01 3.02 3.03 3.04 103 3.06 3.07 3.08 3.09 4 4.01 4.02 4.03 4.04 104 4.06 4.07 4.08 4.09 5 5.01 5.02 5.03 5.04 105 5.06 5.07 5.08 5.09 6 6.01 6.02 6.03 6.04 106 6.06 6.07 6.08 6.09 7 7.01 7.02 7.03 7.04 107 7.06 7.07 7.08 7.09 8 8.01 8.02 8.03 8.04 108 8.06 8.07 8.08 8.09 9 9.01 9.02 9.03 9.04 109 9.06 9.07 9.08 9.09 10 10.01 10.02 10.03 10.04 110 10.06 10.07 10.08 10.09 11 11.01 11.02 11.03 11.04 111 11.06 11.07 11.08 11.09 12 12.01 12.02 12.03 12.04 112 12.06 12.07 12.08 12.09 13 13.01 13.02 13.03 13.04 113 13.06 13.07 13.08 13.09 14 14.01 14.02 14.03 14.04 114 14.06 14.07 14.08 14.09 15 15.01 15.02 15.03 15.04 115 15.06 15.07 15.08 15.09 16 16.01 16.02 16.03 16.04 116 16.06 16.07 16.08 16.09 17 17.01 17.02 17.03 17.04 117 17.06 17.07 17.08 17.09 18 18.01 18.02 18.03 18.04 118 18.06 18.07 18.08 18.09 19 19.01 19.02 19.03 19.04 119 19.06 19.07 19.08 19.09 Row 10 extracted as sub vector 10 10.01 10.02 10.03 10.04 110 10.06 10.07 10.08 10.09 Column 3 extracted as sub vector 0.03 1.03 2.03 3.03 4.03 5.03 6.03 7.03 8.03 9.03 10.03 11.03 12.03 13.03 14.03 15.03 16.03 17.03 18.03 19.03 Rectangle extracted as sub vector 8.02 8.03 8.04 9.02 9.03 9.04 10.02 10.03 10.04 11.02 11.03 11.04 12.02 12.03 12.04 Updated Matrix (row 10 becomes squares, column 3 becomes cubes, center becomes negative) 0 0.01 0.02 0 0.04 100 0.06 0.07 0.08 0.09 1 1.01 1.02 1 1.04 101 1.06 1.07 1.08 1.09 2 2.01 2.02 8 2.04 102 2.06 2.07 2.08 2.09 3 3.01 3.02 27 3.04 103 3.06 3.07 3.08 3.09 4 4.01 4.02 64 4.04 104 4.06 4.07 4.08 4.09 5 5.01 5.02 125 5.04 105 5.06 5.07 5.08 5.09 6 6.01 6.02 216 6.04 106 6.06 6.07 6.08 6.09 7 7.01 7.02 343 7.04 107 7.06 7.07 7.08 7.09 8 8.01 -1 -3 -1 108 8.06 8.07 8.08 8.09 9 9.01 -1 -3 -1 109 9.06 9.07 9.08 9.09 0 1 -2 -2 -2 25 36 49 64 81 11 11.01 -1 -3 -1 111 11.06 11.07 11.08 11.09 12 12.01 -1 -3 -1 112 12.06 12.07 12.08 12.09 13 13.01 13.02 2197 13.04 113 13.06 13.07 13.08 13.09 14 14.01 14.02 2744 14.04 114 14.06 14.07 14.08 14.09 15 15.01 15.02 3375 15.04 115 15.06 15.07 15.08 15.09 16 16.01 16.02 4096 16.04 116 16.06 16.07 16.08 16.09 17 17.01 17.02 4913 17.04 117 17.06 17.07 17.08 17.09 18 18.01 18.02 5832 18.04 118 18.06 18.07 18.08 18.09 19 19.01 19.02 6859 19.04 119 19.06 19.07 19.08 19.09 speech_tools/testsuite/correct/complex_example.out0000644000076400007640000000041707262605664021305 0ustar awbawb4 3 real 4 imag 3 mag 5 ang in radians0.643501 ang in degress 36.8699 z1 = 4 3 z2 = 2 2 z1 + z2 = 6 5 z3 + 10= 14 3 10 + z3 = 14 3 z1 - z2 = 2 1 z1 - 10= -6 3 10 - z1 = 6 -3 z1 * z2 = 2 14 z1 * 10= 40 30 10 * z1 = 40 30 z1 / z2 = 0.4 2.8 z1 / 10= 0.4 0.3 10 / z1 = 8 6 speech_tools/testsuite/correct/list_example.out0000644000076400007640000000131407262605664020606 0ustar awbawb[ List Accessed by LItem dove quail wood pigeon hawk eagle sparrow emu rook ] [ List Accessed by integer index dove quail wood pigeon hawk eagle sparrow emu rook ] Last item: rook Last item: rook First item: dovE 4th item: EaglE [ List After Substitutions and Replacements Swallow quail SEagull hawk EaglE sparrow Emu TurkEy ] [ List After Removing Eagle Swallow quail SEagull hawk sparrow Emu TurkEy ] [ List After Reverse TurkEy Emu sparrow hawk SEagull quail Swallow ] [ Sorted Emu SEagull Swallow TurkEy hawk quail sparrow ] [ Sorted by second character SEagull hawk Emu sparrow quail TurkEy Swallow ] speech_tools/testsuite/correct/track_map_example.out0000644000076400007640000003305207262605664021600 0ustar awbawbFrame 3 listing by position Channel 0 is 'Length' = 161.3 Channel 1 is 'power' = 2133 Channel 2 is 'My Funky F0' = 3242 Channel 3 is 'lpc_0' = 0 Channel 4 is 'track4' = 0 Channel 5 is 'Mean Wangle Period' = 6.263e+05 Channel 6 is 'track6' = 0 Frame 3 listing by type Channel type 7 (Order) not valid in this track Channel type 8 (reflection_0) not valid in this track Channel type 9 (reflection_N) not valid in this track Channel type 10 (reflection_d_0) not valid in this track Channel type 11 (reflection_d_N) not valid in this track Channel type 12 (reflection_a_0) not valid in this track Channel type 13 (reflection_a_N) not valid in this track Channel type 14 (Peak) not valid in this track Channel type 15 (Duration) not valid in this track Channel type 16 (cep_0) not valid in this track Channel type 17 (cep_N) not valid in this track Channel type 18 (cep_d_0) not valid in this track Channel type 19 (cep_d_N) not valid in this track Channel type 20 (cep_a_0) not valid in this track Channel type 21 (cep_a_N) not valid in this track Channel type 22 (Length) = 161.3 Channel type 23 (Offset) not valid in this track Channel type 24 (melcep_0) not valid in this track Channel type 25 (melcep_N) not valid in this track Channel type 26 (melcep_d_0) not valid in this track Channel type 27 (melcep_d_N) not valid in this track Channel type 28 (melcep_a_0) not valid in this track Channel type 29 (melcep_a_N) not valid in this track Channel type 30 (Voiced) not valid in this track Channel type 31 (Frame) not valid in this track Channel type 32 (fbank_0) not valid in this track Channel type 33 (fbank_N) not valid in this track Channel type 34 (fbank_d_0) not valid in this track Channel type 35 (fbank_d_N) not valid in this track Channel type 36 (fbank_a_0) not valid in this track Channel type 37 (fbank_a_N) not valid in this track Channel type 38 (Time) not valid in this track Channel type 39 ((null)) not valid in this track Channel type 40 (lsf_0) not valid in this track Channel type 41 (lsf_N) not valid in this track Channel type 42 (lsf_d_0) not valid in this track Channel type 43 (lsf_d_N) not valid in this track Channel type 44 (lsf_a_0) not valid in this track Channel type 45 (lsf_a_N) not valid in this track Channel type 46 ((null)) not valid in this track Channel type 47 ((null)) not valid in this track Channel type 48 ((null)) not valid in this track Channel type 49 ((null)) not valid in this track Channel type 50 ((null)) not valid in this track Channel type 51 ((null)) not valid in this track Channel type 52 ((null)) not valid in this track Channel type 53 ((null)) not valid in this track Channel type 54 ((null)) not valid in this track Channel type 55 ((null)) not valid in this track Channel type 56 (filter_0) not valid in this track Channel type 57 (filter_N) not valid in this track Channel type 58 (filter_d_0) not valid in this track Channel type 59 (filter_d_N) not valid in this track Channel type 60 (filter_a_0) not valid in this track Channel type 61 (filter_a_N) not valid in this track Channel type 62 ((null)) not valid in this track Channel type 63 ((null)) not valid in this track Channel type 64 ((null)) not valid in this track Channel type 65 ((null)) not valid in this track Channel type 66 ((null)) not valid in this track Channel type 67 ((null)) not valid in this track Channel type 68 ((null)) not valid in this track Channel type 69 ((null)) not valid in this track Channel type 70 ((null)) not valid in this track Channel type 71 ((null)) not valid in this track Channel type 72 ((null)) not valid in this track Channel type 73 ((null)) not valid in this track Channel type 74 ((null)) not valid in this track Channel type 75 ((null)) not valid in this track Channel type 76 ((null)) not valid in this track Channel type 77 ((null)) not valid in this track Channel type 78 ((null)) not valid in this track Channel type 79 ((null)) not valid in this track Channel type 80 (power) = 2133 Channel type 81 (energy) not valid in this track Channel type 82 (power_d) not valid in this track Channel type 83 (energy_d) not valid in this track Channel type 84 (power_a) not valid in this track Channel type 85 (energy_a) not valid in this track Channel type 86 ((null)) not valid in this track Channel type 87 ((null)) not valid in this track Channel type 88 (f0) = 3242 Channel type 89 ((null)) not valid in this track Channel type 90 (f0_d) not valid in this track Channel type 91 ((null)) not valid in this track Channel type 92 (f0_a) not valid in this track And Mean Wangle Period [pos=5] = 6.263e+05 Subtrack listing by position Channel 0 is 'My Funky F0' = 3242 Channel 1 is 'lpc_0' = 0 Channel 2 is 'track2' = 0 Subtrack listing by type Channel type 7 (Order) not valid in this track Channel type 8 (reflection_0) not valid in this track Channel type 9 (reflection_N) not valid in this track Channel type 10 (reflection_d_0) not valid in this track Channel type 11 (reflection_d_N) not valid in this track Channel type 12 (reflection_a_0) not valid in this track Channel type 13 (reflection_a_N) not valid in this track Channel type 14 (Peak) not valid in this track Channel type 15 (Duration) not valid in this track Channel type 16 (cep_0) not valid in this track Channel type 17 (cep_N) not valid in this track Channel type 18 (cep_d_0) not valid in this track Channel type 19 (cep_d_N) not valid in this track Channel type 20 (cep_a_0) not valid in this track Channel type 21 (cep_a_N) not valid in this track Channel type 22 (Length) not valid in this track Channel type 23 (Offset) not valid in this track Channel type 24 (melcep_0) not valid in this track Channel type 25 (melcep_N) not valid in this track Channel type 26 (melcep_d_0) not valid in this track Channel type 27 (melcep_d_N) not valid in this track Channel type 28 (melcep_a_0) not valid in this track Channel type 29 (melcep_a_N) not valid in this track Channel type 30 (Voiced) not valid in this track Channel type 31 (Frame) not valid in this track Channel type 32 (fbank_0) not valid in this track Channel type 33 (fbank_N) not valid in this track Channel type 34 (fbank_d_0) not valid in this track Channel type 35 (fbank_d_N) not valid in this track Channel type 36 (fbank_a_0) not valid in this track Channel type 37 (fbank_a_N) not valid in this track Channel type 38 (Time) not valid in this track Channel type 39 ((null)) not valid in this track Channel type 40 (lsf_0) not valid in this track Channel type 41 (lsf_N) not valid in this track Channel type 42 (lsf_d_0) not valid in this track Channel type 43 (lsf_d_N) not valid in this track Channel type 44 (lsf_a_0) not valid in this track Channel type 45 (lsf_a_N) not valid in this track Channel type 46 ((null)) not valid in this track Channel type 47 ((null)) not valid in this track Channel type 48 ((null)) not valid in this track Channel type 49 ((null)) not valid in this track Channel type 50 ((null)) not valid in this track Channel type 51 ((null)) not valid in this track Channel type 52 ((null)) not valid in this track Channel type 53 ((null)) not valid in this track Channel type 54 ((null)) not valid in this track Channel type 55 ((null)) not valid in this track Channel type 56 (filter_0) not valid in this track Channel type 57 (filter_N) not valid in this track Channel type 58 (filter_d_0) not valid in this track Channel type 59 (filter_d_N) not valid in this track Channel type 60 (filter_a_0) not valid in this track Channel type 61 (filter_a_N) not valid in this track Channel type 62 ((null)) not valid in this track Channel type 63 ((null)) not valid in this track Channel type 64 ((null)) not valid in this track Channel type 65 ((null)) not valid in this track Channel type 66 ((null)) not valid in this track Channel type 67 ((null)) not valid in this track Channel type 68 ((null)) not valid in this track Channel type 69 ((null)) not valid in this track Channel type 70 ((null)) not valid in this track Channel type 71 ((null)) not valid in this track Channel type 72 ((null)) not valid in this track Channel type 73 ((null)) not valid in this track Channel type 74 ((null)) not valid in this track Channel type 75 ((null)) not valid in this track Channel type 76 ((null)) not valid in this track Channel type 77 ((null)) not valid in this track Channel type 78 ((null)) not valid in this track Channel type 79 ((null)) not valid in this track Channel type 80 (power) not valid in this track Channel type 81 (energy) not valid in this track Channel type 82 (power_d) not valid in this track Channel type 83 (energy_d) not valid in this track Channel type 84 (power_a) not valid in this track Channel type 85 (energy_a) not valid in this track Channel type 86 ((null)) not valid in this track Channel type 87 ((null)) not valid in this track Channel type 88 (f0) = 3242 Channel type 89 ((null)) not valid in this track Channel type 90 (f0_d) not valid in this track Channel type 91 ((null)) not valid in this track Channel type 92 (f0_a) not valid in this track Frame 3 listing of loaded track by type Channel type 7 (Order) not valid in this track Channel type 8 (reflection_0) not valid in this track Channel type 9 (reflection_N) not valid in this track Channel type 10 (reflection_d_0) not valid in this track Channel type 11 (reflection_d_N) not valid in this track Channel type 12 (reflection_a_0) not valid in this track Channel type 13 (reflection_a_N) not valid in this track Channel type 14 (Peak) not valid in this track Channel type 15 (Duration) not valid in this track Channel type 16 (cep_0) not valid in this track Channel type 17 (cep_N) not valid in this track Channel type 18 (cep_d_0) not valid in this track Channel type 19 (cep_d_N) not valid in this track Channel type 20 (cep_a_0) not valid in this track Channel type 21 (cep_a_N) not valid in this track Channel type 22 (Length) not valid in this track Channel type 23 (Offset) not valid in this track Channel type 24 (melcep_0) not valid in this track Channel type 25 (melcep_N) not valid in this track Channel type 26 (melcep_d_0) not valid in this track Channel type 27 (melcep_d_N) not valid in this track Channel type 28 (melcep_a_0) not valid in this track Channel type 29 (melcep_a_N) not valid in this track Channel type 30 (Voiced) not valid in this track Channel type 31 (Frame) not valid in this track Channel type 32 (fbank_0) not valid in this track Channel type 33 (fbank_N) not valid in this track Channel type 34 (fbank_d_0) not valid in this track Channel type 35 (fbank_d_N) not valid in this track Channel type 36 (fbank_a_0) not valid in this track Channel type 37 (fbank_a_N) not valid in this track Channel type 38 (Time) not valid in this track Channel type 39 ((null)) not valid in this track Channel type 40 (lsf_0) not valid in this track Channel type 41 (lsf_N) not valid in this track Channel type 42 (lsf_d_0) not valid in this track Channel type 43 (lsf_d_N) not valid in this track Channel type 44 (lsf_a_0) not valid in this track Channel type 45 (lsf_a_N) not valid in this track Channel type 46 ((null)) not valid in this track Channel type 47 ((null)) not valid in this track Channel type 48 ((null)) not valid in this track Channel type 49 ((null)) not valid in this track Channel type 50 ((null)) not valid in this track Channel type 51 ((null)) not valid in this track Channel type 52 ((null)) not valid in this track Channel type 53 ((null)) not valid in this track Channel type 54 ((null)) not valid in this track Channel type 55 ((null)) not valid in this track Channel type 56 (filter_0) not valid in this track Channel type 57 (filter_N) not valid in this track Channel type 58 (filter_d_0) not valid in this track Channel type 59 (filter_d_N) not valid in this track Channel type 60 (filter_a_0) not valid in this track Channel type 61 (filter_a_N) not valid in this track Channel type 62 ((null)) not valid in this track Channel type 63 ((null)) not valid in this track Channel type 64 ((null)) not valid in this track Channel type 65 ((null)) not valid in this track Channel type 66 ((null)) not valid in this track Channel type 67 ((null)) not valid in this track Channel type 68 ((null)) not valid in this track Channel type 69 ((null)) not valid in this track Channel type 70 ((null)) not valid in this track Channel type 71 ((null)) not valid in this track Channel type 72 ((null)) not valid in this track Channel type 73 ((null)) not valid in this track Channel type 74 ((null)) not valid in this track Channel type 75 ((null)) not valid in this track Channel type 76 ((null)) not valid in this track Channel type 77 ((null)) not valid in this track Channel type 78 ((null)) not valid in this track Channel type 79 ((null)) not valid in this track Channel type 80 (power) = 0.6079 Channel type 81 (energy) not valid in this track Channel type 82 (power_d) not valid in this track Channel type 83 (energy_d) not valid in this track Channel type 84 (power_a) not valid in this track Channel type 85 (energy_a) not valid in this track Channel type 86 ((null)) not valid in this track Channel type 87 ((null)) not valid in this track Channel type 88 (f0) not valid in this track Channel type 89 ((null)) not valid in this track Channel type 90 (f0_d) not valid in this track Channel type 91 ((null)) not valid in this track Channel type 92 (f0_a) not valid in this track speech_tools/testsuite/correct/track_example.out0000644000076400007640000000000007262605664020726 0ustar awbawbspeech_tools/testsuite/correct/token_example.out0000644000076400007640000000015607262605664020756 0ustar awbawbInput file contains: 4297 tokens 4 tokens preceeded by double quotes 51 occurrences of Alice speech_tools/testsuite/correct/deq_example.out0000644000076400007640000000114207262605664020403 0ustar awbawb{5|Argyle//Bute//Cumbernauld//<>//<>//} 0: Cumbernauld 1: Bute Cumbernauld Bute {5|Argyle//<>//<>//<>//<>//} {9|Argyle//Dundee//Edinburgh//Fife//Glasgow//Harris//Iona//<>//<>//} Argyle Dundee Edinburgh Fife {9|<>//<>//<>//<>//Glasgow//Harris//Iona//<>//<>//} {9|Lewis//Mull//<>//<>//Glasgow//Harris//Iona//Jura//Kirkwald//} 0: Mull 1: Lewis 2: Kirkwald 3: Jura {13|Glasgow//Harris//Iona//Jura//Kirkwald//Lewis//Mull//Newhaven//Orkney//Pitlochry//Queensferry//<>//<>//} {13|Argyle//Bute//<>//<>//<>//<>//<>//<>//<>//<>//<>//<>//<>//} {13|Argyle//Bute//<>//<>//<>//<>//<>//<>//<>//<>//<>//Dundee//Cumbernauld//} speech_tools/testsuite/correct/named_enum_example.out0000644000076400007640000000123207313506445021734 0ustar awbawbc1 is red c2 is [NULL] red is 1 = red (rojo in Spanish) = {255, 0, 0} navy is 2 = blue (azul in Spanish) = {0, 0, 255} puce is 666 = kinda brownish (no conocido in Spanish) = {127, 127, 127} colour name map unknown=666 quote=" number=3 =666 "kinda brownish" =1 red scarlet =2 blue navy sad colour name map (spanish) unknown=666 quote=" number=3 "kinda brownish" "no conocido" "red" rojo escarlata sangre "blue" azul piscina mar cielo read in table unknown=666 quote=" number=2 =2 "loaded blue" blue "sky blue" =1 "loaded red" red postbox read in table (translation) unknown=666 quote=" number=2 =2 "loaded azul" piscina =1 "loaded rojo" sangre speech_tools/testsuite/correct/string_example.out0000644000076400007640000000062407262605664021144 0ustar awbawbhello world stdio version hello world Yes, it contains a match for \(wow\|yey\|lo\)[^a-z] match was 'lo ' word was 'lo' processing 'http://www.cstr.ed.ac.uk/speech_tools' gives 'protocol=http host=www.cstr.ed.ac.uk path=/speech_tools dummy=\6' start with "what if I don't like 'hello world'?" quoted "'what if I don''t like ''hello world''?'" unquoted "what if I don't like 'hello world'?" speech_tools/testsuite/correct/hash_example.out0000644000076400007640000000030307262605664020553 0ustar awbawblength of `fred' = 4 log of 34' = 3.52636 now don't know log of 34' = 0 log of 123 not found 19: [bill],(4) 49: [fred],(4) 66: [harry],(5) ... bill 4 fred 4 harry 5 bill 12 fred 12 harry 15 speech_tools/testsuite/correct/pathname_example.out0000644000076400007640000000113007262605664021424 0ustar awbawbfile f = baz/ptooie dir f = baz/ptooie/ combine = /foo/bar/baz/ptooie combine = baz/ptooie/baz/ptooie build = /foo/bar/baz/ptooie.test filename = ptooie.test extension = test basename = ptooie.test basename1 = ptooie listing example_data: Makefile alice ch_track.htk ch_wave.wav channel_names.map colours.map colours_translation.map eg.dtd eg.xml kdt_001.il kdt_001.pm kdt_001.tilt kdt_001.wav ked_wr1_012.utt key.lab options.file vit.B.ngram vit.observes vit.vocab wagon.data wagon.desc wagon.tree done. speech_tools/testsuite/correct/feature_example.out0000644000076400007640000000036707262605664021275 0ustar awbawbPart of speech for p is Noun Duration for p is 2.76 Stress value for p is 2 Part of speech for p is Noun Syntactic Category for p is Noun Anterior value is: +Coronal value is: +Anterior value is: +Coronal value is: +This is true: 1This is false: 0speech_tools/testsuite/correct/error_regression.out0000644000076400007640000000000007262605664021500 0ustar awbawbspeech_tools/testsuite/correct/ling_regression.out0000644000076400007640000000404307262605664021313 0ustar awbawbName= Name= Name= Name=ay Name=know Name= Name=n Name= Name= Name=ow Name=of Name= Name= Name=ah Name= Name=v Name= Name= Name=f Name=l Name= Name= Name=ao Name= Name= Name=r Name= Name= Name=ax Name= Name=n Name=s Name=south Name= Name=s Name= Name= Name=aw Name= Name=th Name= Name= Name=k Name= Name= Name=eh Name= Name= Name=r Name= Name= Name=ax Name= Name= Name=l Name= Name= Name=ay Name= Name= Name=n Name= Name= Name=ax Name=and Name= Name= Name=ae Name= Name=n Name=d Name=a Name= Name= Name=ey Name= Name= Name=f Name=l Name= Name= Name=ao Name= Name= Name=r Name= Name= Name=ax Name= Name=n Name=s Name= Name= Name= Name=ih Name= Name= Name=t Name= Name= Name=ax Name= Name= Name=l Name= Name= Name=iy Name=in Name= Name= Name=ih Name= Name=n Name= Name= Name=f Name=l Name= Name= Name=ao Name= Name= Name=r Name= Name= Name=ax Name= Name=n Name=s Name=in Name= Name= Name=ih Name= Name=n Name=south Name= Name=s Name= Name= Name=aw Name= Name=th Name= Name= Name=k Name= Name= Name=eh Name= Name= Name=r Name= Name= Name=ax Name= Name= Name=l Name= Name= Name=ay Name= Name= Name=n Name= Name= Name=ax Name= Name= Name=t Name= Name= Name=ax Name= Name= Name=d Name= Name= Name=ey Name= Name= Name=m Name= Name= Name=ow Name= Name=s Name=t Name= Name= Name=l Name= Name= Name=iy Name= Name= Name=s Name= Name= Name=ah Name= Name= Name=n Name= Name= Name=iy Name=highs Name= Name=hh Name= Name= Name=ay Name= Name=z Name= Name= Name= Name=ah Name= Name= Name=p Name= Name= Name=er Name= Name= Name=f Name= Name= Name=ih Name= Name=f Name= Name= Name=t Name= Name= Name=iy Name= Name=z Name= Name= Name=t Name= Name= Name=ax Name= Name= Name=n Name= Name= Name=ay Name= Name=t Name= Name= Name=p Name= Name= Name=aa Name= Name=r Name=t Name= Name= Name=l Name= Name= Name=iy Name= Name= Name=k Name=l Name= Name= Name=aw Name= Name= Name=d Name= Name= Name=iy Name=lows Name= Name=l Name= Name= Name=ow Name= Name=z Name= Name= Name= Name=ah Name= Name= Name=p Name= Name= Name=er Name= Name= Name=th Name= Name= Name=er Name= Name= Name=t Name= Name= Name=iy Name= Name=z speech_tools/testsuite/correct/xml_regression.out0000644000076400007640000000000007262605664021147 0ustar awbawbspeech_tools/testsuite/correct/handle_regression.out0000644000076400007640000000000007262605664021602 0ustar awbawbspeech_tools/testsuite/correct/kvl_regression.out0000644000076400007640000000003107262605664021147 0ustar awbawbUnited Kingdom unknown speech_tools/testsuite/correct/sigpr_regression.out0000644000076400007640000000000007262605664021473 0ustar awbawbspeech_tools/testsuite/correct/matrix_regression.out0000644000076400007640000000240007262605664021661 0ustar awbawbEST_TVector size = 20 bytes. EST_TMatrix size = 28 bytes. Initial Matrix 0 1 2 3 4 100 101 102 103 104 200 201 202 203 204 300 301 302 303 304 400 401 402 403 404 Same Sized Matrix 0 1 2 3 4 100 101 102 103 104 200 201 202 203 204 300 301 302 303 304 400 401 402 403 404 Double Sized Matrix 0 1 2 3 4 0 0 0 0 0 100 101 102 103 104 0 0 0 0 0 200 201 202 203 204 0 0 0 0 0 300 301 302 303 304 0 0 0 0 0 400 401 402 403 404 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset Matrix 0 1 2 3 4 5 6 7 8 9 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 Half Sized Matrix 0 1 2 3 4 1000 1001 1002 1003 1004 2000 2001 2002 2003 2004 3000 3001 3002 3003 3004 4000 4001 4002 4003 4004 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 0 0 0 0 500 501 502 503 504 505 506 507 508 509 speech_tools/testsuite/correct/complex_regression.out0000644000076400007640000000000407262605664022022 0ustar awbawb4 3 speech_tools/testsuite/correct/list_regression.out0000644000076400007640000000000007262605664021322 0ustar awbawbspeech_tools/testsuite/correct/track_map_regression.out0000644000076400007640000000000007262605664022310 0ustar awbawbspeech_tools/testsuite/correct/track_regression.out0000644000076400007640000000572107262605664021472 0ustar awbawb[ Track Original track 0: 0.000 0.000 0.010 1: 0.500 1.000 1.010 2: 1.000 2.000 2.010 3: 1.500 3.000 3.010 4: 2.000 4.000 4.010 5: 2.500 5.000 5.010 6: 3.000 6.000 6.010 7: 3.500 7.000 7.010 8: 4.000 8.000 8.010 9: 4.500 9.000 9.010 10: 5.000 10.000 10.010 11: 5.500 11.000 11.010 12: 6.000 12.000 12.010 13: 6.500 13.000 13.010 14: 7.000 14.000 14.010 15: 7.500 15.000 15.010 16: 8.000 16.000 16.010 17: 8.500 17.000 17.010 18: 9.000 18.000 18.010 19: 9.500 19.000 19.010 ] [ Track Breaks Trimmed 0: 0.000 0.000 0.010 1: 0.500 1.000 1.010 2: 1.000 2.000 2.010 3: 1.500 3.000 3.010 4: 2.000 4.000 4.010 5: 2.500 5.000 5.010 6: 3.000 6.000 6.010 7: 3.500 7.000 7.010 8: 4.000 8.000 8.010 9: 4.500 9.000 9.010 10: 5.000 10.000 10.010 11: 5.500 11.000 11.010 12: 6.000 12.000 12.010 13: 6.500 13.000 13.010 14: 7.000 14.000 14.010 15: 7.500 15.000 15.010 16: 8.000 16.000 16.010 17: 8.500 17.000 17.010 18: 9.000 18.000 18.010 19: 9.500 19.000 19.010 ] [ Track Breaks BREAK BREAK BREAK 3: 1.500 3.000 3.010 4: 2.000 4.000 4.010 5: 2.500 5.000 5.010 6: 3.000 6.000 6.010 7: 3.500 7.000 7.010 8: 4.000 8.000 8.010 9: 4.500 9.000 9.010 BREAK BREAK BREAK 13: 6.500 13.000 13.010 14: 7.000 14.000 14.010 15: 7.500 15.000 15.010 16: 8.000 16.000 16.010 BREAK BREAK BREAK ] [ Track Breaks Trimmed 0: 1.500 3.000 3.010 1: 2.000 4.000 4.010 2: 2.500 5.000 5.010 3: 3.000 6.000 6.010 4: 3.500 7.000 7.010 5: 4.000 8.000 8.010 6: 4.500 9.000 9.010 BREAK BREAK BREAK 10: 6.500 13.000 13.010 11: 7.000 14.000 14.010 12: 7.500 15.000 15.010 13: 8.000 16.000 16.010 ] [ Track resized to same size 0: 1.500 3.000 3.010 1: 2.000 4.000 4.010 2: 2.500 5.000 5.010 3: 3.000 6.000 6.010 4: 3.500 7.000 7.010 5: 4.000 8.000 8.010 6: 4.500 9.000 9.010 BREAK BREAK BREAK 10: 6.500 13.000 13.010 11: 7.000 14.000 14.010 12: 7.500 15.000 15.010 13: 8.000 16.000 16.010 ] [ Track Sub Track 0: 3.000 6.000 6.010 1: 3.500 7.000 7.010 2: 4.000 8.000 8.010 3: 4.500 9.000 9.010 BREAK BREAK BREAK ] [ Track Copied 0: 3.000 6.000 6.010 1: 3.500 7.000 7.010 2: 4.000 8.000 8.010 3: 4.500 9.000 9.010 BREAK BREAK BREAK ] [ Track Copied Directly 0: 3.000 6.000 6.010 1: 3.500 7.000 7.010 2: 4.000 8.000 8.010 3: 4.500 9.000 9.010 BREAK BREAK BREAK ] [ Track Pitch Marks 0: 0.000 1: 1.500 2: 3.000 3: 4.500 4: 6.000 5: 7.500 6: 9.000 7: 10.500 8: 12.000 9: 13.500 10: 15.000 11: 16.500 12: 18.000 13: 19.500 14: 21.000 15: 22.500 16: 24.000 17: 25.500 18: 27.000 19: 28.500 ] [ Track Resized Pitch Marks 0: 0.000 1: 1.500 2: 3.000 3: 4.500 4: 6.000 5: 7.500 6: 9.000 7: 10.500 8: 12.000 9: 13.500 ] speech_tools/testsuite/correct/token_regression.out0000644000076400007640000000112507262605664021500 0ustar awbawbTest 1: "This is a test." This is a test. Total: 4 Test 2: "This (is) a test." This (is) a test. Total: 4 Test 3: "This (is) a test." This is a test Total: 4 Test 4: "This (is) a test." This ( is ) a test Total: 6 Test 5: "This \"is a\" te\\\"st." This is a te\"st Total: 4 Test 6: "This \"is a\" te\\\"st." This is a te\"st. Total: 4 Test 7: "This \"is a\" te\\\"st." This is a te\"st. Total: 4 Reading tokens and binary from string [TOKEN a] [TOKEN buffer] 7 -34 [TOKEN and] [TOKEN tokens] Reading tokens and binary from file [TOKEN a] [TOKEN buffer] 7 -34 [TOKEN and] [TOKEN tokens] speech_tools/testsuite/correct/deq_regression.out0000644000076400007640000000000007262605664021120 0ustar awbawbspeech_tools/testsuite/correct/named_enum_regression.out0000644000076400007640000000015407262605664022471 0ustar awbawbc1 is red Mercury c2 is UNKNOWN COLOUR c3 is blue Steel print_3 111 print_2 222 c1 111 c2 --- c_unknown ??? speech_tools/testsuite/correct/string_regression.out0000644000076400007640000000232707262605664021673 0ustar awbawbFirst 'hello world' Second 'lo w' Third 'l' Result 0 '' Result 1 'hel' Result 2 '' Result 3 'hello wor' Result 4 'hel' Result 5 'hel' Result 6b 'hello' Result 1a 'orld' Result 2a '' Result 3a 'd' Result 4a 'o world' Result 5a 'o world' Result 6a 'world' Result 6 'lo w sw eet' Result 7 'lo wl' Result 8 'some,wordswithpunctuationleftaftera-vowel' Test 0 '1' Test 1 '1' Test 2 '1' Test 3 '0' Test 4 '1' Test 5 '1' Test 6 '0' Test 7 '1' Test 8 '0' Test 9 '0' Test 10 '1' Test 11 '1' Test 12 '0' Test 13 '1' Test 14 '1' Test 15 '1' Test 0m '1' Test 1m '0' Test 2m '1' Test 3m '1' Result 1r 'hel' Result 2r 'hello wor' Result 3r 'd' Result 1at 'lo w' Result 2at 'lo wo' Result 3at 'llo ' Num 1 '3' bits1[0] 'he' bits1[1] 'o wor' bits1[2] 'd' Num 2 '2' bits2[0] 'he' bits2[1] 'o wor' bits2[2] '' Num 7 '2' bits3[0] 'hello' bits3[1] 'world' bits3[2] '' Num 8 '5' bits4[0] '"some tokens"' bits4[1] 'which' bits4[2] '' bits4[3] 'are' bits4[4] '"quoted with """' bits4[5] '' Num 9 '4' bits5[0] '"some tokens"' bits5[1] 'which' bits5[2] 'are' bits5[3] '"quoted with """' bits5[4] '' Num 10 '1' bits6[0] 'hello world' bits6[1] '' Num 3 '2' Num 4 '3' Num 5 '3' Sub 1 'he[an ell][an ell]o wor[an ell]d' Num 6 '2' Sub 1 'he[some ells]o wor[some ells]d' speech_tools/testsuite/correct/hash_regression.out0000644000076400007640000003341607262605664021313 0ustar awbawbLatitude is on line 76 0: [crowded],(460) [hate],(458) [useful],(446) [fright],(414) [quiver],(414) [est],(412) [history],(457) [Conqueror],(410) [speaking],(401) [station],(381) [machines],(379) [coast],(378) [change],(438) [frightened],(364) [done],(402) [Rabbit's],(355) [As],(434) [learn],(345) [fishes],(338) [claws],(337) [shining],(332) [Geography],(323) [Table],(323) [Multiplication],(323) [six],(321) [times],(321) [hair],(443) [thinking],(311) [puzzle],(310) [am],(400) [changed],(326) [Dear],(305) [please],(298) [kept],(304) [himself],(295) [pattering],(290) [Stop],(285) [Christmas],(260) [shoes],(255) [Pool],(246) [don't],(453) [cheated],(209) [advice],(206) [slippery],(200) [decided],(194) [After],(290) [blown],(191) [turkey],(172) [pine],(171) [fact],(275) [sooner],(166) [drink],(165) [will],(265) [poison],(169) [label],(153) [few],(186) [poor],(416) [go],(460) [beds],(139) [fitted],(133) [rate],(398) [heap],(106) [night],(307) [talking],(356) [little],(442) [ignorant],(89) [spoke],(87) [them],(454) [it'll],(444) [come],(452) [true],(65) [house],(441) [How],(356) [Well],(421) [killing],(57) [one],(428) [She],(424) [upon],(130) [here],(400) [plenty],(49) [dipped],(44) [field],(37) [close],(115) [with],(461) [suddenly],(106) [daisy],(23) [So],(452) [is],(458) [conversations],(18) [tired],(400) 1: [passion],(455) [angry],(422) [William],(409) [Grammar],(403) [suppose],(387) [digging],(379) [He],(447) [avoid],(362) [cause],(361) [jaws],(339) [cheerfully],(336) [On],(334) [crossed],(327) [seven],(321) [used],(329) [try],(326) [oh],(447) [fanning],(304) [timid],(298) [muttering],(294) [trotting],(294) [nonsense],(272) [boots],(260) [dears],(255) [happens],(228) [left],(213) [croquet],(210) [while],(356) [minutes],(186) [size],(227) [ten],(183) [toast],(172) [cherry],(171) [mixed],(171) [friends],(162) [eaten],(160) [certainly],(152) [half],(445) [waiting],(296) [indeed],(438) [lately],(145) [For],(448) [begin],(144) [shoulders],(142) [fountains],(139) [garden],(366) [alas],(367) [key],(368) [except],(126) [middle],(122) [trying],(399) [ears],(209) [walking],(104) [dream],(103) [matter],(102) [saying],(347) [wish],(422) [remember],(445) [soon],(393) [written],(90) [perhaps],(421) [manage],(262) [you're],(87) [curtsey],(87) [Ma'am],(86) [walk],(258) [people],(212) [words],(373) [that's],(97) [yes],(74) [must],(430) [many],(345) [off],(391) [if],(453) [they'll],(94) [disappointment],(56) [great],(438) [pegs],(54) [maps],(54) [Either],(48) [take],(423) [seen],(403) [across],(36) [hurried],(276) [seemed],(414) [at],(404) [say],(348) [much],(385) [nor],(27) [ran],(366) [pleasure],(23) [made],(393) [a],(462) [had],(461) [or],(453) [was],(460) [the],(463) [Carroll],(3) 2: [Lory],(462) [birds],(461) [why],(458) [rats],(447) [belongs],(445) [fetch],(443) [she's],(427) [our],(441) [shrill],(418) [pardon],(428) [ma],(412) [Ou],(412) [Latin],(403) [wept],(382) [lodging],(380) [spades],(380) [chin],(374) [declare],(370) [burst],(351) [crocodile],(331) [hoarse],(328) [five],(320) [ringlets],(316) [usual],(306) [sir],(299) [gloves],(356) [hastily],(415) [pool],(460) [until],(286) [cry],(281) [directions],(265) [kind],(258) [opening],(251) [English],(408) [set],(233) [smaller],(220) [currants],(218) [playing],(210) [bring],(208) [seldom],(207) [minute],(205) [however],(186) [apple],(171) [custard],(171) [forgotten],(196) [who],(433) [histories],(159) [wise],(156) [any],(430) [first],(412) [three],(125) [locked],(120) [round],(454) [low],(456) [whiskers],(114) [overhead],(110) [leaves],(107) [came],(298) [Now],(105) [answer],(440) [couldn't],(101) [tea],(95) [hope],(94) [Australia],(86) [New],(86) [Please],(86) [word],(84) [glad],(365) [rather],(431) [downward],(82) [grand],(77) [Latitude],(76) [right],(401) [still],(365) [near],(441) [fallen],(461) [miles],(70) [wouldn't],(63) [brave],(62) [tumbling],(62) [hung],(54) [shelves],(55) [anything],(411) [happen],(229) [deep],(287) [under],(221) [dear],(452) [remarkable],(27) [There],(440) [eyes],(406) [daisies],(24) [worth],(446) [feel],(226) [well],(284) [reading],(17) [into],(461) [Alice],(463) [Lewis],(3) 3: [whole],(463) [sorrowful],(448) [pounds],(446) [terrier],(442) [eagerly],(440) [let],(435) [nurse],(427) [passionate],(418) [Not],(418) [notion],(411) [inquisitively],(405) [swimming],(449) [hippopotamus],(392) [railway],(381) [speed],(366) [escape],(364) [That],(387) [shrinking],(362) [guess],(359) [nearly],(359) [stay],(349) [smiling],(339) [doth],(331) [Rome],(325) [let's],(323) [thirteen],(321) [twelve],(320) [sorts],(444) [can't],(445) [knew],(311) [darkness],(300) [If],(298) [savage],(296) [white],(356) [yourself],(283) [You],(283) [give],(259) [shan't],(255) [forgot],(416) [curiouser],(249) [Tears],(246) [work],(233) [expecting],(229) [sure],(388) [growing],(357) [creep],(220) [severely],(208) [finding],(194) [usually],(164) [deeply],(164) [your],(428) [hold],(163) [burn],(163) [unpleasant],(160) [children],(379) [telescopes],(151) [wander],(138) [delight],(133) [side],(279) [it's],(446) [earnestly],(105) [hand],(293) [But],(309) [know],(446) [name],(436) [listen],(74) [schoolroom],(72) [things],(444) [an],(462) [Would],(419) [Which],(225) [managed],(58) [drop],(57) [empty],(57) [took],(303) [cupboards],(58) [falling],(87) [hedge],(38) [before],(402) [then],(457) [actually],(32) [natural],(31) [Oh],(414) [itself],(29) [making],(450) [considering],(41) [thought],(456) [no],(411) [it],(461) [do],(399) 4: [When],(454) [we],(453) [Are],(439) [Don't],(435) [subject],(439) [you'd],(431) [yet],(422) [beg],(444) [leap],(413) [lesson],(413) [its],(455) [something],(390) [wooden],(380) [sand],(380) [salt],(374) [worse],(369) [It'll],(346) [play],(344) [pour],(333) [tail],(434) [Improve],(332) [sounded],(328) [hands],(354) [knows],(318) [goes],(315) [queer],(388) [dropped],(361) [voice],(456) [kid],(356) [returning],(292) [presents],(264) [They],(263) [myself],(256) [deal],(364) [largest],(251) [life],(377) [cake],(233) [advise],(205) [nervous],(187) [further],(187) [brightened],(184) [finished],(233) [later],(167) [disagree],(166) [certain],(430) [cut],(163) [read],(159) [marked],(218) [Drink],(156) [beautifully],(218) [shutting],(180) [shut],(367) [head],(274) [bright],(442) [second],(130) [open],(129) [Alice's],(127) [tiny],(126) [been],(377) [row],(380) [behind],(381) [wind],(113) [long],(442) [my],(457) [cat],(422) [Dinah],(422) [miss],(93) [country],(85) [didn't],(416) [knowledge],(410) [several],(462) [four],(321) [earth],(81) [me],(435) [past],(59) [somebody],(350) [fear],(57) [noticed],(131) [sides],(52) [too],(371) [make],(391) [going],(360) [straight],(43) [how],(411) [went],(450) [rabbit],(43) [looked],(404) [this],(454) [wondered],(31) [late],(114) [shall],(386) [mind],(345) [she],(452) [very],(411) [Hole],(12) 5: [shore],(464) [called],(452) [commotion],(450) [offended],(448) [lazily],(425) [sentence],(412) [wink],(405) [houses],(380) [bathing],(379) [sea],(379) [splash],(374) [sudden],(413) [putting],(346) [poky],(343) [spread],(337) [lap],(327) [Paris],(324) [signify],(323) [Besides],(318) [ready],(297) [ashamed],(283) [planning],(262) [common],(231) [dull],(230) [holding],(361) [against],(274) [box],(216) [sharply],(205) [cried],(447) [climb],(199) [reach],(220) [possibly],(198) [more],(431) [altogether],(362) [lovely],(185) [face],(455) [toffee],(172) [roast],(171) [finger],(164) [It],(460) [hoping],(149) [doorway],(140) [longed],(138) [along],(294) [led],(463) [opened],(217) [sight],(253) [mouse],(409) [else],(350) [No],(345) [And],(443) [Do],(452) [ask],(297) [sound],(84) [listening],(83) [idea],(375) [practice],(74) [though],(206) [centre],(69) [somewhere],(90) [ve],(448) [home],(63) [put],(355) [labelled],(56) [saw],(137) [were],(461) [next],(344) [wonder],(306) [look],(347) [fell],(216) [burning],(36) [started],(299) [all],(447) [time],(460) [ought],(283) [afterwards],(30) [did],(440) [that],(461) [be],(430) [chain],(23) [hot],(304) [for],(460) [conversation],(439) [in],(456) [pictures],(54) [book],(413) [peeped],(17) [once],(377) [nothing],(406) [by],(426) [of],(445) [beginning],(15) 6: [pale],(455) [dinner],(444) [throw],(443) [brown],(443) [trembling],(456) [We],(433) [fire],(426) [nicely],(426) [tone],(448) [French],(413) [understand],(458) [brother's],(403) [harm],(398) [walrus],(392) [hadn't],(385) [wherever],(378) [general],(377) [case],(376) [somehow],(375) [foot],(373) [existence],(366) [measure],(358) [welcome],(338) [grin],(336) [waters],(333) [capital],(427) [London],(324) [doesn't],(408) [Ada],(315) [yesterday],(305) [splendidly],(292) [shedding],(286) [Just],(390) [one's],(264) [new],(259) [want],(259) [anxiously],(224) [ate],(224) [can],(398) [hardly],(213) [pretend],(212) [two],(359) [pretending],(211) [game],(209) [scolded],(207) [sat],(280) [thing],(427) [now],(396) [What],(180) [almost],(308) [because],(161) [beasts],(160) [wild],(160) [ll],(457) [hurry],(438) [printed],(154) [only],(423) [telescope],(251) [flowers],(139) [inches],(287) [locks],(128) [glass],(368) [table],(368) [roof],(274) [away],(449) [hurrying],(112) [passage],(137) [question],(309) [dreamy],(99) [bats],(101) [air],(96) [Antipathies],(82) [their],(351) [among],(139) [funny],(263) [Presently],(80) [sort],(170) [likely],(398) [even],(140) [stairs],(62) [from],(449) [filled],(342) [they],(351) [dark],(138) [tried],(199) [First],(186) [found],(360) [some],(379) [hole],(136) [after],(452) [pocket],(35) [feet],(383) [hear],(435) [when],(443) [day],(388) [twice],(16) [Rabbit],(299) [Down],(92) 7: [softly],(452) [farmer],(445) [curly],(442) [eyed],(442) [vulgar],(435) [catching],(428) [paws],(426) [purring],(425) [soothing],(421) [clear],(411) [daresay],(409) [Perhaps],(408) [drowned],(387) [number],(379) [water],(414) [slipped],(394) [these],(373) [rapidly],(360) [till],(350) [Tell],(348) [toys],(344) [gently],(339) [neatly],(337) [wrong],(325) [puzzling],(319) [Mabel],(346) [mine],(316) [Ah],(310) [everything],(388) [skurried],(300) [desperate],(296) [Duchess],(295) [fan],(361) [hopeless],(280) [odd],(264) [won't],(453) [stockings],(255) [Good],(252) [Curiouser],(249) [remained],(227) [care],(222) [grow],(220) [makes],(220) [gave],(413) [legs],(200) [plainly],(198) [flame],(190) [candle],(191) [shrink],(187) [buttered],(172) [flavour],(171) [taste],(170) [ventured],(169) [knife],(164) [poker],(162) [red],(162) [taught],(162) [burnt],(160) [letters],(154) [find],(386) [impossible],(146) [really],(430) [happened],(411) [those],(341) [than],(369) [lock],(133) [fifteen],(132) [golden],(368) [solid],(126) [sadly],(122) [every],(334) [lamps],(117) [longer],(116) [jumped],(109) [hurt],(415) [truth],(105) [cats],(458) [bat],(106) [might],(284) [afraid],(448) [m],(448) [milk],(95) [saucer],(95) [Dinah'll],(93) [she'll],(89) [fancy],(423) [Zealand],(86) [heads],(351) [showing],(73) [opportunity],(73) [lessons],(345) [you],(457) [end],(433) [top],(225) [fall],(107) [such],(442) [jar],(57) [coming],(291) [about],(453) [not],(440) [The],(440) [another],(373) [In],(40) [see],(423) [curiosity],(36) [occurred],(30) [White],(292) [picking],(24) [whether],(158) [use],(396) [but],(406) [to],(463) 8: [party],(463) [creatures],(463) [Eaglet],(462) [Dodo],(462) [you'll],(457) [us],(456) [hundred],(446) [says],(447) [sit],(444) [dog],(441) [family],(434) [Our],(434) [bristling],(429) [soft],(427) [quiet],(424) [animal's],(416) [talk],(453) [punished],(386) [swam],(463) [seaside],(377) [live],(343) [With],(339) [scale],(334) [Nile],(333) [his],(434) [strange],(329) [Who],(348) [morning],(308) [violently],(299) [dressed],(292) [dried],(291) [heard],(454) [gallons],(286) [Poor],(278) [nine],(382) [struck],(274) [sending],(264) [carrier],(263) [pair],(293) [able],(256) [bye],(252) [speak],(396) [same],(329) [respectable],(213) [enough],(213) [child],(369) [remembered],(402) [followed],(207) [crying],(284) [there's],(398) [Come],(347) [best],(257) [waited],(186) [feeling],(308) [curious],(462) [simple],(161) [paper],(153) [bottle],(169) [knelt],(136) [high],(460) [curtain],(131) [However],(388) [legged],(125) [Suddenly],(125) [walked],(122) [door],(367) [other],(462) [hanging],(118) [turned],(454) [lost],(112) [thump],(106) [ever],(369) [sometimes],(207) [eat],(219) [mice],(428) [are],(439) [girl],(284) [seem],(264) [got],(357) [learnt],(71) [thousand],(70) [Why],(212) [passed],(55) [there],(461) [slowly],(455) [stopping],(45) [tunnel],(43) [again],(453) [world],(310) [moment],(374) [down],(433) [just],(362) [never],(402) [quite],(460) [have],(356) [over],(429) [out],(413) [think],(423) [so],(446) [pink],(25) [getting],(460) [sleepy],(99) [as],(450) [own],(387) [without],(142) [what],(391) [bank],(16) [sister],(17) [sitting],(15) [get],(456) 9: [Duck],(462) [animals],(461) [kills],(447) [dogs],(458) [nasty],(435) [always],(435) [washing],(426) [licking],(426) [sits],(425) [show],(441) [feelings],(416) [chatte],(412) [ago],(411) [Mouse],(454) [Everything],(397) [nearer],(391) [splashing],(390) [conclusion],(378) [bad],(371) [narrow],(364) [alone],(352) [being],(387) [seems],(336) [repeat],(328) [twenty],(322) [age],(311) [different],(309) [hard],(449) [help],(297) [reaching],(287) [far],(256) [eats],(228) [surprised],(355) [lying],(368) [eye],(279) [Soon],(216) [person],(349) [fond],(439) [tears],(387) [generally],(227) [leave],(205) [he],(446) [tart],(171) [bleeds],(164) [neck],(152) [rules],(161) [back],(455) [cool],(139) [loveliest],(137) [rat],(136) [larger],(219) [small],(393) [belong],(127) [wondering],(123) [doors],(128) [lit],(117) [hall],(303) [corner],(116) [bit],(224) [dry],(107) [sticks],(107) [tell],(457) [begun],(145) [dozing],(103) [felt],(429) [which],(412) [catch],(97) [should],(441) [asking],(89) [through],(280) [began],(412) [nice],(441) [Longitude],(77) [distance],(291) [good],(364) [Let],(456) [aloud],(68) [said],(456) [herself],(424) [like],(454) [large],(293) [pop],(37) [fortunately],(37) [watch],(35) [waistcoat],(35) [either],(453) [flashed],(34) [way],(463) [up],(444) [trouble],(256) [would],(434) [stupid],(230) [could],(449) [having],(402) [and],(463) [on],(440) [her],(455) speech_tools/testsuite/correct/pathname_regression.out0000644000076400007640000000052307262605664022156 0ustar awbawb f = section/test.foo g = dir/subdir/ abs = /tmp f.as_directory() = section/test.foo/ f.as_file() = section/test.foo g.as_directory() = dir/subdir/ g.as_file() = dir/subdir f is file g is directory g is relative abs is absolute g + f = dir/subdir/section/test.foo g + abs = /tmp abs + g + f = /tmp/dir/subdir/section/test.foo speech_tools/testsuite/correct/feature_regression.out0000644000076400007640000000036707262605664022022 0ustar awbawbPart of speech for p is Noun Duration for p is 2.76 Stress value for p is 2 Part of speech for p is Noun Syntactic Category for p is Noun Anterior value is: +Coronal value is: +Anterior value is: +Coronal value is: +This is true: 1This is false: 0speech_tools/testsuite/correct/ch_track_script.out0000644000076400007640000001175110643442716021262 0ustar awbawb ch_track htk to esps to nist: pass ch_track htk to ascii to htk: pass ch_track htk to htk_user to htk: pass ../lib/example_data/ch_track.htk Number of frames: 200 Number of channels: 13 File type: htk Frame shift: 0.01 Channel: 0: c1 Channel: 1: c2 Channel: 2: c3 Channel: 3: c4 Channel: 4: c5 Channel: 5: c6 Channel: 6: c7 Channel: 7: c8 Channel: 8: c9 Channel: 9: c10 Channel: 10: c11 Channel: 11: c12 Channel: 12: E Usage: ch_track [input file] -o [output file] [options] Summary: change/copy track files use "-" to make input and output files stdin/out -h Options help -itype Input file type (optional). If no type is specified type is automatically derived from file's header. Supported types are: none, esps, est, est_binary, htk, htk_fbank, htk_mfcc, htk_mfcc_e, htk_user, htk_discrete, ssff, xmg, xgraph, ema, ema_swapped, ascii -ctype Contour type: F0, track -s Frame spacing of input in seconds, for unheadered input file -startt Time of first frame, for formats which don't provide this -c Select a subset of channels (starts from 0). Tracks can have multiple channels. This option specifies a list of numbers, refering to the channel numbers which are to be used for for processing. -start Extract track starting at this time, specified in seconds -end Extract track ending at this time, specified in seconds -from Extract track starting at this frame position -to Extract track ending at this frame position -otype {ascii} Output file type, if unspecified ascii is assumed, types are: none, esps, est, est_binary, htk, htk_fbank, htk_mfcc, htk_mfcc_e, htk_user, htk_discrete, ssff, xmg, xgraph, ema, ema_swapped, ascii, label -S Frame spacing of output in seconds. If this is different from the internal spacing, the contour is resampled at this spacing -o Output filename, defaults to stdout -info Print information about file and header. This option gives useful information such as file length, file type, channel names. No output is produced -track_names File containing new names for output channels -diff Differentiate contour. This performs simple numerical differentiation on the contour by subtracting the amplitude of the current frame from the amplitude of the next. Although quick, this technique is crude and not recommende as the estimation of the derivate is done on only one point -delta Make delta coefficients (better form of differentiate). The argument to this option is the regression length of of the delta calculation and can be between 2 and 4 -sm Length of smoothing window in seconds. Various types of smoothing are available for tracks. This options specifies length of the smooting window which effects the degree of smoothing, i.e. a longer value means more smoothing -smtype Smooth type, median or mean -style Convert track to other form. Currently only one form "label" is supported. This uses a specified cut off to make a label file, with two labels, one for above the cut off (-pos) and one for below (-neg) -t threshold for track to label conversion -neg Name of negative label in track to label conversion -pos Name of positive label in track to label conversion -pc Combine given tracks in parallel. If option is longest, pad shorter tracks to longest, else if first pad/cut to match first input track AvailablE track file formats: none unknown track file type esps entropic sps file est Edinburgh Speech Tools track file est_binary Edinburgh Speech Tools track file htk htk file htk_fbank htk file (as FBANK) htk_mfcc htk file (as MFCC) htk_mfcc_e htk file (as MFCC_E) htk_user htk file (as USER) htk_discrete htk file (as DISCRETE) ssff Macquarie University's Simple Signal File Format xmg xmg file viewer xgraph xgraph display program format ema ema ema_swapped ema, swapped ascii ascii decimal numbers ../lib/example_data/ch_track.htk Number of frames: 200 Number of channels: 13 File type: htk Frame shift: 0.01 Channel: 0: c1 Channel: 1: c2 Channel: 2: c3 Channel: 3: c4 Channel: 4: c5 Channel: 5: c6 Channel: 6: c7 Channel: 7: c8 Channel: 8: c9 Channel: 9: c10 Channel: 10: c11 Channel: 11: c12 Channel: 12: E tmp/ch_track.esps Number of frames: 200 Number of channels: 13 File type: esps Frame shift: 0.01 Channel: 0: c1 Channel: 1: c2 Channel: 2: c3 Channel: 3: c4 Channel: 4: c5 Channel: 5: c6 Channel: 6: c7 Channel: 7: c8 Channel: 8: c9 Channel: 9: c10 Channel: 10: c11 Channel: 11: c12 Channel: 12: E speech_tools/testsuite/correct/ch_wave_script.out0000644000076400007640000001467107262605664021132 0ustar awbawb ch_wave nist to esps to nist: pass ch_wave nist to snd to nist: pass ch_wave nist to riff to nist: pass ch_wave nist to audlab to nist: pass ch_wave nist to aiff to nist: pass ch_wave nist to est to nist: pass ch_wave raw binary test: pass ch_wave raw ascii test: pass ch_wave byte order test: pass ch_wave stdio test1: pass ch_wave stdio test2: pass ch_wave stdio test3: pass ch_wave stdio test4: pass ch_wave subwave test1: pass ch_wave subwave test2: pass ch_wave concat : pass ch_wave channel combine/extract : pass ch_wave default file type: pass Duration: 0.0724 Sample rate: 8000 Number of samples: 579 Number of channels: 1 Header type: nist Data type: short Duration: 0.3144 Sample rate: 8000 Number of samples: 2515 Number of channels: 1 Header type: nist Data type: short Duration: 0.6118 Sample rate: 8000 Number of samples: 4894 Number of channels: 1 Header type: nist Data type: short Duration: 0.5088 Sample rate: 8000 Number of samples: 4070 Number of channels: 1 Header type: nist Data type: short ch_wave key extract : pass Duration: 2.0182 Sample rate: 8000 Number of samples: 16146 Number of channels: 1 Header type: nist Data type: short Usage: ch_wave [input file0] [input file1] ... -o [output file] Summary: change/copy/combine waveform files use "-" to make input and output files stdin/out -h Options help -itype Input file type (optional). If set to raw, this indicates that the input file does not have a header. While this can be used to specify file types other than raw, this is rarely used for other purposes as the file type of all the existing supported types can be determined automatically from the file's header. If the input file is unheadered, files are assumed to be shorts (16bit). Supported types are nist, est, esps, snd, riff, aiff, audlab, raw, ascii -n Number of channels in an unheadered input file -f Sample rate in Hertz for an unheadered input file -ibo Input byte order in an unheadered input file: possibliities are: MSB , LSB, native or nonnative. Suns, HP, SGI Mips, M68000 are MSB (big endian) Intel, Alpha, DEC Mips, Vax are LSB (little endian) -iswap Swap bytes. (For use on an unheadered input file) -istype Sample type in an unheadered input file: short, mulaw, byte, ascii -c Select a single channel (starts from 0). Waveforms can have multiple channels. This option extracts a single channel for progcessing and discards the rest. -start Extract sub-wave starting at this time, specified in seconds -end Extract sub-wave ending at this time, specified in seconds -from Extract sub-wave starting at this sample point -to Extract sub-wave ending at this sample point -o Output filename. If not specified output is to stdout. -otype Output file type, (optional). If no type is Specified the type of the input file is assumed. Supported types are: nist, est, esps, snd, riff, aiff, audlab, raw, ascii -F Output sample rate in Hz. If this is different from the input sample rate, resampling will occur -obo Output byte order: MSB, LSB, native, or nonnative. Suns, HP, SGI Mips, M68000 are MSB (big endian) Intel, Alpha, DEC Mips, Vax are LSB (little endian) -oswap Swap bytes when saving to output -ostype Output sample type: short, mulaw, byte or ascii -scale Scaling factor. Increase or descrease the amplitude of the whole waveform by the factor given -scaleN Scaling factor with normalization. The waveform is scaled to its maximum level, after which it is scaled by the factor given -lpfilter Low pass filter, with cutoff frequency in Hz Filtering is performed by a FIR filter which is built at run time. The order of the filter can be given by -forder. The default value is 199 -hpfilter High pass filter, with cutoff frequency in Hz Filtering is performed by a FIR filter which is built at run time. The order of the filter can be given by -forder. The default value is 199. -forder Order of FIR filter used for lpfilter and hpfilter. This must be ODD. Sensible values range from 19 (quick but with a shallow rolloff) to 199 (slow but with a steep rolloff). The default is 199. -fafter Do filtering after other operations such as resampling (default : filter before other operations) -info Print information about file and header. This option gives useful information such as file length, sampling rate, number of channels etc No output is produced -add A new single channel waveform is created by adding the corresponding sample points of each input waveform -pc Combine input waveforms to form a single multichannel waveform. The argument to this option controls how long the new waveform should be. If the option is LONGEST, the output wave if the length of the longest input wave and shorter waves are padded with zeros at the end. If the option is FIRST, the length of the new waveform is the length of the first file on the command line, and subsequent waves are padded or cut to this length -key Label file designating subsections, for use with -divide. The KEYLAB file is a label file which specifies where chunks (such as individual sentences) in a waveform begin and end. See section of wave extraction. -divide Divide a single input waveform into multiple output waveforms. Each output waveform is extracted from the input waveform by using the KEYLAB file, which specifies the start and stop times for each chunk. The output files are named according to the filename in the KEYLAB file, with extension given by -ext. See section on wave extraction -ext File extension for divided waveforms -extract Used in conjunction with -key to extract a single section of waveform from the input waveform. The argument is the name of a file given in the file column of the KEYLAB file. Duration: 2.0182 Sample rate: 8000 Number of samples: 16146 Number of channels: 1 Header type: nist Data type: short Duration: 2.0637 Sample rate: 20000 Number of samples: 41274 Number of channels: 1 Header type: nist Data type: short Duration: 2.0714 Sample rate: 8000 Number of samples: 16571 Number of channels: 1 Header type: nist Data type: short speech_tools/testsuite/correct/lpc_script.out0000644000076400007640000000240307262605664020262 0ustar awbawb LPC params tmp/kdt_001.lpc Number of frames: 391 Number of channels: 17 File type: est Frame shift: varied Channel: 0: lpc_0 Channel: 1: lpc_1 Channel: 2: lpc_2 Channel: 3: lpc_3 Channel: 4: lpc_4 Channel: 5: lpc_5 Channel: 6: lpc_6 Channel: 7: lpc_7 Channel: 8: lpc_8 Channel: 9: lpc_9 Channel: 10: lpc_10 Channel: 11: lpc_11 Channel: 12: lpc_12 Channel: 13: lpc_13 Channel: 14: lpc_14 Channel: 15: lpc_15 Channel: 16: lpc_N Duration: 3.5171 Sample rate: 16000 Number of samples: 56273 Number of channels: 1 Header type: nist Data type: short MFCC params tmp/kdt_001.mfcc Number of frames: 704 Number of channels: 24 File type: est Frame shift: varied Channel: 0: melcep_1 Channel: 1: melcep_2 Channel: 2: melcep_3 Channel: 3: melcep_4 Channel: 4: melcep_5 Channel: 5: melcep_6 Channel: 6: melcep_7 Channel: 7: melcep_8 Channel: 8: melcep_9 Channel: 9: melcep_10 Channel: 10: melcep_11 Channel: 11: melcep_N Channel: 12: melcep_d_1 Channel: 13: melcep_d_2 Channel: 14: melcep_d_3 Channel: 15: melcep_d_4 Channel: 16: melcep_d_5 Channel: 17: melcep_d_6 Channel: 18: melcep_d_7 Channel: 19: melcep_d_8 Channel: 20: melcep_d_9 Channel: 21: melcep_d_10 Channel: 22: melcep_d_11 Channel: 23: melcep_d_N expect one line containing 0s (first delta params) Number of vectors with 0s is 1 speech_tools/testsuite/correct/wagon_script.out0000644000076400007640000000026007467045745020623 0ustar awbawb Dataset of 106 vectors of 20 parameters from: ../lib/example_data/wagon.data RMSE 0.0346 Correlation is 0.6825 Mean (abs) Error 0.0272 (0.0214) wagon standard cart tree: pass speech_tools/testsuite/correct/viterbi_script.out0000644000076400007640000000016707262605664021155 0ustar awbawbNB 0.889206 NB 0.848305 NB 0.803785 NB 0.757858 NB 0.013069 B 0.343778 NB 0.889206 NB 0.848305 NB 0.803785 NB 0.757858 speech_tools/testsuite/correct/tilt_script.out0000644000076400007640000000003110067560544020445 0ustar awbawb Tilt Test no Longer run speech_tools/bin/Makefile0000644000076400007640000000675007262605664014116 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1994,1995,1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: June 1997 ## ## --------------------------------------------------------------------- ## ## Makefile for bin directory. ## ## ## ## If we are staticly linked, we link to things in main, otherwise we ## ## write scripts which set LD_LIBRARY_PATH. ## ## ## ## Things in scripts are preprocessed. ## ## ## ########################################################################### TOP=.. DIRNAME=bin FILES= Makefile ALL = .remove_links .process_scripts .link_main include $(TOP)/config/common_make_rules include $(TOP)/config/rules/bin_process.mak speech_tools/siod/Makefile0000644000076400007640000001047007262605664014276 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996,1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # # # Makefile for siod directory # # # # Note the siod code in this directory was mostly developed by # # PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. # # and hence falls under their copyright # # # # The editline library comes from Simmule Turner and Rich Salz copyright # # 1992 all rights reserved, it was inserted in the standard speech tools # # distribution in Dec 1998 # # # # Note that almost all of the files in this directory are free with no # # commercial restriction as the as so heavily based on existing free # # software # # # ########################################################################### TOP=.. DIRNAME=siod EDITLINEH = siodeditline.h editline.h el_unix.h H = siodp.h io.h EST_SiodServer.h $(EDITLINEH) TSRCS = siod.cc siod_est.cc ELSRCS = siodeditline.c el_complete.c editline.c el_sys_unix.c CSRCS = siodeditline.c CXXSRCS = slib.cc \ slib_core.cc slib_doc.cc slib_file.cc slib_format.cc \ slib_list.cc slib_math.cc slib_sys.cc slib_server.cc \ slib_str.cc slib_xtr.cc slib_repl.cc siod_fringe.cc siod_server.cc \ io.cc trace.cc EST_SiodServer.cc $(TSRCS) SRCS = $(CSRCS) $(CXXSRCS) OBJS = $(CXXSRCS:.cc=.o) $(CSRCS:.c=.o) FILES=Makefile siod.mak el_sys_win32.c $(CXXSRCS) $(ELSRCS) $(H) ALL = .buildlib include $(TOP)/config/common_make_rules DEFINES += $(IO_DEFINES) INCLUDES += $(IO_INCLUDES) speech_tools/siod/siod.mak0000644000076400007640000000621707262605664014272 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu May 28 1998 ## ## -------------------------------------------------------------------- ## ## Make definitions for when SIOD isincluded. ## ## ## ########################################################################### INCLUDE_SIOD=1 MOD_DESC_SIOD=Scheme In One Defun ifeq ($(DIRNAME),.) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) siod endif ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) siod_main.cc endif speech_tools/siod/el_sys_win32.c0000644000076400007640000001166307262616577015334 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* this version of editline does not have the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /****************************************************************************/ /* $Revision: 1.2 $ ** ** Win32 system-dependant routines for editline library. */ #include #include "editline.h" extern CONST ECHAR el_NIL[]; int el_user_intr = 0; int el_PushBack=0; int el_Pushed=0; CONST ECHAR *el_Input = el_NIL; extern void TTYflush(); STATIC HANDLE hStdin; void rl_ttyset(int Reset) { HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); hStdin = GetStdHandle(STD_INPUT_HANDLE); SetConsoleMode(hStdin, 0); SetConsoleMode(hStdout, ENABLE_PROCESSED_OUTPUT); } unsigned int TTYget() { ECHAR c; int n; TTYflush(); if (el_Pushed) { el_Pushed = 0; return el_PushBack; } if (*el_Input) return *el_Input++; if (!ReadFile(hStdin, &c, 1, &n, NULL)) c= EOF; return c; } #if !defined(S_ISDIR) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif /* !defined(S_ISDIR) */ void rl_add_slash(char *path,char *p) { #if 0 struct stat Sb; if (stat(path, &Sb) >= 0) (void)strcat(p, S_ISDIR(Sb.st_mode) ? "\\" : " "); #endif } int el_is_directory(char *path) { #if 0 struct stat Sb; if ((stat(path, &Sb) >= 0) && S_ISDIR(Sb.st_mode)) return 1; else #endif return 0; } void do_user_intr() { #if 0 if (el_user_intr) kill(getpid(),SIGINT); #endif } int tgetent(char *bp, const char *name) { /* Always OK. */ return 1; } int tgetnum(const char *id) { if (strcmp(id, "co") == 0) return 80; else if (strcmp(id, "li") == 0) return 20; return 0; } #define ESC "\033" #define ESCB "\033[" int tgetstr(const char *id, char **area) { if (strcmp(id, "le") == 0) return (int)"\010"; /* BACKSPACE */ else if (strcmp(id, "up") == 0) return 0; /* (int)ESCB "A"; */ else if (strcmp(id, "cl") == 0) return (int)ESCB "H" ESCB "J"; else if (strcmp(id, "nl") == 0) return (int)"\n"; else if (strcmp(id, "cr") == 0) return (int)"\r"; else if (strcmp(id, "nd") == 0) return 0; /* (int)ESCB "C"; */ return 0; } speech_tools/siod/slib.cc0000644000076400007640000014351311223224676014073 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * ALL RIGHTS RESERVED * Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Paradigm Associates Inc not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* gjc@paradigm.com, gjc@mitech.com Paradigm Associates Inc Phone: 617-492-6079 29 Putnam Ave, Suite 6 Cambridge, MA 02138 Release 1.0: 24-APR-88 Release 1.1: 25-APR-88, added: macros, predicates, load. With additions by Barak.Pearlmutter@DOGHEN.BOLTZ.CS.CMU.EDU: Full flonum recognizer, cleaned up uses of NULL/0. Now distributed with siod.scm. Release 1.2: 28-APR-88, name changes as requested by JAR@AI.AI.MIT.EDU, plus some bug fixes. Release 1.3: 1-MAY-88, changed env to use frames instead of alist. define now works properly. vms specific function edit. Release 1.4 20-NOV-89. Minor Cleanup and remodularization. Now in 3 files, siod.h, slib.c, siod.c. Makes it easier to write your own main loops. Some short-int changes for lightspeed C included. Release 1.5 29-NOV-89. Added startup flag -g, select stop and copy or mark-and-sweep garbage collection, which assumes that the stack/register marking code is correct for your architecture. Release 2.0 1-DEC-89. Added repl_hooks, Catch, Throw. This is significantly different enough (from 1.3) now that I'm calling it a major release. Release 2.1 4-DEC-89. Small reader features, dot, backquote, comma. Release 2.2 5-DEC-89. gc,read,print,eval, hooks for user defined datatypes. Release 2.3 6-DEC-89. save_forms, obarray intern mechanism. comment char. Release 2.3a......... minor speed-ups. i/o interrupt considerations. Release 2.4 27-APR-90 gen_readr, for read-from-string. Release 2.5 18-SEP-90 arrays added to SIOD.C by popular demand. inums. Release 2.6 11-MAR-92 function prototypes, some remodularization. Release 2.7 20-MAR-92 hash tables, fasload. Stack check. Release 2.8 3-APR-92 Bug fixes, \n syntax in string reading. Release 2.9 28-AUG-92 gc sweep bug fix. fseek, ftell, etc. Change to envlookup to allow (a . rest) suggested by bowles@is.s.u-tokyo.ac.jp. Release 2.9a 10-AUG-93. Minor changes for Windows NT. Release 3.0 12-JAN-94. Release it, include changes/cleanup recommended by andreasg@nynexst.com for the OS2 C++ compiler. Compilation and running tested using DEC C, VAX C. WINDOWS NT. GNU C on SPARC. Festival/Edinburgh Speech Tools changes (awb@cstr.ed.ac.uk) 1996-1999 Note there have been substantial changes to this from its original form which may have introduced bugs. Please contact Alan W Black (awb@cstr.ed.ac.uk) first if you find problems unless you can confirm they also exist in the original siod-3.0 release March 1999 split off functions into different files to make it easier for our documentation purposes, sorry maybe this should be called SNIOD now :-), or maybe Scheme in one Directory. */ #include #include #include #include #include #include #include #include "EST_unix.h" #include "EST_cutils.h" #include "siod.h" #include "siodp.h" #ifdef WIN32 #include "winsock2.h" #endif static int restricted_function_call(LISP l); static long repl(struct repl_hooks *h); static void gc_mark_and_sweep(void); static void gc_ms_stats_start(void); static void gc_ms_stats_end(void); static void mark_protected_registers(void); static void mark_locations(LISP *start,LISP *end); static void gc_sweep(void); static void mark_locations_array(LISP *x,long n); static LISP lreadr(struct gen_readio *f); static LISP lreadparen(struct gen_readio *f); static LISP lreadstring(struct gen_readio *f); const char *siod_version(void) {return("3.0 FIELD TEST");} LISP heap_1,heap_2; LISP heap,heap_end,heap_org; long heap_size = DEFAULT_HEAP_SIZE; long old_heap_used; long which_heap; long gc_status_flag = 0; long show_backtrace = 0; char *init_file = (char *) NULL; char *tkbuffer = NULL; long gc_kind_copying = 0; long gc_cells_allocated = 0; double gc_time_taken; LISP *stack_start_ptr; LISP freelist; long nointerrupt = 1; long interrupt_differed = 0; LISP oblistvar = NIL; LISP current_env = NIL; LISP backtrace = NIL; LISP restricted = NIL; LISP truth = NIL; LISP eof_val = NIL; LISP sym_errobj = NIL; static LISP sym_quote = NIL; static LISP sym_dot = NIL; LISP unbound_marker = NIL; LISP *obarray; long obarray_dim = 100; struct catch_frame *catch_framep = (struct catch_frame *) NULL; void (*repl_puts)(char *) = NULL; LISP (*repl_read)(void) = NULL; LISP (*repl_eval)(LISP) = NULL; void (*repl_print)(LISP) = NULL; repl_getc_fn siod_fancy_getc = f_getc; repl_ungetc_fn siod_fancy_ungetc = f_ungetc; LISP *inums; LISP siod_docstrings = NIL; /* for builtin functions */ long inums_dim = 100; struct user_type_hooks *user_types = NULL; struct gc_protected *protected_registers = NULL; jmp_buf save_regs_gc_mark; double gc_rt; long gc_cells_collected; static const char *user_ch_readm = ""; static const char *user_te_readm = ""; LISP (*user_readm)(int, struct gen_readio *) = NULL; LISP (*user_readt)(char *,long, int *) = NULL; void (*fatal_exit_hook)(void) = NULL; #ifdef THINK_C int ipoll_counter = 0; #endif FILE *fwarn=NULL; int siod_interactive = 1; extern "C" { int el_pos = -1; // actually used by readline } const char *repl_prompt = "siod>"; const char *siod_prog_name = "siod"; const char *siod_primary_prompt = "siod> "; const char *siod_secondary_prompt = "> "; // A list of objects with gc_free_once set in their user_type_hooks structure // whose gc_free function has been called in the current GC sweep. void **dead_pointers = NULL; int size_dead_pointers = 0; int num_dead_pointers = 0; #define DEAD_POINTER_GROWTH (10) static LISP set_restricted(LISP l); char *stack_limit_ptr = NULL; long stack_size = #ifdef THINK_C 10000; #else 500000; #endif void NNEWCELL(LISP *_into,long _type) {if NULLP(freelist) { gc_for_newcell(); } *_into = freelist; freelist = CDR(freelist); ++gc_cells_allocated; (*_into)->gc_mark = 0; (*_into)->type = (short) _type; } void need_n_cells(int n) { /* Check there are N cells available, and force gc if not */ LISP x = NIL; int i; for (i=0; i ") != 0) put_st(st);} static char *repl_c_string_arg = NULL; static long repl_c_string_flag = 0; static LISP repl_c_string_read(void) {LISP s; if (repl_c_string_arg == NULL) return(eof_val); s = strcons(strlen(repl_c_string_arg),repl_c_string_arg); repl_c_string_arg = NULL; return(read_from_string(get_c_string(s)));} static void ignore_print(LISP x) {(void)x; repl_c_string_flag = 1;} static void not_ignore_print(LISP x) {repl_c_string_flag = 1; pprint(x);} long repl_c_string(char *str, long want_sigint,long want_init,long want_print) {struct repl_hooks h; long retval; if (want_print) h.repl_puts = noprompt_puts; else h.repl_puts = ignore_puts; h.repl_read = repl_c_string_read; h.repl_eval = NULL; if (want_print) h.repl_print = not_ignore_print; else h.repl_print = ignore_print; repl_c_string_arg = str; repl_c_string_flag = 0; retval = repl_driver(want_sigint,want_init,&h); if (retval != 0) return(retval); else if (repl_c_string_flag == 1) return(0); else return(2);} #ifdef unix #include #include double myruntime(void) {double total; struct tms b; times(&b); total = b.tms_utime; total += b.tms_stime; return(total / 60.0);} #else #if defined(THINK_C) | defined(WIN32) | defined(VMS) #ifndef CLOCKS_PER_SEC #define CLOCKS_PER_SEC CLK_TCK #endif double myruntime(void) {return(((double) clock()) / ((double) CLOCKS_PER_SEC));} #else double myruntime(void) {time_t x; time(&x); return((double) x);} #endif #endif void set_repl_hooks(void (*puts_f)(char *), LISP (*read_f)(void), LISP (*eval_f)(LISP), void (*print_f)(LISP)) {repl_puts = puts_f; repl_read = read_f; repl_eval = eval_f; repl_print = print_f;} void fput_st(FILE *f,const char *st) {long flag; if (f != NULL) /* so we can block warning messages easily */ { flag = no_interrupt(1); fprintf(f,"%s",st); no_interrupt(flag); } } void put_st(const char *st) {fput_st(stdout,st);} void grepl_puts(char *st,void (*repl_putss)(char *)) {if (repl_putss == NULL) {fput_st(fwarn,st); if (fwarn != NULL) fflush(stdout);} else (*repl_putss)(st);} static void display_backtrace(LISP args) { /* Display backtrace information */ LISP l; int i; int local_show_backtrace = show_backtrace; show_backtrace = 0; // so we don't recurse if an error occurs if (cdr(args) == NIL) { printf("BACKTRACE:\n"); for (i=0,l=backtrace; l != NIL; l=cdr(l),i++) { fprintf(stdout,"%4d: ",i); pprintf(stdout,car(l),3,72,2,2); fprintf(stdout,"\n"); } } else if (FLONUMP(car(cdr(args)))) { printf("BACKTRACE:\n"); int nth = (int)FLONM(car(cdr(args))); LISP frame = siod_nth(nth,backtrace); fprintf(stdout,"%4d: ",nth); pprintf(stdout,frame,3,72,-1,-1); fprintf(stdout,"\n"); } show_backtrace = local_show_backtrace; } static long repl(struct repl_hooks *h) {LISP x,cw = 0; double rt; gc_kind_copying = 0; while(1) { #if 0 if ((gc_kind_copying == 1) && ((gc_status_flag) || heap >= heap_end)) {rt = myruntime(); gc_stop_and_copy(); sprintf(tkbuffer, "GC took %g seconds, %ld compressed to %ld, %ld free\n", myruntime()-rt,old_heap_used, (long)(heap-heap_org),(long)(heap_end-heap)); grepl_puts(tkbuffer,h->repl_puts);} /* grepl_puts("> ",h->repl_puts); */ #endif if (h->repl_read == NULL) x = lread(); else x = (*h->repl_read)(); if EQ(x,eof_val) break; rt = myruntime(); if (gc_kind_copying == 1) cw = heap; else {gc_cells_allocated = 0; gc_time_taken = 0.0;} /* Check if its a debugger command */ if ((TYPE(x) == tc_cons) && (TYPE(car(x)) == tc_symbol) && (streq(":backtrace",get_c_string(car(x))))) { display_backtrace(x); x = NIL; } else if ((restricted != NIL) && (restricted_function_call(x) == FALSE)) err("Expression contains functions not in restricted list",x); else { backtrace = NIL; /* reset backtrace info */ if (h->repl_eval == NULL) x = leval(x,NIL); else x = (*h->repl_eval)(x); } if (gc_kind_copying == 1) sprintf(tkbuffer, "Evaluation took %g seconds %ld cons work\n", myruntime()-rt, (long)(heap-cw)); else sprintf(tkbuffer, "Evaluation took %g seconds (%g in gc) %ld cons work\n", myruntime()-rt, gc_time_taken, gc_cells_allocated); grepl_puts(tkbuffer,h->repl_puts); setvar(rintern("!"),x,NIL); /* save value in var called '!' */ if (h->repl_print == NULL) { if (siod_interactive) pprint(x); /* pretty print the result */ } else (*h->repl_print)(x);} return(0);} void set_fatal_exit_hook(void (*fcn)(void)) {fatal_exit_hook = fcn;} static LISP err(const char *message, LISP x, const char *s) { nointerrupt = 1; if NNULLP(x) { fprintf(stderr,"SIOD ERROR: %s %s: ", (message) ? message : "?", (s) ?s : "" ); lprin1f(x,stderr); fprintf(stderr,"\n"); fflush(stderr); } else { fprintf(stderr,"SIOD ERROR: %s %s\n", (message) ? message : "?", (s) ? s : "" ); fflush(stderr); } if (show_backtrace == 1) display_backtrace(NIL); if (errjmp_ok == 1) {setvar(sym_errobj,x,NIL); longjmp(*est_errjmp,1);} close_open_files(); /* can give clue to where error is */ fprintf(stderr,"%s: fatal error exiting.\n",siod_prog_name); if (fatal_exit_hook) (*fatal_exit_hook)(); else exit(1); return(NIL); } LISP err(const char *message, LISP x) { return err(message, x, NULL); } LISP err(const char *message, const char *x) { return err(message, NULL, x); } LISP errswitch(void) {return(err("BUG. Reached impossible case",NIL));} void err_stack(char *ptr) /* The user could be given an option to continue here */ {(void)ptr; err("the currently assigned stack limit has been exceded",NIL);} LISP stack_limit(LISP amount,LISP silent) {if NNULLP(amount) {stack_size = get_c_int(amount); stack_limit_ptr = STACK_LIMIT(stack_start_ptr,stack_size);} if NULLP(silent) {sprintf(tkbuffer,"Stack_size = %ld bytes, [%p,%p]\n", stack_size,(void *)stack_start_ptr,(void *)stack_limit_ptr); put_st(tkbuffer); return(NIL);} else return(flocons(stack_size));} const char *get_c_string(LISP x) { if (NULLP(x)) return "nil"; else if TYPEP(x,tc_symbol) return(PNAME(x)); else if TYPEP(x,tc_flonum) { if (FLONMPNAME(x) == NULL) { char b[TKBUFFERN]; sprintf(b,"%.8g",FLONM(x)); FLONMPNAME(x) = (char *)must_malloc(strlen(b)+1); sprintf(FLONMPNAME(x),"%s",b); } return FLONMPNAME(x); } else if TYPEP(x,tc_string) return(x->storage_as.string.data); else err("not a symbol or string",x); return(NULL);} LISP lerr(LISP message, LISP x) {err(get_c_string(message),x); return(NIL);} void gc_fatal_error(void) {err("ran out of storage",NIL);} LISP newcell(long type) {LISP z; NEWCELL(z,type); return(z);} LISP flocons(double x) {LISP z; long n=0; if ((inums_dim > 0) && ((x - (n = (long)x)) == 0) && (x >= 0) && (n < inums_dim)) return(inums[n]); NEWCELL(z,tc_flonum); FLONMPNAME(z) = NULL; FLONM(z) = x; return(z);} LISP symcons(char *pname,LISP vcell) {LISP z; NEWCELL(z,tc_symbol); PNAME(z) = pname; VCELL(z) = vcell; return(z);} char *must_malloc(unsigned long size) {char *tmp; tmp = walloc(char,size); if (tmp == (char *)NULL) err("failed to allocate storage from system",NIL); return(tmp);} LISP gen_intern(char *name,int require_copy) {LISP l,sym,sl; const unsigned char *cname; long hash=0,n,c,flag; flag = no_interrupt(1); if (name == NULL) return NIL; else if (obarray_dim > 1) {hash = 0; n = obarray_dim; cname = (unsigned char *)name; while((c = *cname++)) hash = ((hash * 17) ^ c) % n; sl = obarray[hash];} else sl = oblistvar; for(l=sl;NNULLP(l);l=CDR(l)) if (strcmp(name,PNAME(CAR(l))) == 0) {no_interrupt(flag); return(CAR(l));} /* Need a new symbol */ if (require_copy) sym = symcons(wstrdup(name),unbound_marker); else sym = symcons(name,unbound_marker); if (obarray_dim > 1) obarray[hash] = cons(sym,sl); oblistvar = cons(sym,oblistvar); no_interrupt(flag); return(sym);} LISP cintern(const char *name) { char *dname = (char *)(void *)name; return(gen_intern(dname,FALSE)); } LISP rintern(const char *name) { if (name == 0) return NIL; char *dname = (char *)(void *)name; return gen_intern(dname,TRUE); } LISP intern(LISP name) {return(rintern(get_c_string(name)));} LISP subrcons(long type, const char *name, SUBR_FUNC f) {LISP z; NEWCELL(z,type); (*z).storage_as.subr.name = name; (*z).storage_as.subr0.f = f; return(z);} LISP closure(LISP env,LISP code) {LISP z; NEWCELL(z,tc_closure); (*z).storage_as.closure.env = env; (*z).storage_as.closure.code = code; return(z);} void gc_unprotect(LISP *location) { /* allow LISP values in a location top be gc'ed again */ struct gc_protected *reg,*l; for(l=0,reg = protected_registers; reg; reg = reg->next) { if (reg->location == location) break; l = reg; } if (reg == 0) { fprintf(stderr,"Cannot unprotected %lx: never protected\n", (unsigned long)*location); fflush(stderr); } else if (l==0) /* its the first one in the list that needs to be deleted */ { reg = protected_registers; protected_registers = reg->next; wfree(reg); } else { reg = l->next; l->next = reg->next; wfree(reg); } return; } void gc_protect(LISP *location) { struct gc_protected *reg; for(reg = protected_registers; reg; reg = reg->next) { if (reg->location == location) return; // already protected } // not protected so add it gc_protect_n(location,1); } void gc_protect_n(LISP *location,long n) {struct gc_protected *reg; reg = (struct gc_protected *) must_malloc(sizeof(struct gc_protected)); (*reg).location = location; (*reg).length = n; (*reg).next = protected_registers; protected_registers = reg;} void gc_protect_sym(LISP *location,const char *st) {*location = cintern(st); gc_protect(location);} void scan_registers(void) {struct gc_protected *reg; LISP *location; long j,n; for(reg = protected_registers; reg; reg = (*reg).next) {location = (*reg).location; n = (*reg).length; for(j=0;j 1) {obarray = (LISP *) must_malloc(sizeof(LISP) * obarray_dim); for(j=0;j 0) {inums = (LISP *) must_malloc(sizeof(LISP) * inums_dim); for(j=0;j= 0) && (type < tc_table_dim)) return(&user_types[type]); else err("type number out of range",NIL); return(NULL);} int siod_register_user_type(const char *name) { // Register a new object type for LISP static int siod_user_type = tc_first_user_type; int new_type = siod_user_type; struct user_type_hooks *th; if (new_type == tc_table_dim) { cerr << "SIOD: no more new types allowed, tc_table_dim needs increased" << endl; return tc_table_dim-1; } else siod_user_type++; th=get_user_type_hooks(new_type); th->name = wstrdup(name); return new_type; } void set_gc_hooks(long type, int gc_free_once, LISP (*rel)(LISP), LISP (*mark)(LISP), void (*scan)(LISP), void (*free)(LISP), void (*clear)(LISP), long *kind) {struct user_type_hooks *p; p = get_user_type_hooks(type); p->gc_free_once = gc_free_once; p->gc_relocate = rel; p->gc_scan = scan; p->gc_mark = mark; p->gc_free = free; p->gc_clear = clear; *kind = gc_kind_copying;} LISP gc_relocate(LISP x) {LISP nw; struct user_type_hooks *p; if EQ(x,NIL) return(NIL); if ((*x).gc_mark == 1) return(CAR(x)); switch TYPE(x) {case tc_flonum: if (FLONMPNAME(x) != NULL) wfree(FLONMPNAME(x)); /* free the print name */ FLONMPNAME(x) = NULL; case tc_cons: case tc_symbol: case tc_closure: case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: if ((nw = heap) >= heap_end) gc_fatal_error(); heap = nw+1; memcpy(nw,x,sizeof(struct obj)); break; default: p = get_user_type_hooks(TYPE(x)); if (p->gc_relocate) nw = (*p->gc_relocate)(x); else {if ((nw = heap) >= heap_end) gc_fatal_error(); heap = nw+1; memcpy(nw,x,sizeof(struct obj));}} (*x).gc_mark = 1; CAR(x) = nw; return(nw);} LISP get_newspace(void) {LISP newspace; if (which_heap == 1) {newspace = heap_2; which_heap = 2;} else {newspace = heap_1; which_heap = 1;} heap = newspace; heap_org = heap; heap_end = heap + heap_size; return(newspace);} void scan_newspace(LISP newspace) {LISP ptr; struct user_type_hooks *p; for(ptr=newspace; ptr < heap; ++ptr) {switch TYPE(ptr) {case tc_cons: case tc_closure: CAR(ptr) = gc_relocate(CAR(ptr)); CDR(ptr) = gc_relocate(CDR(ptr)); break; case tc_symbol: VCELL(ptr) = gc_relocate(VCELL(ptr)); break; case tc_flonum: case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: break; default: p = get_user_type_hooks(TYPE(ptr)); if (p->gc_scan) (*p->gc_scan)(ptr);}}} void free_oldspace(LISP space,LISP end) {LISP ptr; struct user_type_hooks *p; for(ptr=space; ptr < end; ++ptr) if (ptr->gc_mark == 0) switch TYPE(ptr) {case tc_cons: case tc_closure: case tc_symbol: break; case tc_flonum: if (FLONMPNAME(ptr) != NULL) wfree(FLONMPNAME(ptr)); /* free the print name */ FLONMPNAME(ptr) = NULL; break; case tc_string: wfree(ptr->storage_as.string.data); break; case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: break; default: p = get_user_type_hooks(TYPE(ptr)); if (p->gc_free) (*p->gc_free)(ptr); } } void gc_stop_and_copy(void) {LISP newspace,oldspace,end; long flag; int ej_ok; flag = no_interrupt(1); fprintf(stderr,"GC ing \n"); ej_ok = errjmp_ok; errjmp_ok = 0; oldspace = heap_org; end = heap; old_heap_used = end - oldspace; newspace = get_newspace(); scan_registers(); scan_newspace(newspace); free_oldspace(oldspace,end); errjmp_ok = ej_ok; no_interrupt(flag);} void gc_for_newcell(void) {long flag; int ej_ok; /* if (errjmp_ok == 0) gc_fatal_error(); */ flag = no_interrupt(1); ej_ok = errjmp_ok; errjmp_ok = 0; gc_mark_and_sweep(); errjmp_ok = ej_ok; no_interrupt(flag); if NULLP(freelist) gc_fatal_error();} static void gc_mark_and_sweep(void) {LISP stack_end; gc_ms_stats_start(); setjmp(save_regs_gc_mark); mark_locations((LISP *) save_regs_gc_mark, (LISP *) (((char *) save_regs_gc_mark) + sizeof(save_regs_gc_mark))); mark_protected_registers(); mark_locations((LISP *) stack_start_ptr, (LISP *) &stack_end); #ifdef THINK_C mark_locations((LISP *) ((char *) stack_start_ptr + 2), (LISP *) ((char *) &stack_end + 2)); #endif gc_sweep(); gc_ms_stats_end();} static void gc_ms_stats_start(void) {gc_rt = myruntime(); gc_cells_collected = 0; if (gc_status_flag) fprintf(stderr,"[starting GC]\n");} static void gc_ms_stats_end(void) {gc_rt = myruntime() - gc_rt; gc_time_taken = gc_time_taken + gc_rt; if (gc_status_flag) fprintf(stderr,"[GC took %g cpu seconds, %ld cells collected]\n", gc_rt, gc_cells_collected);} void gc_mark(LISP ptr) {struct user_type_hooks *p; gc_mark_loop: if NULLP(ptr) return; if ((*ptr).gc_mark) return; (*ptr).gc_mark = 1; switch ((*ptr).type) {case tc_flonum: break; case tc_cons: gc_mark(CAR(ptr)); ptr = CDR(ptr); goto gc_mark_loop; case tc_symbol: ptr = VCELL(ptr); goto gc_mark_loop; case tc_closure: gc_mark((*ptr).storage_as.closure.code); ptr = (*ptr).storage_as.closure.env; goto gc_mark_loop; case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: break; case tc_string: break; case tc_lsubr: case tc_fsubr: case tc_msubr: break; default: p = get_user_type_hooks(TYPE(ptr)); if (p->gc_mark) ptr = (*p->gc_mark)(ptr);}} static void mark_protected_registers(void) {struct gc_protected *reg; LISP *location; long j,n; for(reg = protected_registers; reg; reg = (*reg).next) { location = (*reg).location; n = (*reg).length; for(j=0;j end) {tmp = start; start = end; end = tmp;} n = end - start; mark_locations_array(start,n);} static void mark_locations_array(LISP *x,long n) {int j; LISP p; for(j=0;j= heap_org) && (p < heap_end) && (((((char *)p) - ((char *)heap_org)) % sizeof(struct obj)) == 0) && NTYPEP(p,tc_free_cell)) gc_mark(p);}} static void gc_sweep(void) {LISP ptr,end,nfreelist; long n; struct user_type_hooks *p; end = heap_end; n = 0; nfreelist = NIL; start_rememberring_dead(); for(ptr=heap_org; ptr < end; ++ptr) if (((*ptr).gc_mark == 0)) {switch((*ptr).type) {case tc_flonum: if (FLONMPNAME(ptr) != NULL) wfree(FLONMPNAME(ptr)); /* free the print name */ FLONMPNAME(ptr) = NULL; break; case tc_string: wfree(ptr->storage_as.string.data); break; case tc_free_cell: case tc_cons: case tc_closure: case tc_symbol: case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: break; default: p = get_user_type_hooks(TYPE(ptr)); if (p->gc_free) { if (p->gc_free_once) { if (!is_dead(USERVAL(ptr))) { (*p->gc_free)(ptr); mark_as_dead(USERVAL(ptr)); } } else (*p->gc_free)(ptr); } } ++n; (*ptr).type = tc_free_cell; CDR(ptr) = nfreelist; nfreelist = ptr; } else { (*ptr).gc_mark = 0; p = get_user_type_hooks(TYPE(ptr)); if (p->gc_clear) (*p->gc_clear)(ptr); } gc_cells_collected = n; freelist = nfreelist; } LISP user_gc(LISP args) {long old_status_flag,flag; int ej_ok; if (gc_kind_copying == 1) err("implementation cannot GC at will with stop-and-copy\n", NIL); flag = no_interrupt(1); ej_ok = errjmp_ok; errjmp_ok = 0; old_status_flag = gc_status_flag; if NNULLP(args) { if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1; } gc_mark_and_sweep(); gc_status_flag = old_status_flag; errjmp_ok = ej_ok; no_interrupt(flag); return(NIL);} LISP set_backtrace(LISP n) { if (n) show_backtrace = 1; else show_backtrace = 0; return n; } LISP gc_status(LISP args) {LISP l; int n; if NNULLP(args) { if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1; } if (gc_kind_copying == 1) {if (gc_status_flag) fput_st(fwarn,"garbage collection is on\n"); else fput_st(fwarn,"garbage collection is off\n"); sprintf(tkbuffer,"%ld allocated %ld free\n", (long)(heap - heap_org),(long)(heap_end - heap)); fput_st(fwarn,tkbuffer);} else {if (gc_status_flag) fput_st(fwarn,"garbage collection verbose\n"); else fput_st(fwarn,"garbage collection silent\n"); {for(n=0,l=freelist;NNULLP(l); ++n) l = CDR(l); sprintf(tkbuffer,"%ld allocated %ld free\n", (long)((heap_end - heap_org) - n),(long)n); fput_st(fwarn,tkbuffer);}} return(NIL);} LISP leval_args(LISP l,LISP env) {LISP result,v1,v2,tmp; if NULLP(l) return(NIL); if NCONSP(l) err("bad syntax argument list",l); result = cons(leval(CAR(l),env),NIL); for(v1=result,v2=CDR(l); CONSP(v2); v1 = tmp, v2 = CDR(v2)) {tmp = cons(leval(CAR(v2),env),NIL); CDR(v1) = tmp;} if NNULLP(v2) err("bad syntax argument list",l); return(result);} LISP extend_env(LISP actuals,LISP formals,LISP env) { if SYMBOLP(formals) return(cons(cons(cons(formals,NIL),cons(actuals,NIL)),env)); else return(cons(cons(formals,actuals),env)); } #define ENVLOOKUP_TRICK 1 LISP global_var = NIL; LISP global_env = NIL; LISP envlookup(LISP var,LISP env) {LISP frame,al,fl,tmp; global_var = var; global_env = env; for(frame=env;CONSP(frame);frame=CDR(frame)) {tmp = CAR(frame); if NCONSP(tmp) err("damaged frame",tmp); for(fl=CAR(tmp),al=CDR(tmp);CONSP(fl);fl=CDR(fl),al=CDR(al)) {if NCONSP(al) err("too few arguments",tmp); if EQ(CAR(fl),var) return(al);} /* suggested by a user. It works for reference (although conses) but doesn't allow for set! to work properly... */ #if (ENVLOOKUP_TRICK) if (SYMBOLP(fl) && EQ(fl, var)) return(cons(al, NIL)); #endif } if NNULLP(frame) err("damaged env",env); return(NIL);} void set_eval_hooks(long type,LISP (*fcn)(LISP, LISP *,LISP *)) {struct user_type_hooks *p; p = get_user_type_hooks(type); p->leval = fcn;} LISP leval(LISP x,LISP qenv) {LISP tmp,arg1,rval; LISP env; struct user_type_hooks *p; env = qenv; STACK_CHECK(&x); backtrace = cons(x,backtrace); loop: INTERRUPT_CHECK(); current_env = env; switch TYPE(x) {case tc_symbol: tmp = envlookup(x,env); if NNULLP(tmp) { backtrace = cdr(backtrace); return(CAR(tmp)); } tmp = VCELL(x); if EQ(tmp,unbound_marker) err("unbound variable",x); backtrace = cdr(backtrace); return tmp; case tc_cons: tmp = CAR(x); switch TYPE(tmp) {case tc_symbol: tmp = envlookup(tmp,env); if NNULLP(tmp) {tmp = CAR(tmp); break;} tmp = VCELL(CAR(x)); if EQ(tmp,unbound_marker) err("unbound variable",CAR(x)); break; case tc_cons: tmp = leval(tmp,env); break;} switch TYPE(tmp) {case tc_subr_0: rval = SUBR0(tmp)(); backtrace = cdr(backtrace); return rval; case tc_subr_1: rval = SUBR1(tmp)(leval(car(CDR(x)),env)); backtrace = cdr(backtrace); return rval; case tc_subr_2: x = CDR(x); arg1 = leval(car(x),env); x = NULLP(x) ? NIL : CDR(x); rval = SUBR2(tmp)(arg1,leval(car(x),env)); backtrace = cdr(backtrace); return rval; case tc_subr_3: x = CDR(x); arg1 = leval(car(x),env); x = NULLP(x) ? NIL : CDR(x); rval = SUBR3(tmp)(arg1,leval(car(x),env),leval(car(cdr(x)),env)); backtrace = cdr(backtrace); return rval; case tc_subr_4: x = CDR(x); arg1 = leval(car(x),env); x = NULLP(x) ? NIL : CDR(x); rval = SUBR4(tmp)(arg1,leval(car(x),env), leval(car(cdr(x)),env), leval(car(cdr(cdr(x))),env)); backtrace = cdr(backtrace); return rval; case tc_lsubr: rval = SUBR1(tmp)(leval_args(CDR(x),env)); backtrace = cdr(backtrace); return rval; case tc_fsubr: rval = SUBR2(tmp)(CDR(x),env); backtrace = cdr(backtrace); return rval; case tc_msubr: if NULLP(SUBRM(tmp)(&x,&env)) { backtrace = cdr(backtrace); return(x); } goto loop; case tc_closure: env = extend_env(leval_args(CDR(x),env), car((*tmp).storage_as.closure.code), (*tmp).storage_as.closure.env); x = cdr((*tmp).storage_as.closure.code); goto loop; case tc_symbol: x = cons(tmp,cons(cons(sym_quote,cons(x,NIL)),NIL)); x = leval(x,NIL); goto loop; default: p = get_user_type_hooks(TYPE(tmp)); if (p->leval) {if NULLP((*p->leval)(tmp,&x,&env)) { backtrace = cdr(backtrace); return(x); } else goto loop;} err("bad function",tmp);} default: backtrace = cdr(backtrace); return(x);}} void set_print_hooks(long type, void (*prin1)(LISP, FILE *), void (*print_string)(LISP, char *) ) {struct user_type_hooks *p; p = get_user_type_hooks(type); p->prin1 = prin1; p->print_string = print_string; } void set_io_hooks(long type, LISP (*fast_print)(LISP,LISP), LISP (*fast_read)(int,LISP)) {struct user_type_hooks *p; p = get_user_type_hooks(type); p->fast_print = fast_print; p->fast_read = fast_read; } void set_type_hooks(long type, long (*c_sxhash)(LISP,long), LISP (*equal)(LISP,LISP)) {struct user_type_hooks *p; p = get_user_type_hooks(type); p->c_sxhash = c_sxhash; p->equal = equal; } int f_getc(FILE *f) {long iflag,dflag; int c; iflag = no_interrupt(1); dflag = interrupt_differed; c = getc(f); if ((c == '\n') && (f == stdin) && (siod_interactive)) { fprintf(stdout,"%s",repl_prompt); fflush(stdout); } #ifdef VMS if ((dflag == 0) & interrupt_differed & (f == stdin)) while((c != 0) & (c != EOF)) c = getc(f); #endif no_interrupt(iflag); return(c);} void f_ungetc(int c, FILE *f) {ungetc(c,f);} #ifdef WIN32 int winsock_unget_buffer; bool winsock_unget_buffer_unused=true; bool use_winsock_unget_buffer; int f_getc_winsock(HANDLE h) {long iflag,dflag; char c; DWORD lpNumberOfBytesRead; iflag = no_interrupt(1); if (use_winsock_unget_buffer) { use_winsock_unget_buffer = false; return winsock_unget_buffer; } if (SOCKET_ERROR == recv((SOCKET)h,&c,1,0)) { if (WSAECONNRESET == GetLastError()) // The connection was closed. c=EOF; else cerr << "f_getc_winsock(): error reading from socket\n"; } winsock_unget_buffer=c; winsock_unget_buffer_unused = false; no_interrupt(iflag); return(c);} void f_ungetc_winsock(int c, HANDLE h) { if (winsock_unget_buffer_unused) { cerr << "f_ungetc_winsock: tried to unget before reading socket\n"; } use_winsock_unget_buffer = true;} #endif int flush_ws(struct gen_readio *f,const char *eoferr) {int c,commentp; commentp = 0; while(1) {c = GETC_FCN(f); if (c == EOF) { if (eoferr) err(eoferr,NIL); else return(c); } if (commentp) {if (c == '\n') commentp = 0;} else if (c == ';') commentp = 1; else if (!isspace(c)) return(c);}} LISP lreadf(FILE *f) {struct gen_readio s; if ((f == stdin) && (isatty(0)) && (siod_interactive)) { /* readline (if selected) stuff -- only works with a terminal */ s.getc_fcn = (int (*)(char *))siod_fancy_getc; s.ungetc_fcn = (void (*)(int, char *))siod_fancy_ungetc; s.cb_argument = (char *) f; } else /* normal stuff */ { s.getc_fcn = (int (*)(char *))f_getc; s.ungetc_fcn = (void (*)(int, char *))f_ungetc; s.cb_argument = (char *) f; } return(readtl(&s));} #ifdef WIN32 LISP lreadwinsock(void) { struct gen_readio s; s.getc_fcn = (int (*)(char *))f_getc_winsock; s.ungetc_fcn = (void (*)(int, char *))f_ungetc_winsock; s.cb_argument = (char *) siod_server_socket; return(readtl(&s));} #endif LISP readtl(struct gen_readio *f) {int c; c = flush_ws(f,(char *)NULL); if (c == EOF) return(eof_val); UNGETC_FCN(c,f); return(lreadr(f));} void set_read_hooks(char *all_set,char *end_set, LISP (*fcn1)(int, struct gen_readio *), LISP (*fcn2)(char *,long, int *)) {user_ch_readm = all_set; user_te_readm = end_set; user_readm = fcn1; user_readt = fcn2;} static LISP lreadr(struct gen_readio *f) {int c,j; char *p; const char *pp, *last_prompt; LISP rval; STACK_CHECK(&f); p = tkbuffer; c = flush_ws(f,"end of file inside read"); switch (c) {case '(': last_prompt = repl_prompt; repl_prompt = siod_secondary_prompt; rval = lreadparen(f); repl_prompt = last_prompt; return rval; case ')': err("unexpected close paren",NIL); case '\'': return(cons(sym_quote,cons(lreadr(f),NIL))); case '`': return(cons(cintern("+internal-backquote"),lreadr(f))); case ',': c = GETC_FCN(f); switch(c) {case '@': pp = "+internal-comma-atsign"; break; case '.': pp = "+internal-comma-dot"; break; default: pp = "+internal-comma"; UNGETC_FCN(c,f);} return(cons(cintern(pp),lreadr(f))); case '"': last_prompt = repl_prompt; repl_prompt = siod_secondary_prompt; rval = lreadstring(f); repl_prompt = last_prompt; return rval; default: if ((user_readm != NULL) && strchr(user_ch_readm,c)) return((*user_readm)(c,f));} *p++ = c; for(j = 1; j= len) { /* EST_String full so double the buffer, copy and continue */ q = (char *)must_malloc(len*2*sizeof(char)); strncpy(q,str,len); wfree(str); str = q; len = len*2; } str[j] = c; ++j; } str[j] = 0; qq = strcons(j,str); return qq; } LISP lreadtk(long j) {int flag; unsigned char *p; LISP tmp; int adigit; p = (unsigned char *)tkbuffer; p[j] = 0; if (user_readt != NULL) {tmp = (*user_readt)((char *)p,j,&flag); if (flag) return(tmp);} if (strcmp("nil",tkbuffer) == 0) return NIL; if (*p == '-') p+=1; adigit = 0; while((*p < 128) && (isdigit(*p))) {p+=1; adigit=1;} if (*p=='.') {p += 1; while((*p < 128) && (isdigit(*p))) {p+=1; adigit=1;}} if (!adigit) goto a_symbol; if (*p=='e') {p+=1; if (*p=='-'||*p=='+') p+=1; if ((!isdigit(*p) || (*p > 127))) goto a_symbol; else p+=1; while((*p < 128) && (isdigit(*p))) p+=1;} if (*p) goto a_symbol; return(flocons(atof(tkbuffer))); a_symbol: return(rintern(tkbuffer));} LISP siod_quit(void) {open_files = NIL; // will be closed on exit with no warnings if (errjmp_ok) longjmp(*est_errjmp,2); else exit(0); return(NIL);} LISP l_exit(LISP arg) { if (arg == NIL) exit(0); else exit((int)FLONM(arg)); // never happens return NULL; } LISP lfwarning(LISP mode) { /* if mode is non-nil switch warnings on */ if (mode == NIL) fwarn = NULL; else fwarn = stdout; return NIL; } LISP closure_code(LISP exp) {return(exp->storage_as.closure.code);} LISP closure_env(LISP exp) {return(exp->storage_as.closure.env);} int get_c_int(LISP x) {if NFLONUMP(x) err("not a number",x); return((int)FLONM(x));} double get_c_double(LISP x) {if NFLONUMP(x) err("not a number",x); return(FLONM(x));} float get_c_float(LISP x) {if NFLONUMP(x) err("not a number",x); return((float)FLONM(x));} void init_subrs_base(void) { init_subr_2("eval",leval, "(eval DATA)\n\ Evaluate DATA and return result."); init_lsubr("gc-status",gc_status, "(gc-status OPTION)\n\ Control summary information during garbage collection. If OPTION is t,\n\ output information at each garbage collection, if nil do gc silently."); init_lsubr("gc",user_gc, "(gc)\n\ Collect garbage now, where gc method supports it."); init_subr_2("error",lerr, "(error MESSAGE DATA)\n\ Prints MESSAGE about DATA and throws an error."); init_subr_0("quit",siod_quit, "(quit)\n\ Exit from program, does not return."); init_subr_1("exit",l_exit, "(exit [RCODE])\n\ Exit from program, if RCODE is given it is given as an argument to\n\ the system call exit."); init_subr_2("env-lookup",envlookup, "(env-lookup VARNAME ENVIRONMENT)\n\ Return value of VARNAME in ENVIRONMENT."); init_subr_1("fwarning",lfwarning, "(fwarning MODE)\n\ For controlling various levels of warning messages. If MODE is nil, or\n\ not specified stop all warning messages from being displayed. If MODE\n\ display warning messages."); init_subr_2("%%stack-limit",stack_limit, "(%%stack-limit AMOUNT SILENT)\n\ Set stacksize to AMOUNT, if SILENT is non nil do it silently."); init_subr_1("intern",intern, "(intern ATOM)\n\ Intern ATOM on the oblist."); init_subr_2("%%closure",closure, "(%%closure ENVIRONMENT CODE)\n\ Make a closure from given environment and code."); init_subr_1("%%closure-code",closure_code, "(%%closure-code CLOSURE)\n\ Return code part of closure."); init_subr_1("%%closure-env",closure_env, "(%%closure-env CLOSURE)\n\ Return environment part of closure."); init_subr_1("set_backtrace",set_backtrace, "(set_backtrace arg)\n\ If arg is non-nil a backtrace will be display automatically after errors\n\ if arg is nil, a backtrace will not automatically be displayed (use\n\ (:backtrace) for display explicitly."); init_subr_1("set_server_safe_functions",set_restricted, "(set_server_safe_functions LIST)\n\ Sets restricted list to LIST. When restricted list is non-nil only\n\ functions whose names appear in this list may be executed. This\n\ is used so that clients in server mode may be restricted to a small\n\ number of safe commands. [see Server/client API]"); } void init_subrs(void) { init_subrs_base(); init_subrs_core(); init_subrs_doc(); init_subrs_file(); init_subrs_format(); init_subrs_list(); init_subrs_math(); init_subrs_str(); init_subrs_sys(); init_subrs_xtr(); // arrays and hash tables } /* err0,pr,prp are convenient to call from the C-language debugger */ void err0(void) {err("0",NIL);} void pr(LISP p) {if ((p >= heap_org) && (p < heap_end) && (((((char *)p) - ((char *)heap_org)) % sizeof(struct obj)) == 0)) pprint(p); else put_st("invalid\n");} void prp(LISP *p) {if (!p) return; pr(*p);} LISP siod_make_typed_cell(long type, void *s) { LISP ptr; NEWCELL(ptr,type); USERVAL(ptr) = s; return ptr; } static LISP set_restricted(LISP l) { // Set restricted list if (restricted == NIL) gc_protect(&restricted); restricted = l; return NIL; } static int restricted_function_call(LISP l) { // Checks l recursively to ensure all function calls // are in the restricted list LISP p; if (l == NIL) return TRUE; else if (!consp(l)) return TRUE; else if (TYPE(car(l)) == tc_symbol) { if (streq("quote",get_c_string(car(l)))) return TRUE; else if (siod_member_str(get_c_string(car(l)),restricted) == NIL) return FALSE; } else if (restricted_function_call(car(l)) == FALSE) return FALSE; // As its some type of list with a valid car, check the cdr for (p=cdr(l); consp(p); p=cdr(p)) if (restricted_function_call(car(p)) == FALSE) return FALSE; return TRUE; } speech_tools/siod/slib_core.cc0000644000076400007640000002403711427606600015077 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * System functions */ #include #include "siod.h" #include "siodp.h" static LISP sym_lambda = NIL; static LISP sym_progn = NIL; LISP setvar(LISP var,LISP val,LISP env) {LISP tmp; if NSYMBOLP(var) err("wrong type of argument(non-symbol) to setvar",var); tmp = envlookup(var,env); if NULLP(tmp) return(VCELL(var) = val); return(CAR(tmp)=val);} static LISP leval_setq(LISP args,LISP env) {return(setvar(car(args),leval(car(cdr(args)),env),env));} static LISP syntax_define(LISP args) { if SYMBOLP(car(args)) return(args); else { need_n_cells(4); return(syntax_define( cons(car(car(args)), cons(cons(sym_lambda, cons(cdr(car(args)), cdr(args))), NIL)))); } } static LISP leval_define(LISP args,LISP env) {LISP tmp,var,val; tmp = syntax_define(args); var = car(tmp); if NSYMBOLP(var) err("wrong type of argument(non-symbol) to define",var); val = leval(car(cdr(tmp)),env); tmp = envlookup(var,env); if NNULLP(tmp) return(CAR(tmp) = val); if NULLP(env) return(VCELL(var) = val); tmp = car(env); setcar(tmp,cons(var,car(tmp))); setcdr(tmp,cons(val,cdr(tmp))); return(val);} static LISP leval_if(LISP *pform,LISP *penv) {LISP args,env; args = cdr(*pform); env = *penv; if NNULLP(leval(car(args),env)) *pform = car(cdr(args)); else *pform = car(cdr(cdr(args))); return(truth);} static LISP arglchk(LISP x) { #if (!ENVLOOKUP_TRICK) LISP l; if SYMBOLP(x) return(x); for(l=x;CONSP(l);l=CDR(l)); if NNULLP(l) err("improper formal argument list",x); #endif return(x);} static LISP leval_lambda(LISP args,LISP env) {LISP body; if NULLP(cdr(cdr(args))) body = car(cdr(args)); else body = cons(sym_progn,cdr(args)); return(closure(env,cons(arglchk(car(args)),body)));} static LISP leval_progn(LISP *pform,LISP *penv) {LISP env,l,next; env = *penv; gc_protect(&env); l = cdr(*pform); next = cdr(l); while (NNULLP(next)) { leval(car(l),env); l=next; next=cdr(next); } gc_unprotect(&env); *pform = car(l); return(truth);} static LISP leval_or(LISP *pform,LISP *penv) {LISP env,l,next,val; env = *penv; l = cdr(*pform); next = cdr(l); while(NNULLP(next)) {val = leval(car(l),env); if NNULLP(val) {*pform = val; return(NIL);} l=next;next=cdr(next);} *pform = car(l); return(truth);} static LISP leval_and(LISP *pform,LISP *penv) {LISP env,l,next; env = *penv; l = cdr(*pform); if NULLP(l) {*pform = truth; return(NIL);} next = cdr(l); while(NNULLP(next)) {if NULLP(leval(car(l),env)) {*pform = NIL; return(NIL);} l=next;next=cdr(next);} *pform = car(l); return(truth);} static LISP leval_catch(LISP args,LISP env) {struct catch_frame frame; int k; LISP l; volatile LISP val = NIL; frame.tag = leval(car(args),env); frame.next = catch_framep; k = setjmp(frame.cframe); catch_framep = &frame; if (k == 2) {catch_framep = frame.next; return(frame.retval);} for(l=cdr(args); NNULLP(l); l = cdr(l)) val = leval(car(l),env); catch_framep = frame.next; return(val);} static LISP lthrow(LISP tag,LISP value) {struct catch_frame *l; for(l=catch_framep; l; l = (*l).next) if EQ((*l).tag,tag) {(*l).retval = value; longjmp((*l).cframe,2);} err("no *catch found with this tag",tag); return(NIL);} static LISP leval_let(LISP *pform,LISP *penv) {LISP env,l; l = cdr(*pform); env = *penv; *penv = extend_env(leval_args(car(cdr(l)),env),car(l),env); *pform = car(cdr(cdr(l))); return(truth);} static LISP leval_quote(LISP args,LISP env) {(void)env; return(car(args));} static LISP leval_tenv(LISP args,LISP env) {(void)args; return(env);} static LISP leval_while(LISP args,LISP env) {LISP l; while NNULLP(leval(car(args),env)) for(l=cdr(args);NNULLP(l);l=cdr(l)) leval(car(l),env); return(NIL);} static LISP siod_typeof(LISP exp) { switch TYPE(exp) { case tc_nil: return NIL; case tc_cons: return rintern("cons"); case tc_flonum: return rintern("flonum"); case tc_string: return rintern("string"); case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: return rintern("subr"); case tc_c_file: return rintern("c_file"); case tc_closure: return rintern("closure"); default: struct user_type_hooks *p; EST_String tkb; char ttkbuffer[1024]; p = get_user_type_hooks(TYPE(exp)); if (p->print_string) { (*p->print_string)(exp, ttkbuffer); tkb = ttkbuffer; return rintern(tkb.after("#<").before(" ")); } else { if (p->name) return rintern(p->name); else return rintern("unknown"); } } } static LISP symbolp(LISP x) {if SYMBOLP(x) return(truth); else return(NIL);} LISP symbol_boundp(LISP x,LISP env) {LISP tmp; if NSYMBOLP(x) err("not a symbol",x); tmp = envlookup(x,env); if NNULLP(tmp) return(truth); if EQ(VCELL(x),unbound_marker) return(NIL); else return(truth);} LISP symbol_value(LISP x,LISP env) {LISP tmp; if NSYMBOLP(x) err("not a symbol",x); tmp = envlookup(x,env); if NNULLP(tmp) return(CAR(tmp)); tmp = VCELL(x); if EQ(tmp,unbound_marker) err("unbound variable",x); return(tmp);} static LISP l_unwind_protect(LISP args, LISP env) { // Do normal, if an error occurs do onerror jmp_buf * volatile local_errjmp = est_errjmp; est_errjmp = walloc(jmp_buf,1); volatile long local_errjmp_ok = errjmp_ok; errjmp_ok=1; /* allow errjmps in here */ volatile LISP r=NIL; volatile LISP previous_open_files = open_files; if (setjmp(*est_errjmp) != 0) { wfree(est_errjmp); est_errjmp = local_errjmp; errjmp_ok = local_errjmp_ok; siod_reset_prompt(); // Close any that were opened below here close_open_files_upto(previous_open_files); if (siod_ctrl_c == TRUE) err("forwarded through unwind-protect",NIL); r = leval(car(cdr(args)),env); } else { r = leval(car(args),env); wfree(est_errjmp); est_errjmp = local_errjmp; errjmp_ok = local_errjmp_ok; } return r; } static LISP oblistfn(void) {return(copy_list(oblistvar));} LISP let_macro(LISP form) {LISP p,fl,al,tmp; fl = NIL; al = NIL; for(p=car(cdr(form));NNULLP(p);p=cdr(p)) {tmp = car(p); if SYMBOLP(tmp) {fl = cons(tmp,fl); al = cons(NIL,al);} else {fl = cons(car(tmp),fl); al = cons(car(cdr(tmp)),al);}} p = cdr(cdr(form)); if NULLP(cdr(p)) p = car(p); else p = cons(sym_progn,p); setcdr(form,cons(reverse(fl),cons(reverse(al),cons(p,NIL)))); setcar(form,cintern("let-internal")); return(form);} void init_subrs_core(void) { gc_protect_sym(&sym_lambda,"lambda"); gc_protect_sym(&sym_progn,"begin"); init_fsubr("quote",leval_quote, "(quote DATA)\n\ Return data (unevaluated)."); init_fsubr("set!",leval_setq, "(set! SYMBOL VAL)\n\ Set SYMBOL to have value VAL, returns VAL."); init_fsubr("define",leval_define, "(define (FUNCNAME ARG1 ARG2 ...) . BODY)\n\ Define a new function call FUNCNAME with arguments ARG1, ARG2 ... and\n\ BODY."); init_fsubr("lambda",leval_lambda, "(lambda (ARG1 ARG2 ...) . BODY)\n\ Create closure (anonymous function) with arguments ARG1, ARG2 ... and \n\ BODY."); init_msubr("if",leval_if, "(if COND TRUEPART FALSEPART)\n\ If COND evaluates to non-nil evaluate TRUEPART and return result,\n\ otherwise evaluate and return FALSEPART. If COND is nil and FALSEPART\n\ is nil, nil is returned."); init_fsubr("while",leval_while, "(while COND . BODY)\n\ While COND evaluates to non-nil evaluate BODY."); init_msubr("begin",leval_progn, "(begin . BODY)\n\ Evaluate s-expressions in BODY returning value of from last expression."); init_fsubr("*catch",leval_catch, "(*catch TAG . BODY)\n\ Evaluate BODY, if a *throw occurs with TAG then return value specified\n\ by *throw."); init_subr_2("*throw",lthrow, "(*throw TAG VALUE)\n\ Jump to *catch with TAG, causing *catch to return VALUE."); init_msubr("let-internal",leval_let, "(let-internal STUFF)\n\ Internal function used to implement let."); init_msubr("or",leval_or, "(or DISJ1 DISJ2 ...)\n\ Evaluate each disjunction DISJn in turn until one evaluates to non-nil.\n\ Otherwise return nil."); init_msubr("and",leval_and, "(and CONJ1 CONJ2 ... CONJN)\n\ Evaluate each conjunction CONJn in turn until one evaluates to nil.\n\ Otherwise return value of CONJN."); init_subr_1("typeof",siod_typeof, "(typeof OBJ)\n\ Returns typeof of given object."); init_subr_1("symbol?",symbolp, "(symbol? DATA)\n\ Returns t if DATA is a symbol, nil otherwise."); init_subr_2("symbol-bound?",symbol_boundp, "(symbol-bound? VARNAME)\n\ Return t is VARNAME has a value, nil otherwise."); init_subr_2("symbol-value",symbol_value, "(symbol-value SYMBOLNAME)\n\ Returns the value of SYMBOLNAME, an error is given SYMBOLNAME is not a\n\ bound symbol."); init_fsubr("the-environment",leval_tenv, "(the-environment)\n\ Returns the current (SIOD) environment."); init_fsubr("unwind-protect",l_unwind_protect, "(unwind-protect NORMALFORM ERRORFORM)\n\ If an error is found while evaluating NORMALFORM catch it and evaluate\n\ ERRORFORM and continue. If an error occurs while evaluating NORMALFORM\n\ all file open evaluating NORMALFORM up to the error while be automatically\n\ closed. Note interrupts (ctrl-c) is not caught by this function."); init_subr_0("oblist",oblistfn, "(oblist)\n\ Return oblist."); init_subr_1("let-internal-macro",let_macro, "(let ((VAR1 VAL1) (VAR2 VAL2) ...) . BODY)\n\ Evaluate BODY in an environment where VAR1 is set to VAL1, VAR2 is set\n\ to VAL2 etc."); init_subr_3("set-symbol-value!",setvar, "(set-symbol-value! SYMBOLNAME VALUE)\n\ Set SYMBOLNAME's value to VALUE, this is much faster than set! but use\n\ with caution."); } speech_tools/siod/slib_doc.cc0000644000076400007640000001464010127000720014676 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * Documentation support */ #include #include "EST_cutils.h" #include "siod.h" #include "siodp.h" #include "siodeditline.h" void setdoc(LISP name,LISP doc) { /* Set documentation string for name */ LISP lpair = assq(name,siod_docstrings); if (lpair == NIL) siod_docstrings = cons(cons(name,doc),siod_docstrings); else { cerr << "SIOD: duplicate builtin function: " << get_c_string(name) << endl; cerr << "SIOD: probably an error" << endl; CDR(lpair) = doc; } } static LISP siod_doc(LISP args,LISP penv) { /* Return documentation string for sym */ (void)penv; LISP lpair,val,tmp,code; LISP var_docstrings; if (TYPE(car(args)) != tc_symbol) return rintern("No documentation available for non-symbol."); tmp = envlookup(car(args),penv); if NNULLP(tmp) val = car(tmp); else val = VCELL(car(args)); if EQ(val,unbound_marker) return rintern("Symbol is unbound."); else { var_docstrings = symbol_value(rintern("var-docstrings"),penv); lpair = assq(car(args),var_docstrings); if (lpair) return cdr(lpair); else rintern("No documentation available for symbol."); } switch (TYPE(val)) { case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: lpair = assq(car(args),siod_docstrings); if (lpair != NIL) return cdr(lpair); else return rintern("No documentation available for builtin function."); break; case tc_closure: code = val->storage_as.closure.code; if ((TYPE(cdr(code)) == tc_cons) && (TYPE(car(cdr(cdr(code)))) == tc_string)) return car(cdr(cdr(code))); else return rintern("No documentation available for user-defined function."); default: return rintern("No documentation available for symbol."); } return rintern("No documentation available for symbol."); } static LISP siod_all_function_docstrings(void) { // Returns all an assoc list of ALL functions that have any form // of documentation strings, internal functions or user defined. LISP docs = siod_docstrings; // But we need user defined function with docstrings too. // The docustring must start with a ( to be included LISP l = oblistvar; LISP code,val; // Search the oblist for functions for(;CONSP(l);l=CDR(l)) { if (VCELL(car(l)) == NIL) continue; switch(TYPE(VCELL(CAR(l)))) { case tc_closure: val = VCELL(CAR(l)); code = val->storage_as.closure.code; if ((CONSP(code)) && (CONSP(cdr(code))) && (CONSP(cdr(cdr(code)))) && (TYPE(car(cdr(cdr(code)))) == tc_string)) docs = cons(cons(car(l),car(cdr(cdr(code)))),docs); default: continue; } } return docs; } static int sort_compare_docstrings(const void *x, const void *y) { LISP a=*(LISP *)x; LISP b=*(LISP *)y; return EST_strcasecmp(get_c_string(car(a)),get_c_string(car(b))); } static void siod_print_docstring(const char *symname, const char *docstring, FILE *fp) { // Print to fp a texinfo list item for this description // Take the first line of the docstring as the label, and also remove // any indentation in the remainder of the lines int i,state; (void)symname; EST_String ds = docstring; const char *dsc; if (ds.contains(make_regex("\\[see .*\\]$"))) { // Contains a cross reference so replace it with texi xref command EST_String rest, ref; rest = ds.before(make_regex("\\[see [^\n]*\\]$")); ref = ds.after(rest); ref = ref.after("[see "); ref = ref.before("]"); ds = rest + EST_String("[\\@pxref\\{") + ref + EST_String("\\}]"); } dsc = ds; fprintf(fp,"@item "); for (state=0,i=0; dsc[i] != '\0'; i++) { if (((dsc[i] == '@') || (dsc[i] == '{') || (dsc[i] == '}')) && ((i == 0) || (dsc[i-1] != '\\'))) putc('@',fp); if ((dsc[i] == '\\') && ((dsc[i+1] == '@') || (dsc[i+1] == '{') || (dsc[i+1] == '}'))) state = state; else if (state == 0) { putc(dsc[i],fp); if (dsc[i] == '\n') state = 1; } else if (state == 1) if (dsc[i] != ' ') { putc(dsc[i],fp); state = 0; } } fprintf(fp,"\n"); } static LISP siod_sort_and_dump_docstrings(LISP type,LISP filefp) { // sort docstrings then dump them to filefp as a texinfo list LISP *array,l,docstrings; int num_strings; int i; if (streq(get_c_string(type),"function")) docstrings = siod_all_function_docstrings(); else if (streq(get_c_string(type),"features")) docstrings = symbol_value(rintern("ff_docstrings"),NIL); else docstrings = symbol_value(rintern("var-docstrings"),NIL); num_strings = siod_llength(docstrings); array = walloc(LISP,num_strings); for (l=docstrings,i=0; i < num_strings; i++,l=cdr(l)) array[i] = car(l); qsort(array,num_strings,sizeof(LISP),sort_compare_docstrings); for (i=0; i < num_strings; i++) siod_print_docstring(get_c_string(car(array[i])), get_c_string(cdr(array[i])), get_c_file(filefp,stdout)); wfree(array); return NIL; } const char *siod_docstring(const char *symbol) { LISP doc; doc = siod_doc(cons(rintern(symbol),NIL),NIL); return get_c_string(doc); } const char *siod_manual_sym(const char *symbol) { // For siodline LISP info; info = leval(cons(rintern("manual-sym"), cons(quote(rintern(symbol)),NIL)),NIL); return get_c_string(info); } void siod_saydocstring(const char *symbol) { // This isn't guaranteed to work but might be ok sometimes leval(cons(rintern("tts_text"), cons(cons(rintern("doc"),cons(rintern(symbol),NIL)), cons(NIL,NIL))),NIL); } void init_subrs_doc(void) { init_fsubr("doc",siod_doc, "(doc SYMBOL)\n\ Return documentation for SYMBOL."); init_subr_2("sort-and-dump-docstrings",siod_sort_and_dump_docstrings, "(sort-and-dump-docstrings DOCSTRINGS FILEFP)\n\ DOCSTRINGS is an assoc list of name and document string var-docstrings\n\ or func-docstrings. This very individual function sorts the list and \n\ prints out the documentation strings as texinfo list members to FILEFP."); } speech_tools/siod/slib_file.cc0000644000076400007640000004400311465017155015064 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * File functions */ #include #include "siod.h" #include "siodp.h" #include "EST_Pathname.h" static void siod_string_print(LISP exp, EST_String &sd); LISP open_files = NIL; void pprintf(FILE *fd,LISP exp,int indent,int width, int depth,int length) { // A pretty printer for expressions // indent is the number of spaces to indent by // width is the maximum column we're allow to print to // depth is the we should print before ignoring it // length is the number of items in a list we should print int i,ll; LISP l; if (exp == NIL) fprintf(fd,"nil"); else if (!consp(exp)) fprintf(fd,"%s",(const char *)siod_sprint(exp)); else { EST_String p = siod_sprint(exp); if (p.length() < width-indent) fprintf(fd,"%s",(const char *)p); else { fprintf(fd,"("); indent += 1; if (depth == 0) fprintf(fd,"..."); else { pprintf(fd,car(exp),indent,width,depth-1,length); for (ll=length,l=cdr(exp); l != NIL; l=cdr(l),ll--) { fprintf(fd,"\n"); for (i=0; istorage_as.c_file.f); return NIL; } static void siod_string_print(LISP exp, EST_String &sd) { LISP tmp; int i; switch TYPE(exp) { case tc_nil: sd += "nil"; break; case tc_cons: sd += "("; siod_string_print(car(exp),sd); for(tmp=cdr(exp);CONSP(tmp);tmp=cdr(tmp)) { sd += " "; siod_string_print(car(tmp),sd); } if NNULLP(tmp) { sd += " . "; siod_string_print(tmp,sd); } sd += ")"; break; case tc_flonum: if (FLONMPNAME(exp) == NULL) { sprintf(tkbuffer,"%.8g",FLONM(exp)); FLONMPNAME(exp) = (char *)must_malloc(strlen(tkbuffer)+1); sprintf(FLONMPNAME(exp),"%s",tkbuffer); } sprintf(tkbuffer,"%s",FLONMPNAME(exp)); sd += tkbuffer; break; case tc_string: sd += "\""; for (i=0; exp->storage_as.string.data[i] != '\0'; i++) { if (exp->storage_as.string.data[i] == '"') sd += "\\"; if (exp->storage_as.string.data[i] == '\\') sd += "\\"; sprintf(tkbuffer,"%c",exp->storage_as.string.data[i]); sd += tkbuffer; } sd += "\""; break; case tc_symbol: sd += PNAME(exp); break; case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: sprintf(tkbuffer,"#storage_as.c_file.f); sd += tkbuffer; if (exp->storage_as.c_file.name) sd += exp->storage_as.c_file.name; sd += ">"; break; case tc_closure: sd += "#print_string) (*p->print_string)(exp, tkbuffer); else { if (p->name) sprintf(tkbuffer,"#<%s %p>",p->name,(void *)exp); else sprintf(tkbuffer,"#",TYPE(exp),(void *)exp); } sd += tkbuffer; } return; } EST_String siod_sprint(LISP exp) { EST_String r; r = ""; siod_string_print(exp,r); return r; } static LISP fd_to_scheme_file(int fd, const char *name, const char *how, int close_on_error) { LISP sym; long flag; flag = no_interrupt(1); sym = newcell(tc_c_file); sym->storage_as.c_file.f = (FILE *)NULL; sym->storage_as.c_file.name = (char *)NULL; if (fd != fileno(stderr)) open_files = cons(sym,open_files); sym->storage_as.c_file.name = (char *) must_malloc(strlen(name)+1); if (fd == fileno(stdin)) sym->storage_as.c_file.f = stdin; else if (fd == fileno(stdout)) sym->storage_as.c_file.f = stdout; else if (fd == fileno(stderr)) sym->storage_as.c_file.f = stderr; else if (!(sym->storage_as.c_file.f = fdopen(fd ,how))) { if (close_on_error) close(fd); perror(name); put_st("\n"); err("could not open file", name); } strcpy(sym->storage_as.c_file.name,name); no_interrupt(flag); return(sym); } LISP fopen_c(const char *name, const char *how) { LISP sym; int fd; fd = fd_open_file(name, how); if (fd < 0) err("could not open file", name); sym = fd_to_scheme_file(fd, name, how, 1); return(sym); } LISP siod_fdopen_c(int fd, const char *name, char *how) { return fd_to_scheme_file(fd, name, how, 0); } LISP fopen_l(LISP what, const char *r_or_w) { int fd = -1; const char *filename = NULL; if (NULLP(what)) { filename = "-"; fd = fd_open_stdinout(r_or_w); } else if (SYMBOLP(what) || STRINGP(what)) { fd = fd_open_file((filename = get_c_string(what)), r_or_w); } else if (LIST1P(what)) { fd = fd_open_file((filename = get_c_string(CAR(what))), r_or_w); } else if (CONSP(what) && !CONSP(CDR(what))) { filename = "[tcp connection]"; fd = fd_open_url("tcp", get_c_string(CAR(what)), get_c_string(CDR(what)), NULL, r_or_w); } else if (LIST4P(what)) { filename = "[url]"; fd = fd_open_url(get_c_string(CAR1(what)), get_c_string(CAR2(what)), get_c_string(CAR3(what)), get_c_string(CAR4(what)), r_or_w); } else err("not openable", what); if (fd<0) err("can't open", what); return fd_to_scheme_file(fd, filename, r_or_w, 1); } static void file_gc_free(LISP ptr) {if ((ptr->storage_as.c_file.f) && (ptr->storage_as.c_file.f != stdin) && (ptr->storage_as.c_file.f != stdout)) {fclose(ptr->storage_as.c_file.f); ptr->storage_as.c_file.f = (FILE *) NULL;} if (ptr->storage_as.c_file.name) {wfree(ptr->storage_as.c_file.name); ptr->storage_as.c_file.name = NULL;}} LISP fclose_l(LISP p) {long flag; flag = no_interrupt(1); if NTYPEP(p,tc_c_file) err("not a file",p); file_gc_free(p); open_files = delq(p,open_files); no_interrupt(flag); return(NIL);} static void file_prin1(LISP ptr,FILE *f) {char *name; name = ptr->storage_as.c_file.name; fput_st(f,"#storage_as.c_file.f); fput_st(f,tkbuffer); if (name) {fput_st(f," "); fput_st(f,name);} fput_st(f,">");} FILE *get_c_file(LISP p,FILE *deflt) {if (NULLP(p) && deflt) return(deflt); if NTYPEP(p,tc_c_file) err("not a file",p); if (!p->storage_as.c_file.f) err("file is closed",p); return(p->storage_as.c_file.f);} LISP lgetc(LISP p) {int i; i = f_getc(get_c_file(p,stdin)); return((i == EOF) ? NIL : flocons((double)i));} LISP lputc(LISP c,LISP p) {long flag; int i; FILE *f; f = get_c_file(p,stdout); if FLONUMP(c) i = (int)FLONM(c); else i = *get_c_string(c); flag = no_interrupt(1); putc(i,f); no_interrupt(flag); return(NIL);} LISP lputs(LISP str,LISP p) {fput_st(get_c_file(p,stdout),get_c_string(str)); return(NIL);} LISP lftell(LISP file) {return(flocons((double)ftell(get_c_file(file,NULL))));} LISP lfseek(LISP file,LISP offset,LISP direction) {return((fseek(get_c_file(file,NULL),get_c_int(offset),get_c_int(direction))) ? NIL : truth);} static LISP directory_entries(LISP ldir, LISP lnoflagdir) { LISP lentries=NIL; EST_Pathname dir(get_c_string(ldir)); if (dir == "") return NIL; dir = dir.as_directory(); EST_StrList entries(dir.entries(lnoflagdir!=NIL?0:1)); EST_Litem *item; for(item=entries.head(); item; item = item->next()) { EST_String entry(entries(item)); if (entry != "../" && entry != "./" && entry != ".." && entry != ".") { LISP litem = strintern(entry); lentries = cons(litem, lentries); } } return lentries; } static LISP fopen_l(LISP what,LISP how) { const char *r_or_w = NULLP(how) ? "rb" : get_c_string(how); return fopen_l(what, r_or_w); } static LISP lfread(LISP size,LISP file) {long flag,n,ret,m; char *buffer; LISP s; FILE *f; f = get_c_file(file,NULL); flag = no_interrupt(1); if TYPEP(size,tc_string) {s = size; buffer = s->storage_as.string.data; n = s->storage_as.string.dim; m = 0;} else {n = get_c_int(size); buffer = (char *) must_malloc(n+1); buffer[n] = 0; m = 1;} ret = fread(buffer,1,n,f); if (ret == 0) {if (m) wfree(buffer); no_interrupt(flag); return(NIL);} if (m) {if (ret == n) {s = cons(NIL,NIL); s->type = tc_string; s->storage_as.string.data = buffer; s->storage_as.string.dim = n;} else {s = strcons(ret,NULL); memcpy(s->storage_as.string.data,buffer,ret); wfree(buffer);} no_interrupt(flag); return(s);} no_interrupt(flag); return(flocons((double)ret));} static LISP lfwrite(LISP string,LISP file) {FILE *f; long flag; char *data; long dim; f = get_c_file(file,NULL); if NTYPEP(string,tc_string) err("not a string",string); data = string->storage_as.string.data; dim = string->storage_as.string.dim; flag = no_interrupt(1); fwrite(data,dim,1,f); no_interrupt(flag); return(NIL);} LISP lprin1f(LISP exp,FILE *f) {LISP tmp; struct user_type_hooks *p; STACK_CHECK(&exp); INTERRUPT_CHECK(); switch TYPE(exp) {case tc_nil: fput_st(f,"nil"); break; case tc_cons: fput_st(f,"("); lprin1f(car(exp),f); for(tmp=cdr(exp);CONSP(tmp);tmp=cdr(tmp)) {fput_st(f," ");lprin1f(car(tmp),f);} if NNULLP(tmp) {fput_st(f," . ");lprin1f(tmp,f);} fput_st(f,")"); break; case tc_flonum: if (FLONMPNAME(exp) == NULL) { sprintf(tkbuffer,"%.8g",FLONM(exp)); FLONMPNAME(exp) = (char *)must_malloc(strlen(tkbuffer)+1); sprintf(FLONMPNAME(exp),"%s",tkbuffer); } sprintf(tkbuffer,"%s",FLONMPNAME(exp)); fput_st(f,tkbuffer); break; case tc_symbol: fput_st(f,PNAME(exp)); break; case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: sprintf(tkbuffer,"#"); break; case tc_closure: fput_st(f,"#"); break; default: p = get_user_type_hooks(TYPE(exp)); if (p->prin1) (*p->prin1)(exp,f); else { if (p->name) sprintf(tkbuffer,"#<%s %p>",p->name,USERVAL(exp)); else sprintf(tkbuffer,"#",TYPE(exp),(void *)exp); fput_st(f,tkbuffer);}} return(NIL);} static LISP lprintfp(LISP exp,LISP file) {lprin1f(exp,get_c_file(file,stdout)); return(NIL);} static LISP terpri(LISP file) {fput_st(get_c_file(file,stdout),"\n"); return(NIL);} static LISP lreadfp(LISP file) {return lreadf(get_c_file(file,stdout));} LISP load(LISP fname,LISP cflag) {return(vload(get_c_string(fname),NULLP(cflag) ? 0 : 1));} LISP lprint(LISP exp) {lprin1f(exp,stdout); put_st("\n"); return(NIL);} LISP lread(void) {return(lreadf(stdin));} LISP get_eof_val(void) {return(eof_val);} static LISP probe_file(LISP fname) { // return t if file exists, nil otherwise const char *filename; filename = get_c_string(fname); if (access(filename,R_OK) == 0) return truth; else return NIL; } static LISP lunlink(LISP name) { unlink(get_c_string(name)); return NIL; } static LISP save_forms(LISP fname,LISP forms,LISP how) {const char *cname; const char *chow = NULL; LISP l,lf; FILE *f; cname = get_c_string(fname); if EQ(how,NIL) chow = "wb"; else if EQ(how,cintern("a")) chow = "a"; else err("bad argument to save-forms",how); fput_st(fwarn,(*chow == 'a') ? "appending" : "saving"); fput_st(fwarn," forms to "); fput_st(fwarn,cname); fput_st(fwarn,"\n"); lf = fopen_c(cname,chow); f = lf->storage_as.c_file.f; for(l=forms;NNULLP(l);l=cdr(l)) {lprin1f(car(l),f); putc('\n',f);} fclose_l(lf); fput_st(fwarn,"done.\n"); return(truth);} void close_open_files_upto(LISP end) {LISP l,p; for(l=open_files;((l!=end)&&(l!=NIL));l=cdr(l)) {p = car(l); if (p->storage_as.c_file.f) {fprintf(stderr,"closing a file left open: %s\n", (p->storage_as.c_file.name) ? p->storage_as.c_file.name : ""); fflush(stderr); file_gc_free(p);}} open_files = l;} void close_open_files(void) { close_open_files_upto(NIL); } static void check_first_line(FILE *lf) { /* If this line starts #! skip it -- this is for scripts */ int c0,c1,c2; if ((c0=getc(lf)) == '#') { if ((c1 = getc(lf)) == '!') while (((c2=getc(lf)) != '\n') && (c2 != EOF)); /* skip to EOLN */ else { ungetc(c1,lf); ungetc(c0,lf); /* possibly something don't support 2 ungets */ } } else ungetc(c0,lf); } LISP vload(const char *fname_raw, long cflag) { LISP form,result,tail,lf; FILE *f; EST_Pathname fname(fname_raw); fput_st(fwarn,"loading "); fput_st(fwarn,fname); fput_st(fwarn,"\n"); lf = fopen_c(fname,"rb"); f = lf->storage_as.c_file.f; if (!cflag) check_first_line(f); result = NIL; tail = NIL; while(1) {form = lreadf(f); if EQ(form,eof_val) break; if (cflag) {form = cons(form,NIL); if NULLP(result) result = tail = form; else tail = setcdr(tail,form);} else leval(form,NIL);} fclose_l(lf); fput_st(fwarn,"done.\n"); return(result);} void init_subrs_file(void) { long j; set_gc_hooks(tc_c_file,FALSE,NULL,NULL,NULL,file_gc_free,NULL,&j); set_print_hooks(tc_c_file,file_prin1, NULL); setvar(cintern("stderr"), fd_to_scheme_file(fileno(stderr),"stderr","w",FALSE),NIL); init_subr_2("fread",lfread, "(fread BUFFER FILE)\n\ BUFFER is a string of length N, N bytes are read from FILE into\n\ BUFFER."); init_subr_2("fwrite",lfwrite, "(fwrite BUFFER FILE)\n\ Write BUFFER into FILE."); init_subr_0("read",lread, "(read)\n\ Read next s-expression from stdin and return it."); init_subr_0("eof-val",get_eof_val, "(eof_val)\n\ Returns symbol used to indicate end of file. May be used (with eq?)\n\ to determine when end of file occurs while reading files."); init_subr_1("print",lprint, "(print DATA)\n\ Print DATA to stdout if textual form. Not a pretty printer."); init_subr_2("pprintf",siod_pprintf, "(pprintf EXP [FD])\n\ Pretty print EXP to FD, if FD is nil print to the screen."); init_subr_2("printfp",lprintfp, "(printfp DATA FILEP)\n\ Print DATA to file indicated by file pointer FILEP. File pointers are\n\ are created by fopen."); init_subr_1("readfp",lreadfp, "(readfp FILEP)\n\ Read and return next s-expression from file indicated by file pointer\n\ FILEP. File pointers are created by fopen."); init_subr_1("terpri",terpri, "(terpri FILEP)\n\ Print newline to FILEP, is FILEP is nil or not specified a newline it\n\ is printed to stdout."); init_subr_1("fflush",fflush_l, "(fflush FILEP)\n\ Flush FILEP. If FILEP is nil, then flush stdout."); init_subr_2("fopen",fopen_l, "(fopen FILENAME HOW)\n\ Return file pointer for FILENAME opened in mode HOW."); init_subr_1("fclose",fclose_l, "(fclose FILEP)\n\ Close filepoint FILEP."); init_subr_1("getc",lgetc, "(getc FILEP)\n\ Get next character from FILEP. Character is returned as a number. If\n\ FILEP is nil, or not specified input comes from stdin."); init_subr_2("putc",lputc, "(putc ECHAR FILEP)\n\ Put ECHAR (a number) as a character to FILEP. If FILEP is nil or not\n\ specified output goes to stdout."); init_subr_2("puts",lputs, "(puts STRING FILEP)\n\ Write STRING (print name of symbol) to FILEP. If FILEP is nil or not\n\ specified output goes to stdout."); init_subr_1("ftell",lftell, "(ftell FILEP)\n\ Returns position in file FILEP is currently pointing at."); init_subr_3("fseek",lfseek, "(fseek FILEP OFFSET DIRECTION)\n\ Position FILEP to OFFSET. If DIRECTION is 0 offset is from start of file.\n\ If DIRECTION is 1, offset is from current position. If DIRECTION is\n\ 2 offset is from end of file."); init_subr_1("probe_file",probe_file, "(probe_file FILENAME)\n\ Returns t if FILENAME exists and is readable, nil otherwise."); init_subr_1("delete-file",lunlink, "(delete-file FILENAME)\n\ Delete named file."); init_subr_2("load",load, "(load FILENAME OPTION)\n\ Load s-expressions in FILENAME. If OPTION is nil or unspecified evaluate\n\ each s-expression in FILENAME as it is read, if OPTION is t, return them\n\ unevaluated in a list."); init_subr_2("directory-entries", directory_entries, "(directory-entries DIRECTORY &opt NOFLAGDIR)\n\ Return a list of the entries in the directory. If NOFLAGDIR is non-null\n\ don't check to see which are directories."); init_subr_3("save-forms",save_forms, "(save-forms FILENAME FORMS HOW)\n\ Save FORMS in FILENAME. If HOW is a appending FORMS to FILENAME,\n\ or if HOW is w start from the beginning of FILENAME."); } speech_tools/siod/slib_format.cc0000644000076400007640000002540610127000720015423 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1996 */ /*-----------------------------------------------------------------------*/ /* */ /* A format function for formated output (like printf) */ /* */ /* Its amazing how much I have to write myself to get this to work when */ /* most people believe this a c library function. */ /* */ /*=======================================================================*/ #include #include #include "EST_cutils.h" #include "siod.h" #include "siodp.h" static int format_string(LISP fd,const char *formatstr, const char *str); static int format_lisp(LISP fd,const char *formatstr, LISP a); static int format_int(LISP fd,const char *formatstr, int i); static int format_float(LISP fd,const char *formatstr, float f); static int format_double(LISP fd,const char *formatstr, double d); static int format_char(LISP fd, char c); static int get_field_width(const char *directive); static char *get_directive(const char *fstr); static char directive_type(const char *fstr); static void output_string(LISP fd,const char *str); static int count_arg_places(const char *formatstring); static EST_String outstring; static EST_Regex anumber_rx("[0-9]+"); LISP l_format(LISP args) { // A format function for formated output // Hmm not sure how to do this without writing lots myself const char *formatstring = get_c_string(car(cdr(args))); LISP lfd = car(args); LISP fargs = cdr(cdr(args)); int i; LISP a; if (count_arg_places(formatstring) != siod_llength(fargs)) err("format: wrong number of args for format string",NIL); outstring=""; for (i=0,a=fargs; formatstring[i] != '\0'; i++) { if (formatstring[i] != '%') format_char(lfd,formatstring[i]); else if (formatstring[i+1] == '%') { format_char(lfd,formatstring[i]); i++; // skip quoted % } else if (directive_type(formatstring+i) == 's') { i+= format_string(lfd,formatstring+i,get_c_string(car(a))); a = cdr(a); } else if (directive_type(formatstring+i) == 'l') { i+= format_lisp(lfd,formatstring+i,car(a)); a = cdr(a); } else if ((directive_type(formatstring+i) == 'd') || (directive_type(formatstring+i) == 'x')) { i += format_int(lfd,formatstring+i,(int)get_c_int(car(a))); a = cdr(a); } else if (directive_type(formatstring+i) == 'f') { i += format_float(lfd,formatstring+i,(float)get_c_double(car(a))); a = cdr(a); } else if (directive_type(formatstring+i) == 'g') { i += format_double(lfd,formatstring+i,get_c_double(car(a))); a = cdr(a); } else if (directive_type(formatstring+i) == 'c') { format_char(lfd,(char)get_c_int(car(a))); i++; a = cdr(a); } else { cerr << "SIOD format: unsupported format directive %" << directive_type(formatstring+i) << endl; err("",NIL); } } if (lfd == NIL) return strintern(outstring); else return NIL; } static int format_string(LISP fd,const char *formatstr, const char *str) { // Output str to fd using directive at start of formatstr // Returns the number character in the format directive char *directive = get_directive(formatstr); int width = get_field_width(directive); char *buff; if (width > (signed)strlen(str)) buff = walloc(char,width+10); else buff = walloc(char,strlen(str)+1); sprintf(buff,directive,str); output_string(fd,buff); width = strlen(directive)-1; wfree(buff); wfree(directive); return width; } static int format_lisp(LISP fd,const char *formatstr, LISP a) { // Output a as str to fd using directive at start of formatstr // Returns the number character in the format directive char *directive = get_directive(formatstr); int width = get_field_width(directive); EST_String buff; if (width != 0) err("format: width in %l not supported",NIL); buff = siod_sprint(a); output_string(fd,buff); width = strlen(directive)-1; wfree(directive); return width; } static int format_int(LISP fd, const char *formatstr, int i) { // Output i to fd using directive at start of formatstr // Returns the number character in the format directive char *directive = get_directive(formatstr); int width = get_field_width(directive); char *buff; if (width > 20) buff = walloc(char,width+10); else buff = walloc(char,20); sprintf(buff,directive,i); output_string(fd,buff); width = strlen(directive)-1; wfree(buff); wfree(directive); return width; } static int format_float(LISP fd, const char *formatstr, float f) { // Output f to fd using directive at start of formatstr // Returns the number character in the format directive char *directive = get_directive(formatstr); int width = get_field_width(directive); char *buff; if (width > 20) buff = walloc(char,width+10); else buff = walloc(char,20); sprintf(buff,directive,f); output_string(fd,buff); width = strlen(directive)-1; wfree(buff); wfree(directive); return width; } static int format_double(LISP fd, const char *formatstr, double d) { // Output f to fd using directive at start of formatstr // Returns the number character in the format directive char *directive = get_directive(formatstr); int width = get_field_width(directive); char *buff; if (width > 30) buff = walloc(char,width+10); else buff = walloc(char,30); sprintf(buff,directive,d); output_string(fd,buff); width = strlen(directive)-1; wfree(buff); wfree(directive); return width; } static int format_char(LISP fd, char c) { // Output c to fd using directive at start of formatstr // Returns the number character in the format directive char buff[10]; sprintf(buff,"%c",c); output_string(fd,buff); return 0; } static int get_field_width(const char *directive) { // Look inside the directive for any explicit width info if (strlen(directive) == 2) return 0; else { EST_String nums = directive; nums = nums.at(1,strlen(directive)-2); if (nums.matches(anumber_rx)) return atoi(nums); else if (nums.contains(".")) { EST_String n1 = nums.before("."); EST_String n2 = nums.after("."); return atoi(n1) + atoi(n2); } else { cerr << "SIOD format: can't find width in directive " << directive << endl; err("",NIL); } } return 0; } static char *get_directive(const char *fstr) { // Copy the format directive from the start of this string int i; for (i=0; fstr[i] != '\0'; i++) if ((fstr[i] >= 'a') && (fstr[i] <= 'z')) break; if (fstr[i] == '\0') err("format: premature end of format structure",NIL); char *direct = walloc(char,i+2); memmove(direct,fstr,i+1); direct[i+1] = '\0'; return direct; } static char directive_type(const char *fstr) { // return the next lower case character. This identifies the // type of the argument to be inserted in the format string int i; for (i=0; fstr[i] != '\0'; i++) if ((fstr[i] >= 'a') && (fstr[i] <= 'z')) { return fstr[i]; } err("SIOD format: premature end of format structure",NIL); return '\0'; } static void output_string(LISP fd, const char *str) { if (fd == NIL) outstring += str; else if (fd == truth) fprintf(stdout,"%s",str); else if (TYPEP(fd,tc_c_file)) fprintf(get_c_file(fd,NULL),"%s",str); else err("format: not a file",fd); } static int count_arg_places(const char *formatstring) { // count number of places in the format string. int c,i; for (c=i=0; formatstring[i] != '\0'; i++) if (formatstring[i] == '%') { if (formatstring[i+1] == '%') i++; else c++; } return c; } void init_subrs_format() { init_lsubr("format",l_format, "(format FD FORMATSTRING ARG0 ARG1 ...)\n\ Output ARGs to FD using FROMATSTRING. FORMATSTRING is like a printf\n\ formatstrng. FD may be a filedescriptor, or t (standard output) or\n\ nil (return as a string). Note not all printf format directive are\n\ supported. %l is additionally support for Lisp objects.\n\ [see Scheme I/O]"); } speech_tools/siod/slib_list.cc0000644000076400007640000001476110127000720015110 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * General list functions */ #include #include "siod.h" #include "siodp.h" static LISP llength(LISP obj) {LISP l; long n; switch TYPE(obj) {case tc_string: return(flocons(obj->storage_as.string.dim)); case tc_double_array: return(flocons(obj->storage_as.double_array.dim)); case tc_long_array: return(flocons(obj->storage_as.long_array.dim)); case tc_lisp_array: return(flocons(obj->storage_as.lisp_array.dim)); case tc_nil: return(flocons(0.0)); case tc_cons: for(l=obj,n=0;CONSP(l);l=CDR(l),++n) INTERRUPT_CHECK(); if NNULLP(l) err("improper list to length",obj); return(flocons(n)); default: return(err("wrong type of argument to length",obj));}} LISP assoc(LISP x,LISP alist) {LISP l,tmp; for(l=alist;CONSP(l);l=CDR(l)) {tmp = CAR(l); if (CONSP(tmp) && equal(CAR(tmp),x)) return(tmp); INTERRUPT_CHECK();} if EQ(l,NIL) return(NIL); return(err("improper list to assoc",alist));} LISP assq(LISP x,LISP alist) {LISP l,tmp; for(l=alist;CONSP(l);l=CDR(l)) {tmp = CAR(l); if (CONSP(tmp) && EQ(CAR(tmp),x)) return(tmp); INTERRUPT_CHECK();} if EQ(l,NIL) return(NIL); return(err("improper list to assq",alist));} LISP setcar(LISP cell, LISP value) {if NCONSP(cell) err("wrong type of argument to setcar",cell); return(CAR(cell) = value);} LISP setcdr(LISP cell, LISP value) {if NCONSP(cell) err("wrong type of argument to setcdr",cell); return(CDR(cell) = value);} LISP delq(LISP elem,LISP l) {if NULLP(l) return(l); STACK_CHECK(&elem); if EQ(elem,car(l)) return(cdr(l)); setcdr(l,delq(elem,cdr(l))); return(l);} LISP copy_list(LISP x) {if NULLP(x) return(NIL); STACK_CHECK(&x); return(cons(car(x),copy_list(cdr(x))));} static LISP eq(LISP x,LISP y) {if EQ(x,y) return(truth); else return(NIL);} LISP eql(LISP x,LISP y) {if EQ(x,y) return(truth); else if NFLONUMP(x) return(NIL); else if NFLONUMP(y) return(NIL); else if (FLONM(x) == FLONM(y)) return(truth); return(NIL);} static LISP nullp(LISP x) {if EQ(x,NIL) return(truth); else return(NIL);} LISP siod_flatten(LISP tree) { if (tree == NIL) return NIL; else if (consp(tree)) return append(siod_flatten(car(tree)),siod_flatten(cdr(tree))); else return cons(tree,NIL); } LISP cons(LISP x,LISP y) {LISP z; NEWCELL(z,tc_cons); CAR(z) = x; CDR(z) = y; return(z);} LISP atomp(LISP x) { if ((x==NIL) || CONSP(x)) return NIL; else return truth; } LISP consp(LISP x) {if CONSP(x) return(truth); else return(NIL);} LISP car(LISP x) {switch TYPE(x) {case tc_nil: return(NIL); case tc_cons: return(CAR(x)); default: return(err("wrong type of argument to car",x));}} LISP cdr(LISP x) {switch TYPE(x) {case tc_nil: return(NIL); case tc_cons: return(CDR(x)); default: return(err("wrong type of argument to cdr",x));}} LISP equal(LISP a,LISP b) {struct user_type_hooks *p; long atype; STACK_CHECK(&a); loop: INTERRUPT_CHECK(); if EQ(a,b) return(truth); atype = TYPE(a); if (atype != TYPE(b)) return(NIL); switch(atype) {case tc_cons: if NULLP(equal(car(a),car(b))) return(NIL); a = cdr(a); b = cdr(b); goto loop; case tc_flonum: return((FLONM(a) == FLONM(b)) ? truth : NIL); case tc_symbol: case tc_closure: case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: return(NIL); default: p = get_user_type_hooks(atype); if (p->equal) return((*p->equal)(a,b)); else if (p) /* a user type */ return ((USERVAL(a) == USERVAL(b)) ? truth : NIL); else return(NIL);}} LISP reverse(LISP l) {LISP n,p; n = NIL; for(p=l;NNULLP(p);p=cdr(p)) n = cons(car(p),n); return(n);} LISP append(LISP l1, LISP l2) {LISP n=l2,p,rl1 = reverse(l1); for(p=rl1;NNULLP(p);p=cdr(p)) n = cons(car(p),n); return(n);} void init_subrs_list(void) { init_subr_2("assoc",assoc, "(assoc KEY A-LIST)\n\ Return pair with KEY in A-LIST or nil."); init_subr_1("length",llength, "(length LIST)\n\ Return length of LIST, or 0 if LIST is not a list."); init_subr_1("flatten",siod_flatten, "(flatten LIST)\n\ Return flatend list (list of all atoms in LIST)."); init_subr_2("assq",assq, "(assq ITEM ALIST)\n\ Returns pairs from ALIST whose car is ITEM or nil if ITEM is not in ALIST."); init_subr_2("delq",delq, "(delq ITEM LIST)\n\ Destructively delete ITEM from LIST, returns LIST, if ITEM is not first\n\ in LIST, cdr of LIST otherwise. If ITEM is not in LIST, LIST is\n\ returned unchanged." ); init_subr_1("copy-list",copy_list, "(copy-list LIST)\n\ Return new list with same members as LIST."); init_subr_2("cons",cons, "(cons DATA1 DATA2)\n\ Construct cons pair whose car is DATA1 and cdr is DATA2."); init_subr_1("pair?",consp, "(pair? DATA)\n\ Returns t if DATA is a cons cell, nil otherwise."); init_subr_1("car",car, "(car DATA1)\n\ Returns car of DATA1. If DATA1 is nil or a symbol, return nil."); init_subr_1("cdr",cdr, "(cdr DATA1)\n\ Returns cdr of DATA1. If DATA1 is nil or a symbol, return nil."); init_subr_2("set-car!",setcar, "(set-car! CONS1 DATA1)\n\ Set car of CONS1 to be DATA1. Returns CONS1. If CONS1 not of type\n\ consp an error is is given. This is a destructive operation."); init_subr_2("set-cdr!",setcdr, "(set-cdr! CONS1 DATA1)\n\ Set cdr of CONS1 to be DATA1. Returns CONS1. If CONS1 not of type\n\ consp an error is is given. This is a destructive operation."); init_subr_2("eq?",eq, "(eq? DATA1 DATA2)\n\ Returns t if DATA1 and DATA2 are the same object."); init_subr_2("eqv?",eql, "(eqv? DATA1 DATA2)\n\ Returns t if DATA1 and DATA2 are the same object or equal numbers."); init_subr_2("equal?",equal, "(equal? A B)\n\ t if s-expressions A and B are recursively equal, nil otherwise."); init_subr_1("not",nullp, "(not DATA)\n\ Returns t if DATA is nil, nil otherwise."); init_subr_1("null?",nullp, "(null? DATA)\n\ Returns t if DATA is nil, nil otherwise."); init_subr_1("reverse",reverse, "(reverse LIST)\n\ Returns destructively reversed LIST."); init_subr_2("append",append, "(append LIST1 LIST2)\n\ Returns LIST2 appended to LIST1, LIST1 is distroyed."); } speech_tools/siod/slib_math.cc0000644000076400007640000001204010127000720015052 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * math functions */ #include #include "siod.h" #include "siodp.h" LISP numberp(LISP x) {if FLONUMP(x) return(truth); else return(NIL);} static LISP lplus(LISP args) { LISP l; double sum; for (sum=0.0,l=args; l != NIL; l=cdr(l)) { if (NFLONUMP(car(l))) err("wrong type of argument to plus",car(l)); sum += FLONM(car(l)); } return flocons(sum); } static LISP ltimes(LISP args) { LISP l; double product; for (product=1.0,l=args; l != NIL; l=cdr(l)) { if (NFLONUMP(car(l))) err("wrong type of argument to times",car(l)); product *= FLONM(car(l)); } return flocons(product); } static LISP difference(LISP x,LISP y) {if NFLONUMP(x) err("wrong type of argument(1st) to difference",x); if NFLONUMP(y) err("wrong type of argument(2nd) to difference",y); return(flocons(FLONM(x) - FLONM(y)));} static LISP quotient(LISP x,LISP y) {if NFLONUMP(x) err("wrong type of argument(1st) to quotient",x); if NFLONUMP(y) err("wrong type of argument(2nd) to quotient",y); return(flocons(FLONM(x)/FLONM(y)));} static LISP greaterp(LISP x,LISP y) {if NFLONUMP(x) err("wrong type of argument(1st) to greaterp",x); if NFLONUMP(y) err("wrong type of argument(2nd) to greaterp",y); if (FLONM(x)>FLONM(y)) return(truth); return(NIL);} static LISP lessp(LISP x,LISP y) {if NFLONUMP(x) err("wrong type of argument(1st) to lessp",x); if NFLONUMP(y) err("wrong type of argument(2nd) to lessp",y); if (FLONM(x)",greaterp, "(> NUM1 NUM2)\n\ Returns t if NUM1 is greater than NUM2, nil otherwise. An error is\n\ given is either argument is not a number."); init_subr_2("<",lessp, "(< NUM1 NUM2)\n\ Returns t if NUM1 is less than NUM2, nil otherwise. An error is\n\ given is either argument is not a number."); init_subr_1("nint",l_nint, "(nint NUMBER)\n\ Returns nearest int to NUMBER."); init_subr_1("log",l_log, "(log NUM)\n\ Return natural log of NUM."); init_subr_0("rand",l_rand, "(rand)\n\ Returns a pseudo random number between 0 and 1 using the libc rand()\n\ function."); init_subr_1("srand",l_srand, "(srand SEED)\n\ Seeds the libc pseudo random number generator with the integer SEED."); init_subr_1("exp",l_exp, "(exp NUM)\n\ Return e**NUM."); init_subr_1("sqrt",l_sqrt, "(sqrt NUM)\n\ Return square root of NUM."); init_subr_2("pow",l_pow, "(pow X Y)\n\ Return X**Y."); init_subr_2("%",l_mod, "(% X Y)\n\ Return X%Y."); } speech_tools/siod/slib_sys.cc0000644000076400007640000000477010150172171014760 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * System functions */ #include #include "siod.h" #include "siodp.h" #ifdef unix #include #include #endif static LISP lgetenv(LISP name) { return rintern(getenv(get_c_string(name))); } static LISP lsetenv(LISP name,LISP value) { char *entry=walloc(char,strlen(get_c_string(name))+ strlen(get_c_string(value))+16); sprintf(entry,"%s=%s",get_c_string(name),get_c_string(value)); putenv(entry); return name; } static LISP lsystem(LISP name) { system(get_c_string(name)); return NIL; } static LISP lpwd(void) { char *cwd; cwd = getcwd(NULL,1024); return cintern(cwd); } static LISP lchdir(LISP args, LISP env) { (void)env; char *home; if (siod_llength(args) == 0) { home = getenv("HOME"); chdir(home); return rintern(home); } else { chdir(get_c_string(leval(car(args),env))); return (car(args)); } } static LISP lgetpid(void) { return flocons((float)getpid()); } static long siod_time_base; LISP siod_time() { #ifdef unix struct timeval tv; struct timezone tz; gettimeofday(&tv,&tz); return flocons(((double)(tv.tv_sec-siod_time_base))+ ((double)tv.tv_usec/1000000)); #else return flocons(0); #endif } void init_subrs_sys(void) { #ifdef unix struct timeval tv; struct timezone tz; gettimeofday(&tv,&tz); siod_time_base = tv.tv_sec; #endif init_subr_0("getpid",lgetpid, "(getpid)\n\ Return process id."); init_fsubr("cd",lchdir, "(cd DIRNAME)\n\ Change directory to DIRNAME, if DIRNAME is nil or not specified \n\ change directory to user's HOME directory."); init_subr_0("pwd",lpwd, "(pwd)\n\ Returns current directory as a string."); init_subr_1("getenv",lgetenv, "(getenv VARNAME)\n\ Returns value of UNIX environment variable VARNAME, or nil if VARNAME\n\ is unset."); init_subr_2("setenv",lsetenv, "(setenv VARNAME VALUE)\n\ Set the UNIX environment variable VARNAME to VALUE."); init_subr_1("system",lsystem, "(system COMMAND)\n\ Execute COMMAND (a string) with the UNIX shell."); init_subr_0("time", siod_time, "(time)\n\ Returns number of seconds since start of epoch (if OS permits it\n\ countable)."); } speech_tools/siod/slib_server.cc0000644000076400007640000000514110127000720015433 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * Client/server functions */ #include #include "EST_io_aux.h" #include "siod.h" #include "siodp.h" int siod_server_socket = -1; LISP siod_send_lisp_to_client(LISP x) { // Send x to the client if (siod_server_socket == -1) { err("siod: not in server mode",x); } EST_String tmpfile = make_tmp_filename(); FILE *fd; EST_String m = siod_sprint(x); if ((fd=fopen(tmpfile,"wb")) == NULL) { cerr << "siod: can't open temporary file \"" << tmpfile << "\" for client lisp return" << endl; } else { fwrite((const char *)m,sizeof(char),m.length(),fd); fwrite("\n",1,1,fd); fclose(fd); #ifdef WIN32 send(siod_server_socket,"LP\n",3,0); #else write(siod_server_socket,"LP\n",3); #endif socket_send_file(siod_server_socket,tmpfile); unlink(tmpfile); } return x; } void sock_acknowledge_error() { // Called to let client know if server gets an error // Thanks to mcb for pointing out this omission if (siod_server_socket != -1) #ifdef WIN32 send(siod_server_socket,"ER\n",3,0); #else write(siod_server_socket,"ER\n",3); #endif } static void acknowledge_sock_print(LISP x) { // simple return "OK" -- used in server socket mode siod_send_lisp_to_client(x); #ifdef WIN32 send(siod_server_socket,"OK\n",3,0); #else write(siod_server_socket,"OK\n",3); #endif } static void ignore_puts(char *x) { (void)x; } long repl_from_socket(int fd) { /* Read from given fd as stdin */ struct repl_hooks hd; #ifdef WIN32 if (!SetStdHandle(STD_INPUT_HANDLE,(HANDLE)fd)) { GetLastError(); cerr << "repl_from_socket: couldn't set stdin to socket\n"; } #else dup2(fd,0); // make socket into stdin // dup2(fd,1); // make socket into stdout #endif hd.repl_puts = ignore_puts; hd.repl_print = acknowledge_sock_print; hd.repl_eval = NULL; #ifdef WIN32 hd.repl_read = lreadwinsock; #else hd.repl_read = NULL; #endif siod_interactive = FALSE; siod_server_socket = fd; return repl_driver(1,0,&hd); } void init_subrs_srv(void) { init_subr_1("send_client",siod_send_lisp_to_client, "(send_client EXPR)\n\ Send EXPR to client. In server mode this will send a printed form of\n\ ESPR to the client. It is the client's job to expect it."); } speech_tools/siod/slib_str.cc0000644000076400007640000002444210535625243014762 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * * Reorganization of files (Mar 1999) by Alan W Black * String functions */ #include #include #include #include #include #include "EST_Pathname.h" #include "EST_cutils.h" #include "siod.h" #include "siodp.h" LISP strintern(const char *data) { return strcons(strlen(data),data); } LISP strcons(long length,const char *data) {long flag; LISP s; flag = no_interrupt(1); s = cons(NIL,NIL); s->type = tc_string; s->storage_as.string.data = must_malloc(length+1); s->storage_as.string.dim = length; if (data) memmove(s->storage_as.string.data,data,length+1); no_interrupt(flag); return(s);} LISP cstrcons(const char *data) {long flag; LISP s; flag = no_interrupt(1); s = cons(NIL,NIL); s->type = tc_string; s->storage_as.string.data = (char *)(void *)data; s->storage_as.string.dim = strlen(data); no_interrupt(flag); return(s);} static int rfs_getc(unsigned char **p) {int i; i = **p; if (!i) return(EOF); *p = *p + 1; return(i);} static void rfs_ungetc(unsigned char c,unsigned char **p) {(void)c; *p = *p - 1;} LISP read_from_lstring(LISP x) {return read_from_string(get_c_string(x));} LISP read_from_string(const char *string) {char *p,*q; LISP r; struct gen_readio s; q = wstrdup(string); p = q; s.getc_fcn = (int (*)(char *))rfs_getc; s.ungetc_fcn = (void (*)(int, char *))rfs_ungetc; s.cb_argument = (char *) &p; r = readtl(&s); wfree(q); return r; } LISP string_append(LISP args) {long size; LISP l,s; char *data; size = 0; for(l=args;NNULLP(l);l=cdr(l)) size += strlen(get_c_string(car(l))); s = strcons(size,NULL); data = s->storage_as.string.data; data[0] = 0; for(l=args;NNULLP(l);l=cdr(l)) strcat(data,get_c_string(car(l))); return(s);} LISP string_length(LISP string) {if NTYPEP(string,tc_string) err("not a string",string); return(flocons((double)string->storage_as.string.dim));} LISP parse_number(LISP x) {const char *c; c = get_c_string(x); return(flocons(atof(c)));} LISP string_downcase(LISP symbol) { const char *symname = get_c_string(symbol); char *downsym = wstrdup(symname); LISP newsym; int i; for (i=0; symname[i] != '\0'; i++) if (isupper(symname[i])) downsym[i] = tolower(symname[i]); else downsym[i] = symname[i]; downsym[i] = '\0'; newsym = strintern(downsym); wfree(downsym); return newsym; } LISP string_upcase(LISP symbol) { const char *symname = get_c_string(symbol); char *upsym = wstrdup(symname); LISP newsym; int i; for (i=0; symname[i] != '\0'; i++) if (islower(symname[i])) upsym[i] = toupper(symname[i]); else upsym[i] = symname[i]; upsym[i] = '\0'; newsym = strintern(upsym); wfree(upsym); return newsym; } LISP path_is_dirname(LISP lpath) { EST_Pathname path(get_c_string(lpath)); return path.is_dirname()?lpath:NIL; } LISP path_is_filename(LISP lpath) { EST_Pathname path(get_c_string(lpath)); return path.is_filename()?lpath:NIL; } LISP path_as_directory(LISP lpath) { EST_Pathname path(get_c_string(lpath)); EST_Pathname res(path.as_directory()); return strintern(res); } LISP path_as_file(LISP lpath) { EST_Pathname path(get_c_string(lpath)); EST_Pathname res(path.as_file()); return strintern(res); } LISP path_append(LISP lpaths) { if (CONSP(lpaths)) { EST_Pathname res(get_c_string(car(lpaths))); lpaths = cdr(lpaths); while(lpaths != NIL) { res = res +get_c_string(car(lpaths)); lpaths = cdr(lpaths); } return strintern(res); } return NIL; } LISP path_basename(LISP lpath) { EST_Pathname path(get_c_string(lpath)); EST_Pathname res(path.basename(1)); return strintern(res); } LISP symbol_basename(LISP path, LISP suffix) { // Like UNIX basename const char *pathstr = get_c_string(path); const char *suff; char *bname; int i, j, k, start, end; LISP newsym; if (suffix == NIL) suff = ""; else suff = get_c_string(suffix); for (i=strlen(pathstr); i >= 0; i--) if (pathstr[i] == '/') break; start = i+1; for (j=strlen(pathstr),k=strlen(suff); k >= 0; k--,j--) if (pathstr[j] != suff[k]) break; if (k != -1) end = strlen(pathstr); else end = j+1; bname = walloc(char,end-start+1); memcpy(bname,&pathstr[start],end-start); bname[end-start] = '\0'; newsym = strcons(strlen(bname),bname); wfree(bname); return newsym; } static LISP lisp_to_string(LISP l) { EST_String s; s = siod_sprint(l); printf("%s\n",(const char *)s); return strintern(s); } static LISP symbolconc(LISP args) {long size; LISP l,s; size = 0; tkbuffer[0] = 0; for(l=args;NNULLP(l);l=cdr(l)) {s = car(l); if NSYMBOLP(s) err("wrong type of argument(non-symbol) to symbolconc",s); size = size + strlen(PNAME(s)); if (size > TKBUFFERN) err("symbolconc buffer overflow",NIL); strcat(tkbuffer,PNAME(s));} return(rintern(tkbuffer));} LISP symbolexplode(LISP name) { LISP e=NIL; const char *pname = get_c_string(name); char tt[2]; int i; tt[1]='\0'; for (i=0; pname[i] != '\0'; i++) { tt[0] = pname[i]; e = cons(rintern(tt),e); } return reverse(e); } LISP l_matches(LISP atom, LISP regex) { // t if printname of atom matches regex, nil otherwise const EST_String pname = get_c_string(atom); if (pname.matches(make_regex(get_c_string(regex))) == TRUE) return truth; else return NIL; } LISP l_strequal(LISP atom1, LISP atom2) { if (streq(get_c_string(atom1),get_c_string(atom2))) return truth; else return NIL; } LISP l_substring(LISP string, LISP l_start, LISP l_length) { // As string might actually be a buffer containing nulls we // do this a little carefully. if (NTYPEP(string,tc_string)) err("not a string",string); const char *data = string->storage_as.string.data; int dim = string->storage_as.string.dim; int start = ( get_c_int(l_start) < dim ? get_c_int(l_start) : dim ); int length = ( (get_c_int(l_length) + start) < dim ? get_c_int(l_length) : dim-start ); char *nbuffer = walloc(char, length+1); memmove(nbuffer,data+start,length); nbuffer[length] = '\0'; LISP ncell = strcons(length, nbuffer); wfree(nbuffer); return ncell; } static LISP l_sbefore(LISP atom, LISP before) { // Wraparound for EST_String.before function EST_String pname = get_c_string(atom); EST_String b = get_c_string(before); EST_String n = pname.before(b); return strintern(n); } static LISP l_safter(LISP atom, LISP after) { // Wraparound for EST_String.after function EST_String pname = get_c_string(atom); EST_String a = get_c_string(after); EST_String n = pname.after(a); return strintern(n); } void init_subrs_str(void) { init_lsubr("string-append",string_append, "(string-append STR1 STR2 ...)\n\ Return a string made from the concatenation of the print names of STR1\n\ STR2 ..."); init_subr_1("string-length",string_length, "(string-length SYMBOL)\n\ Return the number of characters in the print name of SYMBOL."); init_subr_1("print_string",lisp_to_string, "(print_string DATA)\n\ Returns a string representing the printing of DATA." ); init_subr_1("read-from-string",read_from_lstring, "(read-from-string SYMBOL)\n\ Return first s-expression in print name of SYMBOL."); init_subr_1("downcase",string_downcase, "(downcase SYMBOL)\n\ Returns a string with the downcased version of SYMBOL's printname."); init_subr_1("upcase",string_upcase, "(upcase SYMBOL)\n\ Returns a string with the upcased version of SYMBOL's printname."); init_subr_2("string-matches",l_matches, "(string-matches ATOM REGEX)\n\ Returns t if ATOM's printname matches the regular expression REGEX,\n\ otherwise it returns nil."); init_subr_2("string-equal",l_strequal, "(string-equal ATOM1 ATOM2)\n\ Returns t if ATOM's printname is equal to ATOM's print name, otherwise\n\ it returns nil."); init_subr_3("substring", l_substring, "(substring STRING START LENGTH)\n\ Return a substring of STRING starting at START of length LENGTH."); init_subr_2("string-before",l_sbefore, "(string-before ATOM BEFORE)\n\ Returns an atom whose printname is the substring of ATOM's printname \n\ which appears before BEFORE. This is a wraparound for the EST_String.before \n\ function in C++, and hence has the same conditions for boundary cases."); init_subr_2("string-after",l_safter, "(string-after ATOM AFTER)\n\ Returns an atom whose printname is the substring of ATOM's printname \n\ which appears after AFTER. This is a wraparound for the EST_String.after \n\ function in C++, and hence has the same conditions for boundary cases."); init_lsubr("symbolconc",symbolconc, "(symbolconc SYMBOL1 SYMBOL2 ...)\n\ Form new symbol by concatenation of the print forms of each of SYMBOL1\n\ SYMBOL2 etc."); init_subr_1("symbolexplode",symbolexplode, "(symbolexplode SYMBOL)\n\ Returns list of atoms one for each character in the print name of SYMBOL."); init_subr_1("parse-number",parse_number, "(parse-number SYMBOL)\n\ Returns a number form a symbol or string whose print name is a number."); init_subr_2("basename",symbol_basename, "(basename PATH SUFFIX)\n\ Return a string with directory removed from basename. If SUFFIX is\n\ specified remove that from end of PATH. Basically the same function\n\ as the UNIX command of the same name."); init_subr_1("path-is-filename", path_is_filename, "(path-is-filename PATHNAME)\n\ Is PATH a non-directory name."); init_subr_1("path-as-directory", path_as_directory, "(path-as-directory PATHNAME)\n\ Return PATH as a directory name."); init_subr_1("path-as-file", path_as_file, "(path-as-file PATHNAME)\n\ Return PATH as a non-directory name."); init_lsubr("path-append", path_append, "(path-append DIRECTORY-PATH ADDITION1 ADDITION2 ...)\n\ Return a the path for ADDITION in DIRECTORY."); init_subr_1("path-basename", path_basename, "(path-basename PATHNAME)\n\ Return name part of PATH."); init_subr_1("path-is-dirname", path_is_dirname, "(path-is-dirname PATHNAME)\n\ Is PATH a directory name."); } speech_tools/siod/slib_xtr.cc0000644000076400007640000004231710127000720014750 0ustar awbawb/* * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * Array-hacking code moved to another source file. * Functions *not* used in Edinburgh Speech Tools * arrays, hash tables, */ #include #include #include #include #include #include "siod.h" #include "siodp.h" static LISP bashnum = NIL; static LISP array_gc_relocate(LISP ptr) {LISP nw; if ((nw = heap) >= heap_end) gc_fatal_error(); heap = nw+1; memcpy(nw,ptr,sizeof(struct obj)); return(nw);} static void array_gc_scan(LISP ptr) {long j; if TYPEP(ptr,tc_lisp_array) for(j=0;j < ptr->storage_as.lisp_array.dim; ++j) ptr->storage_as.lisp_array.data[j] = gc_relocate(ptr->storage_as.lisp_array.data[j]);} static LISP array_gc_mark(LISP ptr) {long j; if TYPEP(ptr,tc_lisp_array) for(j=0;j < ptr->storage_as.lisp_array.dim; ++j) gc_mark(ptr->storage_as.lisp_array.data[j]); return(NIL);} static void array_gc_free(LISP ptr) {switch (ptr->type) {case tc_string: wfree(ptr->storage_as.string.data); break; case tc_double_array: wfree(ptr->storage_as.double_array.data); break; case tc_long_array: wfree(ptr->storage_as.long_array.data); break; case tc_lisp_array: wfree(ptr->storage_as.lisp_array.data); break;}} static void array_prin1(LISP ptr,FILE *f) {int j; switch (ptr->type) {case tc_string: fput_st(f,"\""); fput_st(f,ptr->storage_as.string.data); fput_st(f,"\""); break; case tc_double_array: fput_st(f,"#("); for(j=0; j < ptr->storage_as.double_array.dim; ++j) {sprintf(tkbuffer,"%g",ptr->storage_as.double_array.data[j]); fput_st(f,tkbuffer); if ((j + 1) < ptr->storage_as.double_array.dim) fput_st(f," ");} fput_st(f,")"); break; case tc_long_array: fput_st(f,"#("); for(j=0; j < ptr->storage_as.long_array.dim; ++j) {sprintf(tkbuffer,"%ld",ptr->storage_as.long_array.data[j]); fput_st(f,tkbuffer); if ((j + 1) < ptr->storage_as.long_array.dim) fput_st(f," ");} fput_st(f,")"); break; case tc_lisp_array: fput_st(f,"#("); for(j=0; j < ptr->storage_as.lisp_array.dim; ++j) {lprin1f(ptr->storage_as.lisp_array.data[j],f); if ((j + 1) < ptr->storage_as.lisp_array.dim) fput_st(f," ");} fput_st(f,")"); break;}} static LISP aref1(LISP a,LISP i) {long k; if NFLONUMP(i) err("bad index to aref",i); k = (long) FLONM(i); if (k < 0) err("negative index to aref",i); switch (a->type) {case tc_string: if (k >= a->storage_as.string.dim) err("index too large",i); return(flocons((double) a->storage_as.string.data[k])); case tc_double_array: if (k >= a->storage_as.double_array.dim) err("index too large",i); return(flocons(a->storage_as.double_array.data[k])); case tc_long_array: if (k >= a->storage_as.long_array.dim) err("index too large",i); return(flocons(a->storage_as.long_array.data[k])); case tc_lisp_array: if (k >= a->storage_as.lisp_array.dim) err("index too large",i); return(a->storage_as.lisp_array.data[k]); default: return(err("invalid argument to aref",a));}} static void err1_aset1(LISP i) {err("index to aset too large",i);} static void err2_aset1(LISP v) {err("bad value to store in array",v);} static LISP aset1(LISP a,LISP i,LISP v) {long k; if NFLONUMP(i) err("bad index to aset",i); k = (long) FLONM(i); if (k < 0) err("negative index to aset",i); switch (a->type) {case tc_string: if NFLONUMP(v) err2_aset1(v); if (k >= a->storage_as.string.dim) err1_aset1(i); a->storage_as.string.data[k] = (char) FLONM(v); return(v); case tc_double_array: if NFLONUMP(v) err2_aset1(v); if (k >= a->storage_as.double_array.dim) err1_aset1(i); a->storage_as.double_array.data[k] = FLONM(v); return(v); case tc_long_array: if NFLONUMP(v) err2_aset1(v); if (k >= a->storage_as.long_array.dim) err1_aset1(i); a->storage_as.long_array.data[k] = (long) FLONM(v); return(v); case tc_lisp_array: if (k >= a->storage_as.lisp_array.dim) err1_aset1(i); a->storage_as.lisp_array.data[k] = v; return(v); default: return(err("invalid argument to aset",a));}} static LISP cons_array(LISP dim,LISP kind) {LISP a; long flag,n,j; if (NFLONUMP(dim) || (FLONM(dim) < 0)) return(err("bad dimension to cons-array",dim)); else n = (long) FLONM(dim); flag = no_interrupt(1); a = cons(NIL,NIL); if EQ(cintern("double"),kind) {a->type = tc_double_array; a->storage_as.double_array.dim = n; a->storage_as.double_array.data = (double *) must_malloc(n * sizeof(double)); for(j=0;jstorage_as.double_array.data[j] = 0.0;} else if EQ(cintern("long"),kind) {a->type = tc_long_array; a->storage_as.long_array.dim = n; a->storage_as.long_array.data = (long *) must_malloc(n * sizeof(long)); for(j=0;jstorage_as.long_array.data[j] = 0;} else if EQ(cintern("string"),kind) {a->type = tc_string; a->storage_as.double_array.dim = n+1; a->storage_as.string.data = (char *) must_malloc(n+1); a->storage_as.string.data[n] = 0; for(j=0;jstorage_as.string.data[j] = ' ';} else if (EQ(cintern("lisp"),kind) || NULLP(kind)) {a->type = tc_lisp_array; a->storage_as.lisp_array.dim = n; a->storage_as.lisp_array.data = (LISP *) must_malloc(n * sizeof(LISP)); for(j=0;jstorage_as.lisp_array.data[j] = NIL;} else err("bad type of array",kind); no_interrupt(flag); return(a);} #define HASH_COMBINE(_h1,_h2,_mod) ((((_h1) * 17 + 1) ^ (_h2)) % (_mod)) static long c_sxhash(LISP obj,long n) {long hash; unsigned char *s; LISP tmp; struct user_type_hooks *p; STACK_CHECK(&obj); INTERRUPT_CHECK(); switch TYPE(obj) {case tc_nil: return(0); case tc_cons: hash = c_sxhash(CAR(obj),n); for(tmp=CDR(obj);CONSP(tmp);tmp=CDR(tmp)) hash = HASH_COMBINE(hash,c_sxhash(CAR(tmp),n),n); hash = HASH_COMBINE(hash,c_sxhash(tmp,n),n); return(hash); case tc_symbol: for(hash=0,s=(unsigned char *)PNAME(obj);*s;++s) hash = HASH_COMBINE(hash,*s,n); return(hash); case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: for(hash=0,s=(unsigned char *) obj->storage_as.subr.name;*s;++s) hash = HASH_COMBINE(hash,*s,n); return(hash); case tc_flonum: return(((unsigned long)FLONM(obj)) % n); default: p = get_user_type_hooks(TYPE(obj)); if (p->c_sxhash) return((*p->c_sxhash)(obj,n)); else return(0);}} static LISP sxhash(LISP obj,LISP n) {return(flocons(c_sxhash(obj,FLONUMP(n) ? (long) FLONM(n) : 10000)));} static LISP array_equal(LISP a,LISP b) {long j,len; switch(TYPE(a)) {case tc_string: len = a->storage_as.string.dim; if (len != b->storage_as.string.dim) return(NIL); if (memcmp(a->storage_as.string.data,b->storage_as.string.data,len) == 0) return(truth); else return(NIL); case tc_long_array: len = a->storage_as.long_array.dim; if (len != b->storage_as.long_array.dim) return(NIL); if (memcmp(a->storage_as.long_array.data, b->storage_as.long_array.data, len * sizeof(long)) == 0) return(truth); else return(NIL); case tc_double_array: len = a->storage_as.double_array.dim; if (len != b->storage_as.double_array.dim) return(NIL); for(j=0;jstorage_as.double_array.data[j] != b->storage_as.double_array.data[j]) return(NIL); return(truth); case tc_lisp_array: len = a->storage_as.lisp_array.dim; if (len != b->storage_as.lisp_array.dim) return(NIL); for(j=0;jstorage_as.lisp_array.data[j], b->storage_as.lisp_array.data[j])) return(NIL); return(truth); default: return(errswitch());}} static long array_sxhash(LISP a,long n) {long j,len,hash; unsigned char *char_data; unsigned long *long_data; double *double_data; switch(TYPE(a)) {case tc_string: len = a->storage_as.string.dim; for(j=0,hash=0,char_data=(unsigned char *)a->storage_as.string.data; j < len; ++j,++char_data) hash = HASH_COMBINE(hash,*char_data,n); return(hash); case tc_long_array: len = a->storage_as.long_array.dim; for(j=0,hash=0,long_data=(unsigned long *)a->storage_as.long_array.data; j < len; ++j,++long_data) hash = HASH_COMBINE(hash,*long_data % n,n); return(hash); case tc_double_array: len = a->storage_as.double_array.dim; for(j=0,hash=0,double_data=a->storage_as.double_array.data; j < len; ++j,++double_data) hash = HASH_COMBINE(hash,(unsigned long)*double_data % n,n); return(hash); case tc_lisp_array: len = a->storage_as.lisp_array.dim; for(j=0,hash=0; j < len; ++j) hash = HASH_COMBINE(hash, c_sxhash(a->storage_as.lisp_array.data[j],n), n); return(hash); default: errswitch(); return(0);}} static long href_index(LISP table,LISP key) {long index; if NTYPEP(table,tc_lisp_array) err("not a hash table",table); index = c_sxhash(key,table->storage_as.lisp_array.dim); if ((index < 0) || (index >= table->storage_as.lisp_array.dim)) {err("sxhash inconsistency",table); return(0);} else return(index);} static LISP href(LISP table,LISP key) {return(cdr(assoc(key, table->storage_as.lisp_array.data[href_index(table,key)])));} static LISP hset(LISP table,LISP key,LISP value) {long index; LISP cell,l; index = href_index(table,key); l = table->storage_as.lisp_array.data[index]; if NNULLP(cell = assoc(key,l)) return(setcdr(cell,value)); cell = cons(key,value); table->storage_as.lisp_array.data[index] = cons(cell,l); return(value);} static LISP make_list(LISP x,LISP v) {long n; LISP l; n = get_c_int(x); l = NIL; while(n > 0) {l = cons(v,l); --n;} return(l);} static void put_long(long i,FILE *f) {fwrite(&i,sizeof(long),1,f);} static long get_long(FILE *f) {long i; fread(&i,sizeof(long),1,f); return(i);} static long fast_print_table(LISP obj,LISP table) {FILE *f; LISP ht,index; f = get_c_file(car(table),(FILE *) NULL); if NULLP(ht = car(cdr(table))) return(1); index = href(ht,obj); if NNULLP(index) {putc(FO_fetch,f); put_long(get_c_int(index),f); return(0);} if NULLP(index = car(cdr(cdr(table)))) return(1); hset(ht,obj,index); FLONM(bashnum) = 1.0; setcar(cdr(cdr(table)),flocons(get_c_int(bashnum)+get_c_int(index))); putc(FO_store,f); put_long(get_c_int(index),f); return(1);} static LISP fast_print(LISP obj,LISP table) {FILE *f; long len; LISP tmp; struct user_type_hooks *p; STACK_CHECK(&obj); f = get_c_file(car(table),(FILE *) NULL); switch(TYPE(obj)) {case tc_nil: putc(tc_nil,f); return(NIL); case tc_cons: for(len=0,tmp=obj;CONSP(tmp);tmp=CDR(tmp)) {INTERRUPT_CHECK();++len;} if (len == 1) {putc(tc_cons,f); fast_print(car(obj),table); fast_print(cdr(obj),table);} else if NULLP(tmp) {putc(FO_list,f); put_long(len,f); for(tmp=obj;CONSP(tmp);tmp=CDR(tmp)) fast_print(CAR(tmp),table);} else {putc(FO_listd,f); put_long(len,f); for(tmp=obj;CONSP(tmp);tmp=CDR(tmp)) fast_print(CAR(tmp),table); fast_print(tmp,table);} return(NIL); case tc_flonum: putc(tc_flonum,f); fwrite(&obj->storage_as.flonum.data, sizeof(obj->storage_as.flonum.data), 1, f); return(NIL); case tc_symbol: if (fast_print_table(obj,table)) {putc(tc_symbol,f); len = strlen(PNAME(obj)); if (len >= TKBUFFERN) err("symbol name too long",obj); put_long(len,f); fwrite(PNAME(obj),len,1,f); return(truth);} else return(NIL); default: p = get_user_type_hooks(TYPE(obj)); if (p->fast_print) return((*p->fast_print)(obj,table)); else return(err("cannot fast-print",obj));}} static LISP fast_read(LISP table) {FILE *f; LISP tmp,l; struct user_type_hooks *p; int c; long len; f = get_c_file(car(table),(FILE *) NULL); c = getc(f); if (c == EOF) return(table); switch(c) {case FO_fetch: len = get_long(f); FLONM(bashnum) = len; return(href(car(cdr(table)),bashnum)); case FO_store: len = get_long(f); tmp = fast_read(table); hset(car(cdr(table)),flocons(len),tmp); return(tmp); case tc_nil: return(NIL); case tc_cons: tmp = fast_read(table); return(cons(tmp,fast_read(table))); case FO_list: case FO_listd: len = get_long(f); FLONM(bashnum) = len; l = make_list(bashnum,NIL); tmp = l; while(len > 1) {CAR(tmp) = fast_read(table); tmp = CDR(tmp); --len;} CAR(tmp) = fast_read(table); if (c == FO_listd) CDR(tmp) = fast_read(table); return(l); case tc_flonum: tmp = newcell(tc_flonum); fread(&tmp->storage_as.flonum.data, sizeof(tmp->storage_as.flonum.data), 1, f); return(tmp); case tc_symbol: len = get_long(f); if (len >= TKBUFFERN) err("symbol name too long",NIL); fread(tkbuffer,len,1,f); tkbuffer[len] = 0; return(rintern(tkbuffer)); default: p = get_user_type_hooks(c); if (p->fast_read) return(*p->fast_read)(c,table); else return(err("unknown fast-read opcode",flocons(c)));}} static LISP array_fast_print(LISP ptr,LISP table) {int j,len; FILE *f; f = get_c_file(car(table),(FILE *) NULL); switch (ptr->type) {case tc_string: putc(tc_string,f); len = ptr->storage_as.string.dim; put_long(len,f); fwrite(ptr->storage_as.string.data,len,1,f); return(NIL); case tc_double_array: putc(tc_double_array,f); len = ptr->storage_as.double_array.dim * sizeof(double); put_long(len,f); fwrite(ptr->storage_as.double_array.data,len,1,f); return(NIL); case tc_long_array: putc(tc_long_array,f); len = ptr->storage_as.long_array.dim * sizeof(long); put_long(len,f); fwrite(ptr->storage_as.long_array.data,len,1,f); return(NIL); case tc_lisp_array: putc(tc_lisp_array,f); len = ptr->storage_as.lisp_array.dim; put_long(len,f); for(j=0; j < len; ++j) fast_print(ptr->storage_as.lisp_array.data[j],table); return(NIL); default: return(errswitch());}} static LISP array_fast_read(int code,LISP table) {long j,len,iflag; FILE *f; LISP ptr; f = get_c_file(car(table),(FILE *) NULL); switch (code) {case tc_string: len = get_long(f); ptr = strcons(len,NULL); fread(ptr->storage_as.string.data,len,1,f); ptr->storage_as.string.data[len] = 0; return(ptr); case tc_double_array: len = get_long(f); iflag = no_interrupt(1); ptr = newcell(tc_double_array); ptr->storage_as.double_array.dim = len; ptr->storage_as.double_array.data = (double *) must_malloc(len * sizeof(double)); fread(ptr->storage_as.double_array.data,sizeof(double),len,f); no_interrupt(iflag); return(ptr); case tc_long_array: len = get_long(f); iflag = no_interrupt(1); ptr = newcell(tc_long_array); ptr->storage_as.long_array.dim = len; ptr->storage_as.long_array.data = (long *) must_malloc(len * sizeof(long)); fread(ptr->storage_as.long_array.data,sizeof(long),len,f); no_interrupt(iflag); return(ptr); case tc_lisp_array: len = get_long(f); FLONM(bashnum) = len; ptr = cons_array(bashnum,NIL); for(j=0; j < len; ++j) ptr->storage_as.lisp_array.data[j] = fast_read(table); return(ptr); default: return(errswitch());}} static void init_storage_xtr1(long type) {long j; struct user_type_hooks *p; set_gc_hooks(type, FALSE, array_gc_relocate, array_gc_mark, array_gc_scan, array_gc_free, NULL, &j); set_print_hooks(type,array_prin1, NULL); p = get_user_type_hooks(type); p->fast_print = array_fast_print; p->fast_read = array_fast_read; p->equal = array_equal; p->c_sxhash = array_sxhash;} static void init_storage_xtr(void) {gc_protect(&bashnum); bashnum = newcell(tc_flonum); init_storage_xtr1(tc_string); init_storage_xtr1(tc_double_array); init_storage_xtr1(tc_long_array); init_storage_xtr1(tc_lisp_array);} void init_subrs_xtr(void) { init_storage_xtr(); init_subr_2("aref",aref1, "(aref ARRAY INDEX)\n\ Return ARRAY[INDEX]"); init_subr_3("aset",aset1, "(aset ARRAY INDEX VAL)\n\ Set ARRAY[INDEX] = VAL"); init_subr_2("cons-array",cons_array, "(cons-array DIM KIND)\n\ Construct array of size DIM and type KIND. Where KIND may be one of\n\ double, long, string or lisp."); init_subr_2("sxhash",sxhash, "(sxhash OBJ N)\n\ Return hashing value for OBJ, in range n."); init_subr_2("href",href, "(href TABLE KEY)\n\ Return value in hash table TABLE with KEY."); init_subr_3("hset",hset, "(hset TABLE KEY VALUE)\n\ Set hash table TABLE KEY to VALUE."); init_subr_1("fast-read",fast_read, "(fast-read TABLE)\n\ "); init_subr_2("fast-print",fast_print, "(fast-print P TABLE)\n\ "); init_subr_2("make-list",make_list, "(make-list SIZE VALUE)\n\ Return list of SIZE with each member VALUE."); } speech_tools/siod/slib_repl.cc0000644000076400007640000000420410127000720015066 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * */ /* gjc@paradigm.com or gjc@mitech.com or gjc@world.std.com Paradigm Associates Inc Phone: 617-492-6079 29 Putnam Ave, Suite 6 Cambridge, MA 02138 */ /***************************************************************/ /* This has been modified to act as an interface to siod as an */ /* embedded Lisp module. */ /* Also a (large) number of other functions have been added */ /* */ /* Alan W Black (awb@cstr.ed.ac.uk) 8th April 1996 */ /***************************************************************/ /****************************************************************/ /* */ /* read-eval print loop functions separated from main functions */ /* so LISP functions may be used without requiring full */ /* evaluation to be linked (and termcap) */ #include #include "EST_unix.h" #include #include #include "EST_String.h" #include "EST_cutils.h" #include "siod.h" #include "siodp.h" #include "siodeditline.h" int siod_repl(int interactive) { int retval; LISP histsize; repl_prompt = siod_primary_prompt; /* Set history size (ignored if no command-line editing included) */ histsize = siod_get_lval("editline_histsize",NULL); if (histsize != NIL) editline_histsize = get_c_int(histsize); editline_history_file = walloc(char,strlen(siod_prog_name)+10); sprintf(editline_history_file,".%s_history",siod_prog_name); if (siod_get_lval("editline_no_echo",NULL) != NULL) el_no_echo = 1; siod_interactive = interactive; siod_el_init(); siod_fancy_getc = siod_el_getc; siod_fancy_ungetc = siod_el_ungetc; retval = repl_driver(1,0,NULL); if (interactive) cout << endl; return retval; } speech_tools/siod/siod_fringe.cc0000644000076400007640000002130107262605664015430 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Functions to talk to fringe. */ /* */ /*************************************************************************/ #include "siod.h" #include "EST_FringeServer.h" static bool have_read_table=FALSE; static int tc_fringe_server= -1; // SIOD support for fringe server objects EST_FringeServer *get_c_fringe_server(LISP x) { if (TYPEP(x,tc_fringe_server)) return (EST_FringeServer *)USERVAL(x); else err("wrong type of argument to get_c_fringe_server",x); return NULL; // err doesn't return but compilers don't know that } int siod_fringe_server_p(LISP x) { if (TYPEP(x,tc_fringe_server)) return TRUE; else return FALSE; } LISP siod_make_fringe_server(EST_FringeServer *s) { if (s==0) return NIL; else return siod_make_typed_cell(tc_fringe_server,s); } static void fringe_server_free(LISP lserver) { EST_FringeServer *server = get_c_fringe_server(lserver); delete server; USERVAL(lserver) = NULL; } // Deal with the server table. LISP fringe_read_server_table(LISP args) { if (NULLP(args)) EST_ServiceTable::read_table(); else EST_ServiceTable::read_table(get_c_string(CAR(args))); have_read_table=TRUE; return NIL; } LISP fringe_servers(void) { EST_StrList names; EST_ServiceTable::names(names); if (!have_read_table) fringe_read_server_table(NIL); LISP lnames = NIL; EST_StrList::Entries p; for(p.begin(names); p; ++p) lnames = cons(strcons((*p).length(), *p), lnames); return lnames; } // Creating and connecting to servers. static void fringe_connect(EST_FringeServer *server) { switch (server->connect()) { case connect_ok: break; case connect_not_found_error: EST_sys_error("Can't find host '%s:%d'", (const char *)server->servername(), server->port()); break; case connect_not_allowed_error: EST_sys_error("Can't connect to '%s:%d'", (const char *)server->servername(), server->port()); break; default: EST_sys_error("Error connecting to '%s:%d'", (const char *)server->servername(), server->port()); break; } } LISP fringe_server(LISP lname) { if (CONSP(lname)) lname = CAR(lname); EST_String name=NULLP(lname)?"fringe":get_c_string(lname); if (!have_read_table) fringe_read_server_table(NIL); LISP verbose = siod_get_lval("fringe_verbose", NULL); EST_FringeServer *server = new EST_FringeServer(name, !NULLP(verbose)?&cout:(ostream *)NULL); fringe_connect(server); return siod_make_fringe_server(server); } static EST_FringeServer *get_server(LISP lserver, bool &my_server) { if (siod_fringe_server_p(lserver)) my_server=false; else { my_server=true; lserver = fringe_server(lserver); } return get_c_fringe_server(lserver); } LISP fringe_connect(LISP lserver) { if (!siod_fringe_server_p(lserver)) EST_error("not a fringe server %s", get_c_string(lserver)); EST_FringeServer *server = get_c_fringe_server(lserver); if (server->connected()) fringe_connect(server); return NIL; } LISP fringe_disconnect(LISP lserver) { if (!siod_fringe_server_p(lserver)) EST_error("not a fringe server %s", get_c_string(lserver)); EST_FringeServer *server = get_c_fringe_server(lserver); if (server->connected()) server->disconnect(); return NIL; } LISP fringe_command_string(LISP lserver, LISP lcommand) { EST_String command=get_c_string(lcommand); bool my_server; EST_FringeServer *server = get_server(lserver, my_server); if (!server->connected()) fringe_connect(server); EST_FringeServer::ResultHandler handler; EST_FringeServer::Result &res = handler.res; if (!server->execute(command, handler)) { EST_String err = res.S("ERROR"); if (my_server) delete server; return strcons(err.length(), err); } if (my_server) delete server; return NIL; } LISP fringe_command(LISP lserver, LISP lpackage, LISP loperation, LISP largs) { bool my_server; EST_FringeServer *server = get_server(lserver, my_server); EST_String package = NULLP(lpackage)?"":get_c_string(lpackage); EST_String operation = NULLP(loperation)?"":get_c_string(loperation); EST_FringeServer::Args args; if (!LISTP(largs)) EST_error("Bad argument list"); lisp_to_features(largs, args); EST_FringeServer::ResultHandler handler; EST_FringeServer::Result &res = handler.res; if (!server->connected()) fringe_connect(server); if (!server->execute(package, operation, args, handler)) { EST_String err = res.S("ERROR"); if (my_server) delete server; return strcons(err.length(), err); } if (my_server) delete server; return NIL; } void siod_fringe_init() { long kind; tc_fringe_server = siod_register_user_type("FringeServer"); set_gc_hooks(tc_fringe_server, 0, NULL,NULL,NULL,fringe_server_free,NULL,&kind); init_lsubr("fringe_read_server_table", fringe_read_server_table, "(fringe_read_server_table &opt FILENAME)\n" " Read the users table of fringe servers, or the table\n" " in FILENAME if given."); init_subr_0("fringe_servers", fringe_servers, "(fringe_servers)\n" " Returns a list of the know fringe servers. This doesn't\n" " guarantee that they are still running."); init_lsubr("fringe_server", fringe_server, "(fringe_server &opt NAME)\n" " Return a connection to a fringe server with the given name.\n" " If name is omitted it defaults to \"fringe\"."); init_subr_1("fringe_disconnect", fringe_disconnect, "(fringe_disconnect SERVER)\n" " Close the connection to the server."); init_subr_1("fringe_connect", fringe_connect, "(fringe_connect SERVER)\n" " Re-open the connection to the server."); init_subr_2("fringe_command_string", fringe_command_string, "(fringe_command_string SERVER COMMAND)\n" " Send COMMAND to the fringe server SERVER."); init_subr_4("fringe_command", fringe_command, "(fringe_command SERVER PACKAGE OPERATION ARGS) \n" " Send command to the fringe server SERVER.\n" " ARGS should be an association list of key-value pairs."); } speech_tools/siod/siod_server.cc0000644000076400007640000002221007262605664015464 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Functions to talk to siod. */ /* */ /*************************************************************************/ #include "siod.h" #include "EST_SiodServer.h" static bool have_read_table=FALSE; static int tc_siod_server= -1; // SIOD support for siod server objects EST_SiodServer *get_c_siod_server(LISP x) { if (TYPEP(x,tc_siod_server)) return (EST_SiodServer *)USERVAL(x); else err("wrong type of argument to get_c_siod_server",x); return NULL; // err doesn't return but compilers don't know that } int siod_siod_server_p(LISP x) { if (TYPEP(x,tc_siod_server)) return TRUE; else return FALSE; } LISP siod_make_siod_server(EST_SiodServer *s) { if (s==0) return NIL; else return siod_make_typed_cell(tc_siod_server,s); } static void siod_server_free(LISP lserver) { EST_SiodServer *server = get_c_siod_server(lserver); delete server; USERVAL(lserver) = NULL; } // Deal with the server table. LISP siod_read_server_table(LISP args) { if (NULLP(args)) EST_ServiceTable::read_table(); else EST_ServiceTable::read_table(get_c_string(CAR(args))); have_read_table=TRUE; return NIL; } LISP siod_write_server_table(LISP args) { if (NULLP(args)) EST_ServiceTable::write_table(); else EST_ServiceTable::write_table(get_c_string(CAR(args))); return NIL; } LISP siod_servers(void) { EST_StrList names; EST_ServiceTable::names(names, "siod"); if (!have_read_table) siod_read_server_table(NIL); LISP lnames = NIL; EST_StrList::Entries p; for(p.begin(names); p; ++p) lnames = cons(strcons((*p).length(), *p), lnames); return lnames; } // Creating and connecting to servers. static void siod_connect(EST_SiodServer *server) { switch (server->connect()) { case connect_ok: break; case connect_not_found_error: EST_sys_error("Can't find host '%s:%d'", (const char *)server->servername(), server->port()); break; case connect_not_allowed_error: EST_sys_error("Can't connect to '%s:%d'", (const char *)server->servername(), server->port()); break; default: EST_sys_error("Error connecting to '%s:%d'", (const char *)server->servername(), server->port()); break; } } LISP siod_server(LISP lname) { if (CONSP(lname)) lname = CAR(lname); EST_String name=NULLP(lname)?"siod":get_c_string(lname); if (!have_read_table) siod_read_server_table(NIL); LISP verbose = siod_get_lval("siod_verbose", NULL); EST_SiodServer *server = new EST_SiodServer(name, !NULLP(verbose)?&cout:(ostream *)NULL); siod_connect(server); return siod_make_siod_server(server); } LISP siod_service_loop(LISP lname) { if (CONSP(lname)) lname = CAR(lname); EST_String name=NULLP(lname)?"siod":get_c_string(lname); if (!have_read_table) siod_read_server_table(NIL); LISP verbose = siod_get_lval("siod_verbose", NULL); EST_SiodServer *server = new EST_SiodServer(EST_Server::sm_sequential, name, !NULLP(verbose)?&cout:(ostream *)NULL); return siod_make_siod_server(server); } static EST_SiodServer *get_server(LISP lserver, bool &my_server) { if (siod_siod_server_p(lserver)) my_server=false; else { my_server=true; lserver = siod_server(lserver); } return get_c_siod_server(lserver); } LISP siod_connect(LISP lserver) { if (!siod_siod_server_p(lserver)) EST_error("not a siod server %s", get_c_string(lserver)); EST_SiodServer *server = get_c_siod_server(lserver); if (server->connected()) siod_connect(server); return NIL; } LISP siod_disconnect(LISP lserver) { if (!siod_siod_server_p(lserver)) EST_error("not a siod server %s", get_c_string(lserver)); EST_SiodServer *server = get_c_siod_server(lserver); if (server->connected()) server->disconnect(); return NIL; } LISP siod_server_run(LISP lserver) { if (!siod_siod_server_p(lserver)) EST_error("not a siod server %s", get_c_string(lserver)); EST_SiodServer *server = get_c_siod_server(lserver); EST_SiodServer::RequestHandler handler; siod_write_server_table(NIL); // Never returns server->run(handler); return NIL; } LISP siod_remote_command(LISP lserver, LISP sexp) { bool my_server; EST_SiodServer *server = get_server(lserver, my_server); EST_SiodServer::Args args; args.set_val("sexp", est_val(sexp)); EST_SiodServer::ResultHandler handler; EST_SiodServer::Result &res = handler.res; if (!server->connected()) siod_connect(server); if (!server->execute("scheme", "eval", args, handler)) { EST_String err = res.S("ERROR"); if (my_server) delete server; return strcons(err.length(), err); } if (my_server) delete server; return scheme(handler.res.val("sexp")); } void siod_server_init(void) { long kind; tc_siod_server = siod_register_user_type("SiodServer"); set_gc_hooks(tc_siod_server, 0, NULL,NULL,NULL,siod_server_free,NULL,&kind); init_lsubr("siod_read_server_table", siod_read_server_table, "(siod_read_server_table &opt FILENAME)\n" " Read the users table of siod servers, or the table\n" " in FILENAME if given."); init_lsubr("siod_write_server_table", siod_write_server_table, "(siod_write_server_table &opt FILENAME)\n" " Write the users table of siod servers, or the table\n" " in FILENAME if given."); init_subr_0("siod_servers", siod_servers, "(siod_servers)\n" " Returns a list of the know siod servers. This doesn't\n" " guarantee that they are still running."); init_lsubr("siod_server", siod_server, "(siod_server &opt NAME)\n" " Return a connection to a siod server with the given name.\n" " If name is omitted it defaults to \"siod\"."); init_lsubr("siod_service_loop", siod_service_loop, "(siod_server_loop &opt NAME)\n" " Return an object representing a network siod server main loop.\n" " This service can be started by calling \\[siod_server_run\\].\n" " If name is omitted it defaults to \"siod\"."); init_subr_1("siod_connect", siod_connect, "(siod_connect SERVER)\n" " Re-open the connection to the server."); init_subr_1("siod_disconnect", siod_disconnect, "(siod_disconnect SERVER)\n" " Close the connection to the server."); init_subr_1("siod_server_run", siod_server_run, "(siod_server_run SERVER)\n" " Start the main loop of a siod network server."); init_subr_2("siod_remote_command", siod_remote_command, "(siod_remote_command SERVER COMMAND)\n" " Evaluate COMMAND on the siod server SERVER."); } speech_tools/siod/io.cc0000644000076400007640000002331510127000720013526 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jun 10 1997 */ /************************************************************************/ /* */ /* Functions to open file descriptors for various kinds of data */ /* sources and sinks. */ /* */ /************************************************************************/ #include #include #include #include "EST_unix.h" #include "EST_socket.h" #include #include "EST_String.h" #include "EST_bool.h" #include "siod.h" #include "siodp.h" #include "io.h" EST_Regex RxURL("\\([a-z]+\\)://?\\([^/:]+\\)\\(:\\([0-9]+\\)\\)?\\(.*\\)"); EST_Regex RxFILEURL("file:.*"); static EST_Regex ipnum("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); const int default_http_port = 80; const int default_ftp_port = 21; #define MAX_LINE_LENGTH (256) static int port_to_int(const char *port) { struct servent *serv; if (!port || *port == '\0') return -1; if ((serv=getservbyname(port, "tcp"))) return serv->s_port; return atoi(port); } int parse_url(const EST_String &url, EST_String &protocol, EST_String &host, EST_String &port, EST_String &path) { EST_String bitpath; int start_of_bracket[EST_Regex_max_subexpressions]; int end_of_bracket[EST_Regex_max_subexpressions]; if (url.matches(RxFILEURL,0,start_of_bracket, end_of_bracket)) { protocol = "file"; host = ""; port = ""; path = url.after("file:"); return TRUE; } else if (!url.matches(RxURL, 0, start_of_bracket, end_of_bracket)) return FALSE; protocol = url.at(start_of_bracket[1], end_of_bracket[1]-start_of_bracket[1]); host = url.at(start_of_bracket[2], end_of_bracket[2]-start_of_bracket[2]); port = url.at(start_of_bracket[4], end_of_bracket[4]-start_of_bracket[4]); bitpath = url.at(start_of_bracket[5], end_of_bracket[5]-start_of_bracket[5]); if (protocol == "http") path = protocol + "://" + host + bitpath; else path = bitpath; return TRUE; } static int connect_to_server(const char *host, int port) { struct sockaddr_in address; struct hostent *hostentp; EST_String shost=host; int s; memset(&address, 0, sizeof(address)); if (shost.matches(ipnum)) { address.sin_addr.s_addr = inet_addr(host); address.sin_family = AF_INET; } else if ((hostentp=gethostbyname(host))==NULL) err("can't find host", host); else { memset(&(address.sin_addr),0,sizeof(struct in_addr)); address.sin_family=hostentp->h_addrtype; memmove(&address.sin_addr, (hostentp->h_addr_list)[0], hostentp->h_length); } address.sin_port=htons(port); if ((s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) err("can't create socket", NIL); if (connect(s, (struct sockaddr *)&address, sizeof(address)) < 0) { close(s); err("can't connect to host", inet_ntoa(address.sin_addr)); } return s; } static void server_send(int s, const char *text) { size_t n=strlen(text); ssize_t sent; while (n>0) if ((sent = write(s, text, n))<0) err("error talking to server", NIL); else n -= sent; } static const char *server_get_line(int s) { static char buffer[MAX_LINE_LENGTH+1]; char *p=buffer; ssize_t n; *p='\0'; while(1==1) if ((n=read(s, p, 1)) == 0) break; else if (n < 0) err("error while reading from server", NIL); else if (*(p++) == '\n') break; *p = '\0'; return buffer; } /* * Open stdin or stdout. Should this do a dup? */ int fd_open_stdinout(const char *r_or_w) { int fd = -1; if (r_or_w[0] == 'r') fd = fileno(stdin); else if (r_or_w[0] == 'w') fd = fileno(stdout); else err("mode not understood for -", r_or_w); return fd; } /* * Duplicates the fopen interpretation of the type * parameter plus "rw" being a synonym for "r+" to preserve * some scheme semantics. */ int fd_open_file(const char *name, const char *r_or_w) { int fd; int mode=0; int go_to_end=0; if (strcmp(name, "-")==0) return fd_open_stdinout(r_or_w); if (r_or_w[0] == 'r') if (r_or_w[1] == '+' || r_or_w[1] == 'w') mode = O_RDWR|O_CREAT; else mode = O_RDONLY; else if (r_or_w[0] == 'w') if (r_or_w[1] == '+') mode = O_RDWR|O_CREAT|O_TRUNC; else mode = O_WRONLY|O_CREAT|O_TRUNC; else if (r_or_w[0] == 'a') if (r_or_w[1] == '+') go_to_end = mode = O_RDWR; else go_to_end = mode = O_WRONLY|O_CREAT; else err("mode not understood", r_or_w); /* Should deal with `b' here for binary files. */ fd= open(name, mode, 0666); if (fd >=0 && go_to_end) lseek(fd, 0, SEEK_END); return fd; } int fd_open_http(const char *host, int port, const char *path, const char *r_or_w) { int s; if (port <0) port=default_http_port; if ((s=connect_to_server(host, port)) < 0) return s; if (*r_or_w == 'r') { const char *line; float http_version; int code; char location[1024] = ""; server_send(s, "GET "); server_send(s, path); server_send(s, " HTTP/1.0\n\n"); shutdown(s, 1); line= server_get_line(s); if (sscanf(line, "HTTP/%f %d", &http_version, &code) != 2) { close(s); err("HTTP error", line); } // Skip rest of header. while((line = server_get_line(s))) { if (*line=='\r' || *line == '\n' || *line == '\0') break; else if (sscanf(line, "Location: %s", location) == 1) { cout << "redirect to '" << location << "'\n"; } } if (code == 301 || code == 302) { close(s); if (*location == '\0') err("Redirection to no loction", NIL); EST_String sprotocol, shost, sport, spath; if (!parse_url(location, sprotocol, shost, sport, spath)) err("redirection to bad URL", location); s = fd_open_url(sprotocol, shost, sport, spath, "rb"); } } else if (*r_or_w == 'w') err("Write to HTTP url not yet implemented", NIL); return s; } int fd_open_ftp(const char *host, int port, const char *path, const char *r_or_w) { (void)host; (void)port; (void)path; (void)r_or_w; return -1; } int fd_open_tcp(const char *host, int port, const char *text, const char *r_or_w) { int s; if (port <0) return -1; if ((s=connect_to_server(host, port)) < 0) return s; server_send(s, text); if (*r_or_w == 'r') shutdown(s, 1); else if (*r_or_w == 'w') shutdown(s, 0); return s; } /* * Open a stream to a URL. */ int fd_open_url(const char *protocol, const char *host, const char *port, const char *path, const char *r_or_w) { // special case for local file URLs if (strcmp(protocol, "file") == 0 && (!host || *host == '\0') && (!port || *port == '\0')) return fd_open_file(path, r_or_w); else if (strcmp(protocol, "file") == 0 || strcmp(protocol, "ftp") == 0) return fd_open_ftp(host, port_to_int(port), path, r_or_w); else if (strcmp(protocol, "http") == 0) return fd_open_http(host, port_to_int(port), path, r_or_w); else if (strcmp(protocol, "tcp") == 0) return fd_open_tcp(host, port_to_int(port), path, r_or_w); else return -1; } speech_tools/siod/trace.cc0000644000076400007640000000723110127000720014214 0ustar awbawb/* COPYRIGHT (c) 1992-1994 BY * MITECH CORPORATION, ACTON, MASSACHUSETTS. * See the source file SLIB.C for more information. (trace procedure1 procedure2 ...) (untrace procedure1 procedure2 ...) Currently only user-defined procedures can be traced. Fancy printing features such as indentation based on recursion level will also have to wait for a future version. */ #include #include #include "siod.h" #include "siodp.h" #define tc_closure_traced tc_sys_1 static LISP sym_traced = NIL; static LISP sym_quote = NIL; static LISP sym_begin = NIL; LISP ltrace_fcn_name(LISP body); LISP ltrace_1(LISP fcn_name,LISP env); LISP ltrace(LISP fcn_names,LISP env); LISP luntrace_1(LISP fcn); LISP luntrace(LISP fcns); static void ct_gc_scan(LISP ptr); static LISP ct_gc_mark(LISP ptr); void ct_prin1(LISP ptr,FILE *f); LISP ct_eval(LISP ct,LISP *px,LISP *penv); LISP ltrace_fcn_name(LISP body) {LISP tmp; if NCONSP(body) return(NIL); if NEQ(CAR(body),sym_begin) return(NIL); tmp = CDR(body); if NCONSP(tmp) return(NIL); tmp = CAR(tmp); if NCONSP(tmp) return(NIL); if NEQ(CAR(tmp),sym_quote) return(NIL); tmp = CDR(tmp); if NCONSP(tmp) return(NIL); return(CAR(tmp));} LISP ltrace_1(LISP fcn_name,LISP env) {LISP fcn,code; fcn = leval(fcn_name,env); switch TYPE(fcn) {case tc_closure: code = fcn->storage_as.closure.code; if NULLP(ltrace_fcn_name(cdr(code))) setcdr(code,cons(sym_begin, cons(cons(sym_quote,cons(fcn_name,NIL)), cons(cdr(code),NIL)))); fcn->type = tc_closure_traced; break; case tc_closure_traced: break; default: err("not a closure, cannot trace",fcn);} return(NIL);} LISP ltrace(LISP fcn_names,LISP env) {LISP l; for(l=fcn_names;NNULLP(l);l=cdr(l)) ltrace_1(car(l),env); return(NIL);} LISP luntrace_1(LISP fcn) {switch TYPE(fcn) {case tc_closure: break; case tc_closure_traced: fcn->type = tc_closure; break; default: err("not a closure, cannot untrace",fcn);} return(NIL);} LISP luntrace(LISP fcns) {LISP l; for(l=fcns;NNULLP(l);l=cdr(l)) luntrace_1(car(l)); return(NIL);} static void ct_gc_scan(LISP ptr) {CAR(ptr) = gc_relocate(CAR(ptr)); CDR(ptr) = gc_relocate(CDR(ptr));} static LISP ct_gc_mark(LISP ptr) {gc_mark(ptr->storage_as.closure.code); return(ptr->storage_as.closure.env);} void ct_prin1(LISP ptr,FILE *f) {fput_st(f,"#storage_as.closure.code),f); fput_st(f," "); lprin1f(cdr(ptr->storage_as.closure.code),f); fput_st(f,">");} LISP ct_eval(LISP ct,LISP *px,LISP *penv) {LISP fcn_name,args,env,result,l; fcn_name = ltrace_fcn_name(cdr(ct->storage_as.closure.code)); args = leval_args(CDR(*px),*penv); fput_st(stdout,"->"); lprin1f(fcn_name,stdout); for(l=args;NNULLP(l);l=cdr(l)) {fput_st(stdout," "); lprin1f(car(l),stdout);} fput_st(stdout,"\n"); env = extend_env(args, car(ct->storage_as.closure.code), ct->storage_as.closure.env); result = leval(cdr(ct->storage_as.closure.code),env); fput_st(stdout,"<-"); lprin1f(fcn_name,stdout); fput_st(stdout," "); lprin1f(result,stdout); fput_st(stdout,"\n"); *px = result; return(NIL);} void init_trace(void) {long j; set_gc_hooks(tc_closure_traced, 0, NULL, ct_gc_mark, ct_gc_scan, NULL, NULL, &j); gc_protect_sym(&sym_traced,"*traced*"); setvar(sym_traced,NIL,NIL); gc_protect_sym(&sym_begin,"begin"); gc_protect_sym(&sym_quote,"quote"); set_print_hooks(tc_closure_traced,ct_prin1,NULL); set_eval_hooks(tc_closure_traced,ct_eval); init_fsubr("trace",ltrace, "(trace FUNCS ENV)\n\ Trace FUNCS."); init_lsubr("untrace",luntrace, "(untrace FUNCS)\n\ Untrace FUNCS.");} speech_tools/siod/EST_SiodServer.cc0000644000076400007640000001257607262605664015756 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Simple scheme server. */ /* */ /*************************************************************************/ #include "EST_system.h" #include "EST_unix.h" #include "EST_ServiceTable.h" #include "EST_SiodServer.h" #include "EST_Pathname.h" #include "EST_error.h" #include "EST_Token.h" #include "siod.h" static EST_Regex ipnum("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); EST_SiodServer::ResultHandler::ResultHandler() { } EST_SiodServer::ResultHandler::~ResultHandler() { } void EST_SiodServer::ResultHandler::process(void) { } EST_SiodServer::RequestHandler::RequestHandler() { } EST_SiodServer::RequestHandler::~RequestHandler() { } EST_String EST_SiodServer::RequestHandler::process(void) { volatile LISP sexp = scheme(args.val("sexp")); volatile LISP result = NULL; CATCH_ERRORS() { res.set_val("sexp", est_val(NIL)); return "siod error"; } result = leval(sexp, current_env); END_CATCH_ERRORS(); res.set_val("sexp", est_val(result)); return ""; } EST_SiodServer::EST_SiodServer(EST_String name, ostream *trace) : EST_Server(name, "siod", trace) { } EST_SiodServer::EST_SiodServer(EST_String name) : EST_Server(name, "siod") { } EST_SiodServer::EST_SiodServer(EST_String hostname, int port, ostream *trace) : EST_Server(hostname, port, trace) { } EST_SiodServer::EST_SiodServer(EST_Server::Mode mode, EST_String name) : EST_Server(mode, name, "siod") { } EST_SiodServer::EST_SiodServer(EST_Server::Mode mode, EST_String name, ostream *trace) : EST_Server(mode, name, "siod", trace) { } EST_SiodServer::EST_SiodServer(EST_String hostname, int port) : EST_Server(hostname, port) { } EST_SiodServer::~EST_SiodServer() { } bool EST_SiodServer::parse_command(const EST_String command, EST_String &package, EST_String &operation, EST_SiodServer::Args &arguments) { package="scheme"; operation="eval"; LISP sexp = read_from_string((char *)(const char *)command); arguments.set_val("sexp", est_val(sexp)); return TRUE; } EST_String EST_SiodServer::build_command(const EST_String package, const EST_String operation, const EST_SiodServer::Args &arguments) { (void)operation; if (package == "scheme" && operation == "eval") { LISP sexp = scheme(arguments.val("sexp")); return siod_sprint(sexp); } else return ""; } bool EST_SiodServer::parse_result(const EST_String resultString, EST_Server::Result &res) { LISP sexp = read_from_string((char *)(const char *)resultString); res.set_val("sexp", est_val(sexp)); return TRUE; } EST_String EST_SiodServer::build_result(const EST_Server::Result &res) { LISP sexp = scheme(res.val("sexp")); return siod_sprint(sexp); } speech_tools/siod/siod.cc0000644000076400007640000002561311465017155014100 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1994 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * */ /* gjc@paradigm.com or gjc@mitech.com or gjc@world.std.com Paradigm Associates Inc Phone: 617-492-6079 29 Putnam Ave, Suite 6 Cambridge, MA 02138 */ /***************************************************************/ /* This has been modified to act as an interface to siod as an */ /* embedded Lisp module. */ /* Also a (large) number of other functions have been added */ /* */ /* Alan W Black (awb@cstr.ed.ac.uk) 8th April 1996 */ /***************************************************************/ #include #include "EST_unix.h" #include #include #include "EST_String.h" #include "EST_THash.h" #include "EST_StringTrie.h" #include "EST_cutils.h" #include "EST_strcasecmp.h" #include "siod.h" #include "siodp.h" #include "siodeditline.h" extern "C" const char * repl_prompt; template <> EST_String EST_THash::Dummy_Key = "DUMMY"; template <> EST_Regex *EST_THash::Dummy_Value = NULL; #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash_T(EST_Regex *, hash_string_regex) #endif static EST_TStringHash regexes(100); int siod_init(int heap_size) { /* Initialize siod */ int actual_heap_size; if (heap_size == -1) // unspecified by user { char *char_heap_size=getenv("SIODHEAPSIZE"); if ((char_heap_size == 0) || (atoi(char_heap_size) < 1000)) actual_heap_size=ACTUAL_DEFAULT_HEAP_SIZE; else actual_heap_size=atoi(char_heap_size); } else actual_heap_size = heap_size; init_storage(actual_heap_size); init_subrs(); return 0; } void siod_tidy_up() { close_open_files(); } LISP siod_get_lval(const char *name,const char *message) { // returns value of variable name. If not set gives an error LISP iii, rval=NIL; iii = rintern(name); // value or NIL if unset if (symbol_boundp(iii,current_env) == NIL) { if (message != NULL) err(message,iii); } else rval = symbol_value(iii, current_env); return rval; } LISP siod_set_lval(const char *name,LISP val) { // set variable name to val LISP iii, rval; iii = rintern(name); rval = setvar(iii,val,current_env); return rval; } LISP siod_assoc_str(const char *key,LISP alist) { // assoc without going through LISP atoms // made get_c_string inline for optimization LISP l,lc,lcc; for (l=alist; CONSP(l); l=CDR(l)) { lc = CAR(l); if (CONSP(lc)) { lcc = CAR(lc); if (NULLP(lcc)) continue; else if TYPEP(lcc,tc_symbol) { if (strcmp(key,PNAME(lcc))==0) return lc; } else if TYPEP(lcc,tc_flonum) { if (FLONMPNAME(lcc) == NULL) { char b[TKBUFFERN]; sprintf(b,"%g",FLONM(lcc)); FLONMPNAME(lcc) = (char *)must_malloc(strlen(b)+1); sprintf(FLONMPNAME(lcc),"%s",b); } if (strcmp(key,FLONMPNAME(lcc))==0) return lc; } else if TYPEP(lcc,tc_string) { if (strcmp(key,lcc->storage_as.string.data)==0) return lc; } else continue; } } return NIL; } LISP siod_member_str(const char *key,LISP list) { // member without going through LISP atoms LISP l; for (l=list; CONSP(l); l=CDR(l)) if (strcmp(key,get_c_string(CAR(l))) == 0) return l; return NIL; } LISP siod_regex_member_str(const EST_String &key,LISP list) { // Check the regexs in LIST against key LISP l; for (l=list; CONSP(l); l=CDR(l)) if (key.matches(make_regex(get_c_string(CAR(l))))) return l; return NIL; } LISP siod_member_int(const int key,LISP list) { // member without going through LISP atoms LISP l; for (l=list; CONSP(l); l=CDR(l)) if (key == get_c_int(CAR(l))) return l; return NIL; } int siod_llength(LISP list) { // length of string; int len; LISP l; for (len=0,l=list; CONSP(l); l=CDR(l),len++); return len; } LISP siod_nth(int n,LISP list) { // nth member -- first member is 0; int i; LISP l; for (i=0,l=list; CONSP(l); l=CDR(l),i++) if (i == n) return car(l); return NIL; } int siod_atomic_list(LISP list) { // TRUE is list only contains atoms LISP p; for (p=list; p != NIL; p=cdr(p)) if (CONSP(car(p))) return FALSE; return TRUE; } int siod_eof(LISP item) { // TRUE if item is what siod denotes as eof if (CONSP(item) && (cdr(item) == NIL) && (SYMBOLP(car(item))) && (strcmp("eof",get_c_string(car(item))) == 0)) return TRUE; else return FALSE; } LISP quote(LISP l) { // Add quote round a Lisp expression return cons(rintern("quote"),cons(l,NIL)); } LISP siod_last(LISP list) { LISP l; if ((list == NIL) || (NCONSP(list))) return NIL; else { for (l=list; cdr(l) != NIL; l=cdr(l)); return l; } } int get_param_int(const char *name, LISP params, int defval) { // Look up name in params and return value if present or // defval if not present LISP pair; pair = siod_assoc_str(name,params); if (pair == NIL) return defval; else if FLONUMP(car(cdr(pair))) return (int)FLONM(car(cdr(pair))); else { cerr << "param " << name << " not of type int" << endl; err("",NIL); return -1; } } float get_param_float(const char *name, LISP params, float defval) { // Look up name in params and return value if present or // defval if not present LISP pair; pair = siod_assoc_str(name,params); if (pair == NIL) return defval; else if (FLONUMP(car(cdr(pair)))) return (float)FLONM(car(cdr(pair))); else { cerr << "param " << name << " not of type float" << endl; err("",NIL); return -1; } } const char *get_param_str(const char *name, LISP params, const char *defval) { // Look up name in params and return value if present or // defval if not present LISP pair; pair = siod_assoc_str(name,params); if (pair == NIL) return defval; else return get_c_string(car(cdr(pair))); } LISP get_param_lisp(const char *name, LISP params, LISP defval) { // Look up name in params and return value if present or // defval if not present LISP pair; pair = siod_assoc_str(name,params); if (pair == NIL) return defval; else return car(cdr(pair)); } LISP make_param_str(const char *name,const char *val) { return cons(rintern(name),cons(rintern(val),NIL)); } LISP make_param_int(const char *name, int val) { return cons(rintern(name),cons(flocons(val),NIL)); } LISP make_param_float(const char *name, float val) { return cons(rintern(name),cons(flocons(val),NIL)); } LISP make_param_lisp(const char *name,LISP val) { return cons(rintern(name),cons(val,NIL)); } EST_Regex &make_regex(const char *r) { // Return pointer to existing regex if its already been created // otherwise create a new one for this r. EST_Regex *rx; EST_String sr = r; int found; rx = regexes.val(sr,found); if (!found) { rx = new EST_Regex(r); regexes.add_item(sr,rx); } return *rx; } LISP apply_hooks(LISP hooks,LISP arg) { // Apply each function in hooks to arg returning value from // final application (or arg itself) LISP h,r; r = arg; if (hooks && (!CONSP(hooks))) // singleton r = leval(cons(hooks,cons(quote(arg),NIL)),NIL); else for (h=hooks; h != NIL; h=cdr(h)) r = leval(cons(car(h),cons(quote(arg),NIL)),NIL); return r; } LISP apply_hooks_right(LISP hooks,LISP args) { // The above version neither quotes its arguments properly of deals // with lists of arguments so here's a better one // Apply each function in hooks to arg returning value from // final application (or arg itself) LISP h,r; if (hooks == NIL) r = args; else if (!CONSP(hooks)) // singleton r = apply(hooks,args); else for (r=args,h=hooks; h != NIL; h=cdr(h)) r = apply(car(h),r); return r; } LISP apply(LISP func,LISP args) { LISP qa,a; for (qa=NIL,a=args; a; a=cdr(a)) qa = cons(quote(car(a)),qa); return leval(cons(func,reverse(qa)),NIL); } LISP stringexplode(const char *str) { // Explode character string into list of symbols one for each char LISP l=NIL; unsigned int i; char id[2]; id[1] = '\0'; for (i=0; i < strlen(str); i++) { id[0] = str[i]; l = cons(rintern(id),l); } return reverse(l); } /* Editline completion functions */ char **siod_variable_generator(char *text,int length) { LISP l,lmatches; const char *name; char **matches = NULL; int i; /* Return the next name which partially matches from the command list. */ for(lmatches=NIL,l=oblistvar;CONSP(l);l=CDR(l)) { if (VCELL(car(l)) == NIL) continue; switch(TYPE(VCELL(CAR(l)))) { case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: case tc_closure: continue; default: /* only return names of nonfunctions (sometimes too restrictive) */ name = PNAME(CAR(l)); if (strncmp(name, text, length) == 0) lmatches = cons(CAR(l),lmatches); } } /* Need to return the matches in a char** */ matches = walloc(char *,siod_llength(lmatches)+1); for (l=lmatches,i=0; l; l=cdr(l),i++) matches[i] = wstrdup(PNAME(car(l))); matches[i] = '\0'; return matches; } char **siod_command_generator (char *text,int length) { LISP l,lmatches; const char *name; char **matches = NULL; int i; /* Return the next name which partially matches from the command list. */ for(lmatches=NIL,l=oblistvar;CONSP(l);l=CDR(l)) { if (VCELL(car(l)) == NIL) continue; switch(TYPE(VCELL(CAR(l)))) { case tc_subr_0: case tc_subr_1: case tc_subr_2: case tc_subr_3: case tc_subr_4: case tc_lsubr: case tc_fsubr: case tc_msubr: case tc_closure: /* only return names of functions */ name = PNAME(CAR(l)); if (strncmp(name, text, length) == 0) lmatches = cons(CAR(l),lmatches); default: continue; } } /* Need to return the matches in a char** */ matches = walloc(char *,siod_llength(lmatches)+1); for (l=lmatches,i=0; l; l=cdr(l),i++) matches[i] = wstrdup(PNAME(car(l))); matches[i] = '\0'; return matches; } void siod_list_to_strlist(LISP l, EST_StrList &a) { // copy l into a LISP b; a.clear(); for (b=l; b != NIL; b=cdr(b)) a.append(get_c_string(car(b))); } LISP siod_strlist_to_list(EST_StrList &a) { // copy a into l LISP b=NIL;; EST_Litem *p; for (p=a.head(); p != 0; p=p->next()) b = cons(rintern(a(p)),b); return reverse(b); } speech_tools/siod/siod_est.cc0000644000076400007640000003147610320310243014736 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996-1998 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : February 1998 */ /*-----------------------------------------------------------------------*/ /* */ /* Functions to add Speech Tools basic objects to the SIOD LISP obj */ /* */ /* This offers non-intrusive support for arbitrary objects in LISP, */ /* however because the deletion method are called this needs to access */ /* Thus if you include siod_est_init(), you'll get Utterances, Nodes */ /* Stream_Items, Waves and Tracks in your binary */ /* */ /*=======================================================================*/ #include #include "siod.h" #include "ling_class/EST_Utterance.h" #include "ling_class/EST_Item.h" #include "EST_THash.h" #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_Track.h" #include "EST_track_aux.h" Declare_TStringHash_Base(LISP,(LISP)0,NIL) #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_THash.cc" Instantiate_TStringHash(LISP) #endif // To make garbage collection easy the following functions offer an index // of arbitrary objects to LISP cells. You can use this to return the // same LISP cell for the same object. This is used for utterance // objects otherwise I'd need to add reference counts to the utterance // itself // // This is implemented as a hash table of printed address // This if fine for hundreds of things, but probably not // for thousands of things static EST_TStringHash estobjs(100); static void void_to_addrname(const void *v,EST_String &saddr) { char addr[128]; sprintf(addr,"%p",v); saddr = addr; } // The following are the types for EST objects in LISP, they are set when // the objects are registered. I don't think they should be required // out side this file so they are static functions like siod_utterance_p // should be used elsewhere static int tc_utt = -1; static int tc_val = -1; class EST_Utterance *utterance(LISP x) { if (TYPEP(x,tc_utt)) return (class EST_Utterance *)USERVAL(x); else err("wrong type of argument to get_c_utt",x); return NULL; // err doesn't return but compilers don't know that } int utterance_p(LISP x) { if (TYPEP(x,tc_utt)) return TRUE; else return FALSE; } LISP siod(const class EST_Utterance *u) { LISP utt; EST_String saddr; LISP cell; void_to_addrname(u,saddr); if ((cell = estobjs.val(saddr)) != NIL) return cell; // A new one utt = siod_make_typed_cell(tc_utt,(void *)u); // Add to list estobjs.add_item(saddr,utt); return utt; } static void utt_free(LISP lutt) { class EST_Utterance *u = utterance(lutt); EST_String saddr; void_to_addrname(u,saddr); // Mark it unused, this doesn't gc the extra data in the hash // table to hold the index, this might be a problem over very // long runs of the system (i.e. this should be fixed). estobjs.remove_item(saddr); delete u; USERVAL(lutt) = NULL; } LISP utt_mark(LISP utt) { // Should mark all the LISP cells in it // but at present we use the gc_(un)protect mechanism return utt; } // EST_Vals (and everything else) class EST_Val &val(LISP x) { if (TYPEP(x,tc_val)) return *((class EST_Val *)x->storage_as.val.v); else err("wrong type of argument to get_c_val",x); // sigh static EST_Val def; return def; } LISP val_equal(LISP a,LISP b) { if (val(a) == val(b)) return truth; else return NIL; } int val_p(LISP x) { if (TYPEP(x,tc_val)) return TRUE; else return FALSE; } LISP siod(const class EST_Val v) { return siod_make_typed_cell(tc_val,new EST_Val(v)); } static void val_free(LISP val) { class EST_Val *v = (EST_Val *)USERVAL(val); delete v; USERVAL(val) = NULL; } static void val_prin1(LISP v, FILE *fd) { char b[1024]; fput_st(fd,"#<"); fput_st(fd,val(v).type()); sprintf(b," %p",val(v).internal_ptr()); fput_st(fd,b); fput_st(fd,">"); } static void val_print_string(LISP v, char *tkbuffer) { sprintf(tkbuffer,"#<%s %p>",val(v).type(),val(v).internal_ptr()); } SIOD_REGISTER_CLASS(item,EST_Item) SIOD_REGISTER_CLASS(wave,EST_Wave) SIOD_REGISTER_CLASS(track,EST_Track) SIOD_REGISTER_CLASS(feats,EST_Features) // This is an example of something that's a little scary and it // would be better if we didn't have to do this. Here we define // support for LISP's as VAL, even though we've got VAL's a LISPs // This allows arbitrary LISP objects to be held as VALs most // likely as values in features or being returned by feature functions // We have to do some special memory management to do this and // you can probably mess things up completely if you start using this // arbitrarily val_type val_type_scheme = "scheme"; struct obj_val {LISP l;}; LISP scheme(const EST_Val &v) { if (v.type() == val_type_scheme) return ((obj_val *)v.internal_ptr())->l; else EST_error("val not of type val_type_scheme"); return NULL; } static void val_delete_scheme(void *v) { struct obj_val *ov = (struct obj_val *)v; gc_unprotect(&ov->l); wfree(ov); } EST_Val est_val(const obj *v) { struct obj_val *ov = walloc(struct obj_val,1); ov->l = (LISP)(void *)v; gc_protect(&ov->l); return EST_Val(val_type_scheme, (void *)ov, val_delete_scheme); } LISP lisp_val(const EST_Val &pv) { if (pv.type() == val_unset) { cerr << "EST_Val unset, can't build lisp value" << endl; siod_error(); return NIL; } else if (pv.type() == val_int) return flocons(pv.Int()); else if (pv.type() == val_float) return flocons(pv.Float()); else if (pv.type() == val_string) return strintern(pv.string_only()); else if (pv.type() == val_type_scheme) return scheme(pv); else if (pv.type() == val_type_feats) return features_to_lisp(*feats(pv)); else return siod(pv); } static int feature_like(LISP v) { // True if non nil and assoc like if ((v == NIL) || (!consp(v))) return FALSE; else { LISP p; for (p=v; p != NIL; p=cdr(p)) { if (!consp(p) || (!consp(car(p))) || (consp(car(car(p))))) return FALSE; } return TRUE; } } EST_Val val_lisp(LISP v) { if (feature_like(v)) { EST_Features *f = new EST_Features; lisp_to_features(v,*f); return est_val(f); } else if (FLONUMP(v)) return EST_Val(get_c_float(v)); else if (TYPEP(v,tc_val)) return val(v); else if (TYPEP(v,tc_symbol) || (TYPEP(v,tc_string))) return EST_Val(EST_String(get_c_string(v))); else return est_val(v); } LISP kvlss_to_lisp(const EST_TKVL &kvl) { LISP l = NIL; EST_TKVL::Entries p; for(p.begin(kvl); p; ++p) { l=cons(cons(rintern(p->k), cons(lisp_val(p->v),NIL)), l); } // reverse it to make it the same order as f, though that shouldn't matter return reverse(l); } void lisp_to_kvlss(LISP l, EST_TKVL &kvl) { LISP p; for (p=l; p; p = cdr(p)) kvl.add_item(get_c_string(car(car(p))), get_c_string(car(cdr(car(p))))); } LISP features_to_lisp(EST_Features &f) { LISP lf = NIL; EST_Features::Entries p; for(p.begin(f); p; ++p) { lf=cons(cons(rintern(p->k), cons(lisp_val(p->v),NIL)), lf); } // reverse it to make it the same order as f, though that shouldn't matter return reverse(lf); } void lisp_to_features(LISP lf,EST_Features &f) { LISP p; for (p=lf; p; p = cdr(p)) f.set_val(get_c_string(car(car(p))), val_lisp(car(cdr(car(p))))); } static LISP feats_set(LISP lfeats, LISP fname, LISP val) { // Probably should restrict what can be in fname, not : would be good LISP lf = lfeats; if (lfeats == NIL) { EST_Features *f = new EST_Features; lf = siod(f); } feats(lf)->set_path(get_c_string(fname),val_lisp(val)); return lf; } static LISP feats_get(LISP f, LISP fname) { return lisp_val(feats(f)->val_path(get_c_string(fname))); } static LISP feats_make() { EST_Features *f = new EST_Features; return siod(f); } static LISP feats_tolisp(LISP lf) { return features_to_lisp(*feats(lf)); } static LISP feats_remove(LISP lf, LISP fname) { EST_Features *f = feats(lf); f->remove(get_c_string(fname)); return lf; } static LISP feats_present(LISP lf, LISP fname) { EST_Features *f = feats(lf); if (f->present(get_c_string(fname))) return truth; else return NIL; } EST_Features &Param() { EST_Features *f = feats(siod_get_lval("Param","No Param features set")); return *f; } void siod_est_init() { // add EST specific objects as user types to LISP obj long kind; // In general to add a type // tc_TYPENAME = siod_register_user_type("TYPENAME"); // define above // EST_TYPENAME *get_c_TYPENAME(LISP x) and // int siod_TYPENAME_p(LISP x) // LISP siod_make_utt(EST_TYPENAME *x) // you will often also need to define // TYPENAME_free(LISP x) too if you want the contents gc'd // other options to the set_*_hooks functions allow you to customize // the object's behaviour more tc_utt = siod_register_user_type("Utterance"); set_gc_hooks(tc_utt, 0, NULL,utt_mark,NULL,utt_free,NULL,&kind); tc_val = siod_register_user_type("Val"); set_gc_hooks(tc_val, 0, NULL,NULL,NULL,val_free,NULL,&kind); set_print_hooks(tc_val,val_prin1,val_print_string); set_type_hooks(tc_val,NULL,val_equal); init_subr_2("feats.get",feats_get, "(feats.get FEATS FEATNAME)\n\ Return value of FEATNAME (which may be a simple feature name or a\n\ pathname) in FEATS. If FEATS is nil a new feature set is created"); init_subr_3("feats.set",feats_set, "(feats.set FEATS FEATNAME VALUE)\n\ Set FEATNAME to VALUE in FEATS."); init_subr_2("feats.remove",feats_remove, "(feats.remove FEATS FEATNAME)\n\ Remove feature names FEATNAME from FEATS."); init_subr_2("feats.present",feats_present, "(feats.present FEATS FEATNAME)\n\ Return t is FEATNAME is present in FEATS, nil otherwise."); init_subr_0("feats.make",feats_make, "(feats.make)\n\ Return an new empty features object."); init_subr_1("feats.tolisp",feats_tolisp, "(feats.tolisp FEATS)\n\ Gives a lisp representation of the features, this is a debug function\n\ and may or may not exist tomorrow."); } speech_tools/siod/siodeditline.c0000644000076400007640000002154610044502523015442 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1998 */ /*-----------------------------------------------------------------------*/ /* */ /* Due to incompatibility between the GPL for readline and Festival's */ /* current licence readline support was removed after 1.3.0 */ /* This uses a much simpler but much poorer command line editor called */ /* editline instead. */ /* */ /* Although this code is included in our distribution we still offer */ /* optional compilation as it may not work on all platforms */ /* */ /*=======================================================================*/ #include #include #include "EST_unix.h" #include #include "EST_cutils.h" #include "siodeditline.h" FILE *stddebug = NULL; extern int el_pos; extern char *repl_prompt; #ifndef SUPPORT_EDITLINE /* If for some reason you don't want editline the following */ /* functions are provided. They are functional but minimal. They are */ /* suitable when you are in an embedded environment and don't need */ /* command lin editing */ int el_no_echo; int editline_histsize; int siod_el_getc(FILE *f) { int c; if (el_pos == -1) { fprintf(stdout,"%s",repl_prompt); fflush(stdout); el_pos = 0; } c = getc(f); if (c == '\n') el_pos = -1; return c; } void siod_el_ungetc(int c, FILE *f) { ungetc(c,f); } void siod_el_init(void) { return; } #else #include "editline.h" static int possible_commandp(char *text, int start, int end); static int possible_variablep(char *text, int start, int end); static char **command_completion (char *text,int start,int end); static char *el_line = NULL; char *editline_history_file = ".editline_history"; static char *full_history_file = ".editline_history"; static STATUS siod_display_doc () { /* Find the current symbol and check for a documentation string */ char *symbol; const char *docstring; int i; symbol = el_current_sym(); putc('\n',stderr); docstring = siod_docstring(symbol); for (i=0; docstring[i] != '\0'; i++) putc(docstring[i],stderr); putc('\n',stderr); fflush(stderr); wfree(symbol); el_redisplay(); return CSmove; } static STATUS siod_say_doc () { /* Find the current symbol and check for a documentation string */ /* Now this is what you call wasting your time. Here we get the */ /* synthesizer to say the documentation string */ char *symbol; symbol = el_current_sym(); fprintf(stderr,"\nsynthesizing doc string ..."); fflush(stderr); siod_saydocstring(symbol); putc('\n',stderr); fflush(stderr); wfree(symbol); el_redisplay(); return CSmove; } static STATUS siod_manual() { /* Find the current symbol and check for a documentation string */ /* Look for a "see " reference in its documentation string, if so */ /* access that section of the manual by sending a call to netscape */ char *symbol; const char *infostring; symbol = el_current_sym(); infostring = siod_manual_sym(symbol); putc('\n',stderr); fprintf(stderr,infostring); fflush(stderr); putc('\n',stderr); fflush(stderr); el_redisplay(); wfree(symbol); return CSmove; } void siod_el_init(void) { /* Various initialization completion, history etc */ char *home; home = getenv("HOME"); if (home==NULL) home=""; full_history_file = walloc(char,strlen(home)+strlen(editline_history_file)+2); sprintf(full_history_file,"%s/%s",home,editline_history_file); read_history(full_history_file); el_user_intr = TRUE; /* we want SIGINT to raise a signal */ el_user_completion_function = command_completion; el_bind_key_in_metamap('h',siod_display_doc); el_bind_key_in_metamap('s',siod_say_doc); el_bind_key_in_metamap('m',siod_manual); } int siod_el_getc(FILE *f) { int c; if (el_pos == -1) { el_line=readline(repl_prompt); if (el_line != NULL) { add_history(el_line); write_history(full_history_file); } el_pos = 0; } if ((el_line==NULL) || (strlen(el_line) <= el_pos)) el_pos = -1; if (el_line==NULL) c = EOF; else if (el_pos == -1) c = '\n'; /* whitespace representing end of line */ else { c = el_line[el_pos]; el_pos++; } return c; } void siod_el_ungetc(int c, FILE *f) { if (el_pos > 0) el_pos--; else { fprintf(stderr,"fix ungetc when nothing is there"); } } static int qsort_str_compare(const void *p1,const void *p2) { const char *s1; const char *s2; s1 = *(const char **)p1; s2 = *(const char **)p2; return strcmp(s1,s2); } static char **command_completion (char *text,int start,int end) { char **matches = NULL; int i; /* If preceding non-alphanum character is a left paren, */ /* look for a command else look for any variable */ if (possible_commandp(text,start,end)) matches = siod_command_generator(text+start,end-start); else if (possible_variablep(text,start,end)) matches = siod_variable_generator(text+start,end-start); if (matches && matches[0] && matches[1]) { /* If there are at least two, Sort them */ for (i=0; matches[i] != NULL; i++); qsort(matches,i,sizeof(char **),qsort_str_compare); } return matches; } static int possible_commandp(char *text, int start, int end) { /* If non-white space previous to this is a left paren */ /* signal we are looking for a function name */ int t; for (t=start-1; t >= 0; t--) if (strchr(" \t\n\r",text[t]) != NULL) continue; else if (text[t] == '(') return TRUE; else return FALSE; return FALSE; } static int possible_variablep(char *text, int start, int end) { /* Almost negative of above but if previous symbol is a quote */ /* let the file completion stuff do it */ int t; for (t=start-1; t >= 0; t--) if (strchr(" \t\n",text[t]) != NULL) continue; else if (text[t] == '(') return FALSE; else if ((text[t] == '"') && (t == start-1)) return FALSE; else return TRUE; return TRUE; } #endif /* SUPPORT_EDITLINE */ speech_tools/siod/el_complete.c0000644000076400007640000001666111061232430015255 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* This version editline does not have the the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /****************************************************************************/ /* $Revision: 1.3 $ ** ** History and file completion functions for editline library. */ #include "editline.h" #if defined(NEED_STRDUP) /* ** Return an allocated copy of a string. */ char * strdup(char *p) { char *new; if ((new = NEW(char, strlen(p) + 1)) != NULL) (void)strcpy(new, p); return new; } #endif /* defined(NEED_STRDUP) */ /* ** strcmp-like sorting predicate for qsort. */ STATIC int compare(CONST void *p1,CONST void *p2) { CONST char **v1; CONST char **v2; v1 = (CONST char **)p1; v2 = (CONST char **)p2; return strcmp(*v1, *v2); } /* ** Fill in *avp with an array of names that match file, up to its length. ** Ignore . and .. . */ STATIC int FindMatches(char *dir,char *file,char ***avp) { #if !defined(SYSTEM_IS_WIN32) char **av; char **neww; char *p; DIR *dp; DIRENTRY *ep; ESIZE_T ac; ESIZE_T len; if ((dp = opendir(dir)) == NULL) return 0; av = NULL; ac = 0; len = strlen(file); while ((ep = readdir(dp)) != NULL) { p = ep->d_name; if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0'))) continue; if (len && strncmp(p, file, len) != 0) continue; if ((ac % MEM_INC) == 0) { if ((neww = NEW(char*, ac + MEM_INC)) == NULL) break; if (ac) { COPYFROMTO(neww, av, ac * sizeof (char **)); DISPOSE(av); } *avp = av = neww; } if ((av[ac] = STRDUP(p)) == NULL) { if (ac == 0) DISPOSE(av); break; } ac++; } /* Clean up and return. */ (void)closedir(dp); if (ac) qsort(av, ac, sizeof (char **), compare); return ac; #else *avp=NULL; return 0; #endif } /* ** Split a pathname into allocated directory and trailing filename parts. */ STATIC int SplitPath(char *path,char **dirpart,char **filepart) { static char DOT[] = "."; char *dpart; char *fpart; if ((fpart = strrchr(path, '/')) == NULL) { if ((dpart = STRDUP(DOT)) == NULL) return -1; if ((fpart = STRDUP(path)) == NULL) { DISPOSE(dpart); return -1; } } else { if ((dpart = STRDUP(path)) == NULL) return -1; dpart[fpart - path] = '\0'; if ((fpart = STRDUP(++fpart)) == NULL) { DISPOSE(dpart); return -1; } if (dpart[0] == '\0') /* special case for root */ { dpart[0] = '/'; dpart[1] = '\0'; } } *dirpart = dpart; *filepart = fpart; return 0; } /* ** Attempt to complete the pathname, returning an allocated copy. ** Fill in *unique if we completed it, or set it to 0 if ambiguous. */ char *rl_complete(char *pathname,int *unique) { char **av; char *dir; char *file; char *neww; char *p; ESIZE_T ac; ESIZE_T end; ESIZE_T i; ESIZE_T j; ESIZE_T len; if (SplitPath(pathname, &dir, &file) < 0) return NULL; if ((ac = FindMatches(dir, file, &av)) == 0) { DISPOSE(dir); DISPOSE(file); return NULL; } p = NULL; len = strlen(file); if (ac == 1) { /* Exactly one match -- finish it off. */ *unique = 1; j = strlen(av[0]) - len + 2; if ((p = NEW(char, j + 1)) != NULL) { COPYFROMTO(p, av[0] + len, j); if ((neww = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) { (void)strcpy(neww, dir); (void)strcat(neww, "/"); (void)strcat(neww, av[0]); rl_add_slash(neww, p); DISPOSE(neww); } } } else { *unique = 0; if (len) { /* Find largest matching substring. */ for (i = len, end = strlen(av[0]); i < end; i++) for (j = 1; j < ac; j++) if (av[0][i] != av[j][i]) goto breakout; breakout: if (i > len) { j = i - len + 1; if ((p = NEW(char, j)) != NULL) { COPYFROMTO(p, av[0] + len, j); p[j - 1] = '\0'; } } } } /* Clean up and return. */ DISPOSE(dir); DISPOSE(file); for (i = 0; i < ac; i++) DISPOSE(av[i]); DISPOSE(av); return p; } /* ** Return all possible completions. */ int rl_list_possib(char *pathname,char ***avp) { char *dir; char *file, *path, *tt; int ac,i; if (SplitPath(pathname, &dir, &file) < 0) return 0; ac = FindMatches(dir, file, avp); /* Identify directories with trailing / */ for (i = 0; i < ac; i++) { path = walloc(char,strlen(dir)+strlen((*avp)[i])+3); sprintf(path,"%s/%s",dir,(*avp)[i]); if (el_is_directory(path)) { tt = walloc(char,strlen((*avp)[i])+2); sprintf(tt,"%s/",(*avp)[i]); wfree((*avp)[i]); (*avp)[i] = tt; } wfree(path); } DISPOSE(dir); DISPOSE(file); return ac; } speech_tools/siod/editline.c0000644000076400007640000012331110717334425014567 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular, though these changes */ /* have a much more general use that just us. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* this version of editline does not have the the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /* Specific additions (there are other smaller ones too, all marked): */ /* some ansificiation and prototypes added */ /* storage and retrieval of history over sessions */ /* user definable history completion */ /* possibles listing in completion */ /* reverse incremental search */ /* lines longer than window width (mostly) */ /* reasonable support for 8 bit chars in languages other than English */ /* */ /****************************************************************************/ /* $Revision: 1.5 $ ** ** Main editing routines for editline library. */ #include "editline.h" #include "EST_unix.h" #include /* ** Manifest constants. */ #define SCREEN_WIDTH 80 #define SCREEN_ROWS 24 #define NO_ARG (-1) #define DEL 127 #define ESC 0x1b #define CTL(x) (char)((x) & 0x1F) #define ISCTL(x) ((x) && (x) < ' ') #define UNCTL(x) (char)((x) + 64) #define META(x) (char)((x) | 0x80) #define ISMETA(x) ((x) & 0x80) #define UNMETA(x) (char)((x) & 0x7F) /* modified by awb to allow specifcation of history size at run time */ /* (though only once) */ int editline_histsize=256; char *editline_history_file; /* If this is defined it'll be called for completion first, before the */ /* internal file name completion will be */ EL_USER_COMPLETION_FUNCTION_TYPE*el_user_completion_function = NULL; /* ** The type of case-changing to perform. */ typedef enum _CASE { TOupper, TOlower, TOcapitalize } CASE; /* ** Key to command mapping. */ typedef struct _KEYMAP { ECHAR Key; STATUS (*Function)(); } KEYMAP; /* ** Command history structure. */ typedef struct _HISTORY { int Size; int Pos; ECHAR **Lines; } HISTORY; /* ** Globals. */ int rl_eof; int rl_erase; int rl_intr; int rl_kill; ECHAR el_NIL[] = ""; extern CONST ECHAR *el_Input; STATIC ECHAR *Line = NULL; STATIC CONST char *Prompt = NULL; STATIC ECHAR *Yanked = NULL; STATIC char *Screen = NULL; /* STATIC char NEWLINE[]= CRLF; */ STATIC HISTORY H; int rl_quit; STATIC int Repeat; STATIC int End; STATIC int Mark; STATIC int OldPoint; STATIC int Point; extern int el_PushBack; extern int el_Pushed; FORWARD KEYMAP Map[33]; FORWARD KEYMAP MetaMap[64]; STATIC ESIZE_T Length; STATIC ESIZE_T ScreenCount; STATIC ESIZE_T ScreenSize; STATIC ECHAR *backspace = NULL; STATIC ECHAR *upline = NULL; STATIC ECHAR *clrpage = NULL; STATIC ECHAR *downline = NULL; STATIC ECHAR *move_right = NULL; STATIC ECHAR *newline = NULL; STATIC ECHAR *bol = NULL; STATIC ECHAR *nextline = NULL; STATIC int TTYwidth; STATIC int TTYrows; STATIC int RequireNLforWrap = 1; STATIC int el_intr_pending = 0; int el_no_echo = 0; /* e.g under emacs */ /* A little ansification with prototypes -- awb */ extern void TTYflush(); STATIC void TTYput(ECHAR c); STATIC void TTYputs(ECHAR *p); STATIC void TTYshow(ECHAR c); STATIC void TTYstring(ECHAR *p); extern unsigned int TTYget(); STATIC void TTYinfo(); STATIC void print_columns(int ac, char **av); STATIC void reposition(int reset); STATIC void left(STATUS Change); STATIC void right(STATUS Change); STATIC STATUS ring_bell(); #if 0 STATIC STATUS do_macro(unsigned int c); #endif STATIC STATUS do_forward(STATUS move); STATIC STATUS do_case(ECHAR type); STATIC STATUS case_down_word(); STATIC STATUS case_up_word(); STATIC void ceol(); STATIC void clear_line(); STATIC STATUS insert_string(ECHAR *p); STATIC ECHAR *next_hist(); STATIC ECHAR *prev_hist(); STATIC STATUS do_insert_hist(ECHAR *p); STATIC STATUS do_hist(ECHAR *(*move)()); STATIC STATUS h_next(); STATIC STATUS h_prev(); STATIC STATUS h_first(); STATIC STATUS h_last(); STATIC int substrcmp(char *text, char *pat, int len); STATIC ECHAR *search_hist(ECHAR *search, ECHAR *(*move)()); STATIC STATUS h_search(); STATIC STATUS fd_char(); STATIC void save_yank(int begin, int i); STATIC STATUS delete_string(int count); STATIC STATUS bk_char(); STATIC STATUS bk_del_char(); STATIC STATUS redisplay(); STATIC STATUS kill_line(); STATIC char *rsearch_hist(char *patt, int *lpos,int *cpos); STATIC STATUS h_risearch(); STATIC STATUS insert_char(int c); STATIC STATUS meta(); STATIC STATUS emacs(unsigned int c); STATIC STATUS TTYspecial(unsigned int c); STATIC ECHAR *editinput(); STATIC void hist_add(ECHAR *p); STATIC STATUS beg_line(); STATIC STATUS del_char(); STATIC STATUS end_line(); STATIC ECHAR *find_word(); STATIC STATUS c_complete(); STATIC STATUS c_possible(); STATIC STATUS accept_line(); STATIC STATUS transpose(); STATIC STATUS quote(); STATIC STATUS wipe(); STATIC STATUS mk_set(); STATIC STATUS exchange(); STATIC STATUS yank(); STATIC STATUS copy_region(); STATIC STATUS move_to_char(); STATIC STATUS fd_word(); STATIC STATUS fd_kill_word(); STATIC STATUS bk_word(); STATIC STATUS bk_kill_word(); STATIC int argify(ECHAR *line, ECHAR ***avp); STATIC STATUS last_argument(); /* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */ int rl_meta_chars = 0; /* ** Declarations. */ STATIC ECHAR *editinput(); #if defined(USE_TERMCAP) extern char *getenv(); extern char *tgetstr(); extern int tgetent(); extern int tgetnum(); #endif /* defined(USE_TERMCAP) */ /* ** TTY input/output functions. */ void TTYflush() { if (ScreenCount) { if (el_no_echo == 0) (void)write(1, Screen, ScreenCount); ScreenCount = 0; } } STATIC void TTYput(ECHAR c) { Screen[ScreenCount] = c; if (++ScreenCount >= ScreenSize - 1) { ScreenSize += SCREEN_INC; RENEW(Screen, char, ScreenSize); } } STATIC void TTYputs(ECHAR *p) { while (*p) TTYput(*p++); } STATIC void TTYshow(ECHAR c) { if (c == DEL) { TTYput('^'); TTYput('?'); } else if (ISCTL(c)) { TTYput('^'); TTYput(UNCTL(c)); } else if (rl_meta_chars && ISMETA(c)) { TTYput('M'); TTYput('-'); TTYput(UNMETA(c)); } else TTYput(c); } STATIC void TTYstring(ECHAR *p) { while (*p) TTYshow(*p++); } #if 0 /* Old one line version */ #define TTYback() (backspace ? TTYputs((ECHAR *)backspace) : TTYput('\b')) #endif STATIC int printlen(CONST char *p) { int len = 0; for (len=0; *p; p++) if ((*p == DEL) || (ISCTL(*p))) len += 2; else if (rl_meta_chars && ISMETA(*p)) len += 3; else len += 1; return len; } STATIC int screen_pos() { /* Returns the number of characters printed from beginning of line */ /* includes the size of the prompt and and meta/ctl char expansions */ int p = strlen(Prompt); int i; for (i=0; i < Point; i++) if ((Line[i] == DEL) || (ISCTL(Line[i]))) p += 2; else if (rl_meta_chars && ISMETA(Line[i])) p += 3; else p += 1; return p; } STATIC void TTYback() { /* awb: added upline (if supported) when back goes over line boundary */ int i; int sp = screen_pos(); if (upline && sp && (sp%TTYwidth == 0)) { /* move up a line and move to the end */ TTYputs(upline); TTYputs(bol); for (i=0; i < TTYwidth; i++) TTYputs(move_right); } else if (backspace) TTYputs((ECHAR *)backspace); else TTYput('\b'); } STATIC void TTYinfo() { static int init; #if defined(USE_TERMCAP) char *term; char *buff; char *buff2; char *bp; #endif /* defined(USE_TERMCAP) */ #if defined(TIOCGWINSZ) struct winsize W; #endif /* defined(TIOCGWINSZ) */ if (init) { #if defined(TIOCGWINSZ) /* Perhaps we got resized. */ if (ioctl(0, TIOCGWINSZ, &W) >= 0 && W.ws_col > 0 && W.ws_row > 0) { TTYwidth = (int)W.ws_col; TTYrows = (int)W.ws_row; } #endif /* defined(TIOCGWINSZ) */ return; } init++; TTYwidth = TTYrows = 0; #if defined(USE_TERMCAP) buff = walloc(char,2048); buff2 = walloc(char,2048); bp = &buff2[0]; if ((term = getenv("TERM")) == NULL) term = "dumb"; if (tgetent(buff, term) < 0) { TTYwidth = SCREEN_WIDTH; TTYrows = SCREEN_ROWS; return; } backspace = (ECHAR *)tgetstr("le", &bp); upline = (ECHAR *)tgetstr("up", &bp); clrpage = (ECHAR *)tgetstr("cl", &bp); nextline = (ECHAR *)tgetstr("nl", &bp); if (nextline==NULL) nextline = (ECHAR *)"\n"; if (strncmp(term, "pcansi", 6)==0 || strncmp(term, "cygwin", 6)==0) { bol = (ECHAR *)"\033[0G"; RequireNLforWrap = 0; /* doesn't require nl to get to next line */ } else bol = (ECHAR *)tgetstr("cr", &bp); if (bol==NULL) bol = (ECHAR *)"\r"; newline= walloc(ECHAR, 20); strcpy((char *)newline,(char *)bol); strcat((char *)newline,(char *)nextline); downline = (ECHAR *)newline; move_right = (ECHAR *)tgetstr("nd", &bp); if (!move_right || !downline) upline = NULL; /* terminal doesn't support enough so fall back */ TTYwidth = tgetnum("co"); TTYrows = tgetnum("li"); #endif /* defined(USE_TERMCAP) */ #if defined(TIOCGWINSZ) if (ioctl(0, TIOCGWINSZ, &W) >= 0) { TTYwidth = (int)W.ws_col; TTYrows = (int)W.ws_row; } #endif /* defined(TIOCGWINSZ) */ if (TTYwidth <= 0 || TTYrows <= 0) { TTYwidth = SCREEN_WIDTH; TTYrows = SCREEN_ROWS; } } /* ** Print an array of words in columns. */ STATIC void print_columns(int ac, char **av) { ECHAR *p; int i,c; int j; int k; int len; int skip; int longest; int cols; char info1[1024]; if (ac > 99) { TTYputs((ECHAR *)newline); sprintf(info1,"There are %d possibilities. Do you really \n",ac); TTYputs((ECHAR *)info1); TTYputs((ECHAR *)"want to see them all (y/n) ? "); while (((c = TTYget()) != EOF) && ((strchr("YyNn ",c) == NULL))) ring_bell(); if (strchr("Nn",c) != NULL) { TTYputs((ECHAR *)newline); return; } } /* Find longest name, determine column count from that. */ for (longest = 0, i = 0; i < ac; i++) if ((j = strlen((char *)av[i])) > longest) longest = j; cols = TTYwidth / (longest + 3); if (cols < 1) cols = 1; TTYputs((ECHAR *)newline); for (skip = ac / cols + 1, i = 0; i < skip; i++) { for (j = i; j < ac; j += skip) { for (p = (ECHAR *)av[j], len = strlen((char *)p), k = len; --k >= 0; p++) TTYput(*p); if (j + skip < ac) while (++len < longest + 3) TTYput(' '); } TTYputs((ECHAR *)newline); } } STATIC void reposition(int reset) { int i,PPoint; int pos; char ppp[2]; if (reset) { TTYputs(bol); for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); } TTYputs((ECHAR *)Prompt); pos = printlen(Prompt); ppp[1] = '\0'; for (i = 0; i < End; i++) { ppp[0] = Line[i]; TTYshow(Line[i]); pos += printlen(ppp); if ((pos%TTYwidth) == 0) if (RequireNLforWrap && downline) TTYputs(downline); } PPoint = Point; for (Point = End; Point > PPoint; Point--) { if (rl_meta_chars && ISMETA(Line[Point])) { TTYback(); TTYback(); } else if (ISCTL(Line[Point])) TTYback(); TTYback(); } Point = PPoint; } STATIC void left(STATUS Change) { TTYback(); if (Point) { if (ISCTL(Line[Point - 1])) TTYback(); else if (rl_meta_chars && ISMETA(Line[Point - 1])) { TTYback(); TTYback(); } } if (Change == CSmove) Point--; } STATIC void right(STATUS Change) { TTYshow(Line[Point]); if (Change == CSmove) Point++; if ((screen_pos())%TTYwidth == 0) if (downline && RequireNLforWrap) TTYputs(downline); } STATIC STATUS ring_bell() { TTYput('\07'); TTYflush(); return CSstay; } #if 0 STATIC STATUS do_macro(unsigned int c) { ECHAR name[4]; name[0] = '_'; name[1] = c; name[2] = '_'; name[3] = '\0'; if ((el_Input = (ECHAR *)getenv((char *)name)) == NULL) { el_Input = el_NIL; return ring_bell(); } return CSstay; } #endif STATIC STATUS do_forward(STATUS move) { int i; ECHAR *p; (void) move; i = 0; do { p = &Line[Point]; for ( ; Point < End && (*p == ' ' || !isalnum(*p)); p++) right(CSmove); for (; Point < End && isalnum(*p); p++) right(CSmove); if (Point == End) break; } while (++i < Repeat); return CSstay; } STATIC STATUS do_case(ECHAR type) { int i; int end; int count; ECHAR *p; int OP; OP = Point; (void)do_forward(CSstay); if (OP != Point) { if ((count = Point - OP) < 0) count = -count; for ( ; Point > OP; Point --) TTYback(); if ((end = Point + count) > End) end = End; for (i = Point, p = &Line[Point]; Point < end; p++) { if ((type == TOupper) || ((type == TOcapitalize) && (Point == i))) { if (islower(*p)) *p = toupper(*p); } else if (isupper(*p)) *p = tolower(*p); right(CSmove); } } return CSstay; } STATIC STATUS case_down_word() { return do_case(TOlower); } STATIC STATUS case_up_word() { return do_case(TOupper); } STATIC STATUS case_cap_word() { return do_case(TOcapitalize); } STATIC void ceol() { int extras; int i, PPoint; ECHAR *p; PPoint = Point; for (extras = 0, i = Point, p = &Line[i]; i < End; i++, p++) { Point++; TTYput(' '); if (ISCTL(*p)) { TTYput(' '); extras++; } else if (rl_meta_chars && ISMETA(*p)) { TTYput(' '); TTYput(' '); extras += 2; } else if ((screen_pos())%TTYwidth == 0) if (downline && RequireNLforWrap) TTYputs(downline); } Point = End; for (Point = End; Point > PPoint; Point--) { if (rl_meta_chars && ISMETA(Line[Point-1])) { TTYback(); TTYback(); } else if (ISCTL(Line[Point-1])) TTYback(); TTYback(); } Point = PPoint; } STATIC void clear_line() { int i; TTYputs(bol); for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); for (i=0; i < strlen(Prompt); i++) TTYput(' '); Point = 0; ceol(); TTYputs(bol); /* In case the prompt is more than one line long */ for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); Point = 0; End = 0; Line[0] = '\0'; } STATIC STATUS insert_string(ECHAR *p) { ESIZE_T len; int i,pos0,pos1; ECHAR *new; ECHAR *q; len = strlen((char *)p); if (End + len >= Length) { if ((new = NEW(ECHAR, Length + len + MEM_INC)) == NULL) return CSstay; if (Length) { COPYFROMTO(new, Line, Length); DISPOSE(Line); } Line = new; Length += len + MEM_INC; } for (q = &Line[Point], i = End - Point; --i >= 0; ) q[len + i] = q[i]; COPYFROMTO(&Line[Point], p, len); End += len; Line[End] = '\0'; pos0 = screen_pos(); pos1 = printlen((char *)&Line[Point]); TTYstring(&Line[Point]); Point += len; if ((pos0+pos1)%TTYwidth == 0) if (downline && RequireNLforWrap) TTYputs(downline); /* if the line is longer than TTYwidth this may put the cursor */ /* on the next line and confuse some other parts, so put it back */ /* at Point */ if (upline && (Point != End)) { pos0 = screen_pos(); pos1 = printlen((char *)&Line[Point]); for (i=((pos0%TTYwidth)+pos1)/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); TTYputs(bol); for (i=0 ; i < (pos0%TTYwidth); i++) TTYputs(move_right); } return Point == End ? CSstay : CSmove; } STATIC ECHAR *next_hist() { return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos]; } STATIC ECHAR *prev_hist() { return H.Pos == 0 ? NULL : H.Lines[--H.Pos]; } STATIC STATUS do_insert_hist(ECHAR *p) { int i; if (p == NULL) return ring_bell(); for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); Point = 0; reposition(1); ceol(); End = 0; return insert_string(p); } STATIC STATUS do_hist(ECHAR *(*move)()) { ECHAR *p; int i; i = 0; do { if ((p = (*move)()) == NULL) return ring_bell(); } while (++i < Repeat); return do_insert_hist(p); } STATIC STATUS h_next() { return do_hist(next_hist); } STATIC STATUS h_prev() { return do_hist(prev_hist); } STATIC STATUS h_first() { return do_insert_hist(H.Lines[H.Pos = 0]); } STATIC STATUS h_last() { return do_insert_hist(H.Lines[H.Pos = H.Size - 1]); } /* ** Return zero if pat appears as a substring in text. */ STATIC int substrcmp(char *text, char *pat, int len) { ECHAR c; if ((c = *pat) == '\0') return *text == '\0'; for ( ; *text; text++) if (*text == c && strncmp(text, pat, len) == 0) return 0; return 1; } STATIC ECHAR *search_hist(ECHAR *search, ECHAR *(*move)()) { static ECHAR *old_search; int len; int pos; int (*match)(); char *pat; /* Save or get remembered search pattern. */ if (search && *search) { if (old_search) DISPOSE(old_search); old_search = (ECHAR *)STRDUP((const char *)search); } else { if (old_search == NULL || *old_search == '\0') return NULL; search = old_search; } /* Set up pattern-finder. */ if (*search == '^') { match = strncmp; pat = (char *)(search + 1); } else { match = substrcmp; pat = (char *)search; } len = strlen(pat); for (pos = H.Pos; (*move)() != NULL; ) if ((*match)((char *)H.Lines[H.Pos], pat, len) == 0) return H.Lines[H.Pos]; H.Pos = pos; return NULL; } STATIC STATUS h_search() { static int Searching; CONST char *old_prompt; ECHAR *(*move)(); ECHAR *p; if (Searching) return ring_bell(); Searching = 1; clear_line(); old_prompt = Prompt; Prompt = "Search: "; TTYputs((ECHAR *)Prompt); move = Repeat == NO_ARG ? prev_hist : next_hist; p = search_hist(editinput(), move); clear_line(); Prompt = old_prompt; TTYputs((ECHAR *)Prompt); Searching = 0; return do_insert_hist(p); } STATIC STATUS fd_char() { int i; i = 0; do { if (Point >= End) break; right(CSmove); } while (++i < Repeat); return CSstay; } STATIC void save_yank(int begin, int i) { if (Yanked) { DISPOSE(Yanked); Yanked = NULL; } if (i < 1) return; if ((Yanked = NEW(ECHAR, (ESIZE_T)i + 1)) != NULL) { COPYFROMTO(Yanked, &Line[begin], i); Yanked[i] = '\0'; } } STATIC STATUS delete_string(int count) { int i; int pos0,pos1,q; char *tLine; if (count <= 0 || End == Point) return ring_bell(); if (Point + count > End && (count = End - Point) <= 0) return CSstay; if (count > 1) save_yank(Point, count); tLine = STRDUP((char *)Line); ceol(); for (q = Point, i = End - (Point + count) + 1; --i >= 0; q++) Line[q] = tLine[q+count]; wfree(tLine); End -= count; pos0 = screen_pos(); pos1 = printlen((char *)&Line[Point]); TTYstring(&Line[Point]); if ((pos1 > 0) && (pos0+pos1)%TTYwidth == 0) if (downline && RequireNLforWrap) TTYputs(downline); /* if the line is longer than TTYwidth this may put the cursor */ /* on the next line and confuse some other parts, so put it back */ /* at Point */ if (upline) { for (i=((pos0%TTYwidth)+pos1)/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); TTYputs(bol); for (i=0 ; i < (pos0%TTYwidth); i++) TTYputs(move_right); } return CSmove; } STATIC STATUS bk_char() { int i; i = 0; do { if (Point == 0) break; left(CSmove); } while (++i < Repeat); return CSstay; } STATIC STATUS bk_del_char() { int i; i = 0; do { if (Point == 0) break; left(CSmove); } while (++i < Repeat); return delete_string(i); } STATIC STATUS redisplay() { if (clrpage) TTYputs(clrpage); else TTYputs((ECHAR *)newline); /* TTYputs((ECHAR *)Prompt); TTYstring(Line); */ return CSmove; } STATIC STATUS kill_line() { int i; if (Repeat != NO_ARG) { if (Repeat < Point) { i = Point; Point = Repeat; reposition(1); (void)delete_string(i - Point); } else if (Repeat > Point) { right(CSmove); (void)delete_string(Repeat - Point - 1); } return CSmove; } save_yank(Point, End - Point); ceol(); Line[Point] = '\0'; End = Point; return CSstay; } STATIC char *rsearch_hist(char *patt, int *lpos,int *cpos) { /* Extension by awb to do reverse incremental searches */ for (; *lpos > 0; (*lpos)--) { for ( ; (*cpos) >= 0 ; (*cpos)--) { /* fprintf(stderr,"comparing %d %s %s\n",*lpos,patt,H.Lines[*lpos]+*cpos); */ if (strncmp(patt,(char *)H.Lines[*lpos]+*cpos,strlen(patt)) == 0) { /* found a match */ return (char *)H.Lines[*lpos]; } } if ((*lpos) > 0) *cpos = strlen((char *)H.Lines[(*lpos)-1]); } return NULL; /* no match found */ } STATIC STATUS h_risearch() { STATUS s; CONST char *old_prompt; char *pat, *hist, *nhist; char *nprompt; int patsize, patend, i; ECHAR c; int lpos,cpos; old_prompt = Prompt; nprompt = walloc(char,80+160); pat = walloc(char,80); patend=0; patsize=80; pat[0] = '\0'; hist = ""; lpos = H.Pos; /* where the search has to start from */ cpos = strlen((char *)H.Lines[lpos]); do { sprintf(nprompt,"(reverse-i-search)`%s': ",pat); Prompt = nprompt; kill_line(); do_insert_hist((ECHAR *)hist); if (patend != 0) for (i=strlen((char *)H.Lines[lpos]); i>cpos; i--) bk_char(); c = TTYget(); if ((c >= ' ') || (c == CTL('R'))) { if (c == CTL('R')) cpos--; else if (patend < 79) { pat[patend]=c; patend++; pat[patend]='\0'; } else /* too long */ { ring_bell(); continue; } nhist = rsearch_hist(pat,&lpos,&cpos); if (nhist != NULL) { hist = nhist; H.Pos = lpos; } else { /* oops, no match */ ring_bell(); if (c != CTL('R')) { patend--; pat[patend] = '\0'; } } } } while ((c >= ' ') || (c == CTL('R'))); /* Tidy up */ clear_line(); Prompt = old_prompt; TTYputs((ECHAR *)Prompt); wfree(nprompt); kill_line(); s = do_insert_hist((ECHAR *)hist); if (patend != 0) for (i=strlen((char *)H.Lines[lpos]); i>cpos; i--) s = bk_char(); if (c != ESC) return emacs(c); else return s; } STATIC STATUS insert_char(int c) { STATUS s; ECHAR buff[2]; ECHAR *p; ECHAR *q; int i; if (Repeat == NO_ARG || Repeat < 2) { buff[0] = c; buff[1] = '\0'; return insert_string(buff); } if ((p = NEW(ECHAR, Repeat + 1)) == NULL) return CSstay; for (i = Repeat, q = p; --i >= 0; ) *q++ = c; *q = '\0'; Repeat = 0; s = insert_string(p); DISPOSE(p); return s; } STATIC STATUS meta() { unsigned int c; KEYMAP *kp; if ((c = TTYget()) == EOF) return CSeof; #if defined(ANSI_ARROWS) /* Also include VT-100 arrows. */ if (c == '[' || c == 'O') switch (c = TTYget()) { default: return ring_bell(); case EOF: return CSeof; case 'A': return h_prev(); case 'B': return h_next(); case 'C': return fd_char(); case 'D': return bk_char(); } #endif /* defined(ANSI_ARROWS) */ if (isdigit(c)) { for (Repeat = c - '0'; (c = TTYget()) != EOF && isdigit(c); ) Repeat = Repeat * 10 + c - '0'; el_Pushed = 1; el_PushBack = c; return CSstay; } /* if (isupper(c)) return do_macro(c); */ for (OldPoint = Point, kp = MetaMap; kp->Function; kp++) if (kp->Key == c) return (*kp->Function)(); if (rl_meta_chars == 0) { insert_char(META(c)); return CSmove; } return ring_bell(); } STATIC STATUS emacs(unsigned int c) { STATUS s; KEYMAP *kp; if (ISMETA(c) && rl_meta_chars) { el_Pushed = 1; el_PushBack = UNMETA(c); return meta(); } for (kp = Map; kp->Function; kp++) if (kp->Key == c) break; s = kp->Function ? (*kp->Function)() : insert_char((int)c); if (!el_Pushed) /* No pushback means no repeat count; hacky, but true. */ Repeat = NO_ARG; return s; } STATIC STATUS TTYspecial(unsigned int c) { int i; if (ISMETA(c)) return CSdispatch; if (c == rl_erase || c == DEL) return bk_del_char(); if (c == rl_kill) { if (Point != 0) { for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); Point = 0; reposition(1); } Repeat = NO_ARG; return kill_line(); } if (c == rl_intr || c == rl_quit) { Point = End = 0; Line[0] = '\0'; if (c == rl_intr) { el_intr_pending = 1; return CSdone; } else return redisplay(); } if (c == rl_eof && Point == 0 && End == 0) return CSeof; return CSdispatch; } STATIC ECHAR *editinput() { unsigned int c; Repeat = NO_ARG; OldPoint = Point = Mark = End = 0; Line[0] = '\0'; while ((c = TTYget()) != EOF) { switch (TTYspecial(c)) { case CSdone: return Line; case CSeof: return NULL; case CSmove: reposition(1); break; case CSstay: break; case CSdispatch: switch (emacs(c)) { case CSdone: return Line; case CSeof: return NULL; case CSmove: reposition(1); break; case CSstay: case CSdispatch: break; } break; } } return NULL; } STATIC void hist_add(ECHAR *p) { int i; if ((p = (ECHAR *)STRDUP((char *)p)) == NULL) return; if (H.Size < editline_histsize) H.Lines[H.Size++] = p; else { DISPOSE(H.Lines[0]); for (i = 0; i < editline_histsize - 1; i++) H.Lines[i] = H.Lines[i + 1]; H.Lines[i] = p; } H.Pos = H.Size - 1; } /* Added by awb 29/12/98 to get saved history file */ void write_history(const char *history_file) { FILE *fd; int i; if ((fd = fopen(history_file,"wb")) == NULL) { fprintf(stderr,"editline: can't access history file \"%s\"\n", history_file); return; } for (i=0; i < H.Size; i++) fprintf(fd,"%s\n",H.Lines[i]); fclose(fd); } void read_history(const char *history_file) { FILE *fd; char buff[2048]; int c,i; H.Lines = NEW(ECHAR *,editline_histsize); H.Size = 0; H.Pos = 0; if ((fd = fopen(history_file,"rb")) == NULL) return; /* doesn't have a history file yet */ while ((c=getc(fd)) != EOF) { ungetc(c,fd); for (i=0; ((c=getc(fd)) != '\n') && (c != EOF); i++) if (i < 2047) buff[i] = c; buff[i] = '\0'; add_history(buff); } fclose(fd); } /* ** For compatibility with FSF readline. */ /* ARGSUSED0 */ void rl_reset_terminal(char *p) { } void rl_initialize() { } char *readline(CONST char *prompt) { ECHAR *line; if (Line == NULL) { Length = MEM_INC; if ((Line = NEW(ECHAR, Length)) == NULL) return NULL; } TTYinfo(); rl_ttyset(0); hist_add(el_NIL); ScreenSize = SCREEN_INC; Screen = NEW(char, ScreenSize); Prompt = prompt ? prompt : (char *)el_NIL; el_intr_pending = 0; if (el_no_echo == 1) { el_no_echo = 0; TTYputs((ECHAR *)Prompt); TTYflush(); el_no_echo = 1; } else TTYputs((ECHAR *)Prompt); line = editinput(); if (line != NULL) { line = (ECHAR *)STRDUP((char *)line); TTYputs((ECHAR *)newline); TTYflush(); } rl_ttyset(1); DISPOSE(Screen); DISPOSE(H.Lines[--H.Size]); if (el_intr_pending) do_user_intr(); return (char *)line; } void add_history(p) char *p; { if (p == NULL || *p == '\0') return; #if defined(UNIQUE_HISTORY) if (H.Pos && strcmp(p, H.Lines[H.Pos - 1]) == 0) return; #endif /* defined(UNIQUE_HISTORY) */ hist_add((ECHAR *)p); } STATIC STATUS beg_line() { int i; if (Point) { for (i=screen_pos()/TTYwidth; i > 0; i--) if (upline) TTYputs(upline); Point = 0; return CSmove; } return CSstay; } STATIC STATUS del_char() { return delete_string(Repeat == NO_ARG ? 1 : Repeat); } STATIC STATUS end_line() { if (Point != End) { while (Point < End) { TTYput(Line[Point]); Point++; } return CSmove; } return CSstay; } /* ** Move back to the beginning of the current word and return an ** allocated copy of it. */ STATIC ECHAR *find_word() { static char SEPS[] = "#;&|^$=`'{}()<>\n\t "; ECHAR *p; ECHAR *new; ESIZE_T len; for (p = &Line[Point]; p > Line && strchr(SEPS, (char)p[-1]) == NULL; p--) continue; len = Point - (p - Line) + 1; if ((new = NEW(ECHAR, len)) == NULL) return NULL; COPYFROMTO(new, p, len); new[len - 1] = '\0'; return new; } void el_redisplay() { reposition(0); /* redisplay assuming already on newline */ } char *el_current_sym() { /* Get current symbol at point -- awb*/ char *symbol = NULL; int i,j; if (End == 0) return NULL; if (Point == End) i=Point-1; else i=Point; for ( ; ((i >= 0) && (strchr("()' \t\n\r",Line[i]) != NULL)); i--); /* i will be on final or before final character */ if (i < 0) return NULL; /* But if its not at the end of the current symbol move it there */ for (; i < End; i++) if (strchr("()' \t\n\r\"",Line[i]) != NULL) break; for (j=i-1; j >=0; j--) if (strchr("()' \t\n\r\"",Line[j]) != NULL) break; symbol = walloc(char,i-j); strncpy(symbol,(char *)&Line[j+1],i-(j+1)); symbol[i-(j+1)] = '\0'; return symbol; } static char *completion_to_ambiguity(int index,char **possibles) { /* Find the string that extends from index in possibles until an */ /* ambiguity is found -- awb */ char *p; int e,i; int extending; extending = 1; e = index; for ( ; extending; e++) { for (i=0; possibles[i] != NULL; i++) if (possibles[i][e] != possibles[0][e]) { extending = 0; e--; break; } } if (e==index) return NULL; /* already at ambiguity */ else { p = walloc(char,(e-index)+1); strncpy(p,possibles[0]+index,e-index); p[e-index] = '\0'; return p; } } static char **el_file_completion_function(char * text, int start, int end) { /* Interface to editline rl_list_possib which looks up possible */ /* file name completions. */ char *word; char **matches1; char **matches2; int ac,i; word = walloc(char,(end-start)+1); strncpy(word,text+start,end-start); word[end-start]='\0'; ac = rl_list_possib(word,&matches1); wfree(word); if (ac == 0) return NULL; else { matches2 = walloc(char *,ac+1); for (i=0; i < ac; i++) matches2[i] = matches1[i]; matches2[i] = NULL; wfree(matches1); return matches2; } } STATIC STATUS c_complete() { /* Modified by awb 30/12/98 to allow listing of possibles and */ /* a user definable completion method */ char *p; char *word; int start; char **possibles=NULL; int possiblesc=0; int started_with_quote = 0; STATUS s; int i; for (start=Point; start > 0; start--) if (strchr("()' \t\n\r\"",Line[start-1]) != NULL) break; word = walloc(char,(Point-start)+1); strncpy(word,(char *)(Line+start),Point-start); word[Point-start]='\0'; if ((start > 0) && (Line[start-1] == '"')) started_with_quote = 1; if (el_user_completion_function) /* May need to look at previous char so pass in Line */ possibles = el_user_completion_function((char *)Line,start,Point); if (possibles == NULL) { possibles = el_file_completion_function((char *)Line,start,Point); /* As filename completions only complete the final file name */ /* not the full path we need to set a new start position */ for (start=Point; start > 0; start--) if (strchr("()' \t\n\r\"/",Line[start-1]) != NULL) break; } if (possibles) for (possiblesc=0; possibles[possiblesc] != NULL; possiblesc++); if ((!possibles) || (possiblesc == 0)) /* none or none at all */ s = ring_bell(); else if (possiblesc == 1) /* a single expansion */ { p = walloc(char,strlen(possibles[0])-(Point-start)+2); sprintf(p,"%s ",possibles[0]+(Point-start)); if ((strlen(p) > 1) && (p[strlen(p)-2] == '/')) p[strlen(p)-1] = '\0'; else if (started_with_quote) p[strlen(p)-1] = '"'; s = insert_string((ECHAR *)p); wfree(p); } else if ((p = completion_to_ambiguity(Point-start,possibles)) != NULL) { /* an expansion to a later ambiguity */ s = insert_string((ECHAR *)p); wfree(p); ring_bell(); } else /* list of possibilities and we can't expand any further */ { print_columns(possiblesc,possibles); /* display options */ reposition(0); /* display whole line again */ s = CSmove; } for (i=0; possibles && possibles[i] != NULL; i++) wfree(possibles[i]); wfree(possibles); wfree(word); return s; } #if 0 /* Original version without automatic listing of possible completions */ STATIC STATUS c_complete_old() { ECHAR *p; ECHAR *word; int unique; STATUS s; word = find_word(); p = (ECHAR *)rl_complete((char *)word, &unique); if (word) DISPOSE(word); if (p && *p) { s = insert_string(p); if (!unique) (void)ring_bell(); DISPOSE(p); return s; } return ring_bell(); } #endif STATIC STATUS c_possible() { ECHAR **av; ECHAR *word; int ac; word = find_word(); /* The (char ***) ((void *) &av) below is to avoid a warning * from GCC about casting an unsigned char *** to char *** */ ac = rl_list_possib((char *)word, (char ***) ((void *) &av)); if (word) DISPOSE(word); if (ac) { print_columns(ac, (char **)av); reposition(0); while (--ac >= 0) DISPOSE(av[ac]); DISPOSE(av); return CSmove; } return ring_bell(); } STATIC STATUS accept_line() { Line[End] = '\0'; return CSdone; } #ifdef SYSTEM_IS_WIN32 STATIC STATUS end_of_input() { Line[End] = '\0'; return CSeof; } #endif STATIC STATUS transpose() { ECHAR c; if (Point) { if (Point == End) left(CSmove); c = Line[Point - 1]; left(CSstay); Line[Point - 1] = Line[Point]; TTYshow(Line[Point - 1]); Line[Point++] = c; TTYshow(c); } return CSstay; } STATIC STATUS quote() { unsigned int c; return (c = TTYget()) == EOF ? CSeof : insert_char((int)c); } STATIC STATUS wipe() { int i; if (Mark > End) return ring_bell(); if (Point > Mark) { i = Point; Point = Mark; Mark = i; reposition(1); } return delete_string(Mark - Point); } STATIC STATUS mk_set() { Mark = Point; return CSstay; } STATIC STATUS exchange() { unsigned int c; if ((c = TTYget()) != CTL('X')) return c == EOF ? CSeof : ring_bell(); if ((c = Mark) <= End) { Mark = Point; Point = c; return CSmove; } return CSstay; } STATIC STATUS yank() { if (Yanked && *Yanked) return insert_string(Yanked); return CSstay; } STATIC STATUS copy_region() { if (Mark > End) return ring_bell(); if (Point > Mark) save_yank(Mark, Point - Mark); else save_yank(Point, Mark - Point); return CSstay; } STATIC STATUS move_to_char() { unsigned int c; int i; ECHAR *p; if ((c = TTYget()) == EOF) return CSeof; for (i = Point + 1, p = &Line[i]; i < End; i++, p++) if (*p == c) { Point = i; return CSmove; } return CSstay; } STATIC STATUS fd_word() { return do_forward(CSmove); } STATIC STATUS fd_kill_word() { int i; int OP; OP = Point; (void)do_forward(CSmove); if (OP != Point) { i = Point - OP; for ( ; Point > OP; Point --) TTYback(); return delete_string(i); } return CSmove; } STATIC STATUS bk_word() { int i; ECHAR *p; i = 0; do { for (p = &Line[Point]; p > Line && !isalnum(p[-1]); p--) left(CSmove); for (; p > Line && p[-1] != ' ' && isalnum(p[-1]); p--) left(CSmove); if (Point == 0) break; } while (++i < Repeat); return CSstay; } STATIC STATUS bk_kill_word() { (void)bk_word(); if (OldPoint != Point) return delete_string(OldPoint - Point); return CSstay; } STATIC int argify(ECHAR *line, ECHAR ***avp) { ECHAR *c; ECHAR **p; ECHAR **new; int ac; int i; i = MEM_INC; if ((*avp = p = NEW(ECHAR*, i))== NULL) return 0; for (c = line; isspace(*c); c++) continue; if (*c == '\n' || *c == '\0') return 0; for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) { if (isspace(*c)) { *c++ = '\0'; if (*c && *c != '\n') { if (ac + 1 == i) { new = NEW(ECHAR*, i + MEM_INC); if (new == NULL) { p[ac] = NULL; return ac; } COPYFROMTO(new, p, i * sizeof (char **)); i += MEM_INC; DISPOSE(p); *avp = p = new; } p[ac++] = c; } } else c++; } *c = '\0'; p[ac] = NULL; return ac; } STATIC STATUS last_argument() { ECHAR **av; ECHAR *p; STATUS s; int ac; if (H.Size == 1 || (p = H.Lines[H.Size - 2]) == NULL) return ring_bell(); if ((p = (ECHAR *)STRDUP((char *)p)) == NULL) return CSstay; ac = argify(p, &av); if (Repeat != NO_ARG) s = Repeat < ac ? insert_string(av[Repeat]) : ring_bell(); else s = ac ? insert_string(av[ac - 1]) : CSstay; if (ac) DISPOSE(av); DISPOSE(p); return s; } STATIC KEYMAP Map[33] = { { CTL('@'), ring_bell }, { CTL('A'), beg_line }, { CTL('B'), bk_char }, { CTL('D'), del_char }, { CTL('E'), end_line }, { CTL('F'), fd_char }, { CTL('G'), ring_bell }, { CTL('H'), bk_del_char }, { CTL('I'), c_complete }, { CTL('J'), accept_line }, { CTL('K'), kill_line }, { CTL('L'), redisplay }, { CTL('M'), accept_line }, { CTL('N'), h_next }, { CTL('O'), ring_bell }, { CTL('P'), h_prev }, { CTL('Q'), ring_bell }, { CTL('R'), h_risearch }, { CTL('S'), h_search }, { CTL('T'), transpose }, { CTL('U'), ring_bell }, { CTL('V'), quote }, { CTL('W'), wipe }, { CTL('X'), exchange }, { CTL('Y'), yank }, #ifdef SYSTEM_IS_WIN32 { CTL('Z'), end_of_input }, #else { CTL('Z'), ring_bell }, #endif { CTL('['), meta }, { CTL(']'), move_to_char }, { CTL('^'), ring_bell }, { CTL('_'), ring_bell }, { 0, NULL } }; STATIC KEYMAP MetaMap[64]= { { CTL('H'), bk_kill_word }, { DEL, bk_kill_word }, { ' ', mk_set }, { '.', last_argument }, { '<', h_first }, { '>', h_last }, { '?', c_possible }, { 'b', bk_word }, { 'c', case_cap_word }, { 'd', fd_kill_word }, { 'f', fd_word }, { 'l', case_down_word }, { 'u', case_up_word }, { 'y', yank }, { 'w', copy_region }, { 0, NULL } }; void el_bind_key_in_metamap(char c, Keymap_Function func) { /* Add given function to key map for META keys */ int i; for (i=0; MetaMap[i].Key != 0; i++) { if (MetaMap[i].Key == c) { MetaMap[i].Function = func; return; } } /* A new key so have to add it to end */ if (i == 63) { fprintf(stderr,"editline: MetaMap table full, requires increase\n"); return; } MetaMap[i].Function = func; MetaMap[i].Key = c; MetaMap[i+1].Function = 0; /* Zero the last location */ MetaMap[i+1].Key = 0; /* Zero the last location */ } speech_tools/siod/el_sys_unix.c0000644000076400007640000001276307262616577015357 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* this version of editline does not have the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /****************************************************************************/ /* $Revision: 1.2 $ ** ** Unix system-dependant routines for editline library. */ #include "editline.h" #include #include #include extern CONST ECHAR el_NIL[]; int el_user_intr = 0; int el_PushBack=0; int el_Pushed=0; CONST ECHAR *el_Input = el_NIL; extern void TTYflush(); #if defined(HAVE_TCGETATTR) #include void rl_ttyset(int Reset) { static struct termios old; struct termios new; if (Reset == 0) { (void)tcgetattr(0, &old); rl_erase = old.c_cc[VERASE]; rl_kill = old.c_cc[VKILL]; rl_eof = old.c_cc[VEOF]; rl_intr = old.c_cc[VINTR]; rl_quit = old.c_cc[VQUIT]; new = old; new.c_cc[VINTR] = -1; new.c_cc[VQUIT] = -1; new.c_lflag &= ~(ECHO | ICANON); new.c_iflag &= ~(ISTRIP | INPCK); new.c_cc[VMIN] = 1; new.c_cc[VTIME] = 0; #ifdef VDSUSP /* On Solaris (non-posix) DSUSP is ^Y, cancel it (awb 30/12/98) */ new.c_cc[VDSUSP] = -1; #endif (void)tcsetattr(0, TCSANOW, &new); } else (void)tcsetattr(0, TCSANOW, &old); } #else #include void rl_ttyset(int Reset) { static struct sgttyb old_sgttyb; static struct tchars old_tchars; struct sgttyb new_sgttyb; struct tchars new_tchars; if (Reset == 0) { (void)ioctl(0, TIOCGETP, &old_sgttyb); rl_erase = old_sgttyb.sg_erase; rl_kill = old_sgttyb.sg_kill; (void)ioctl(0, TIOCGETC, &old_tchars); rl_eof = old_tchars.t_eofc; rl_intr = old_tchars.t_intrc; rl_quit = old_tchars.t_quitc; new_sgttyb = old_sgttyb; new_sgttyb.sg_flags &= ~ECHO; new_sgttyb.sg_flags |= RAW; #if defined(PASS8) new_sgttyb.sg_flags |= PASS8; #endif /* defined(PASS8) */ (void)ioctl(0, TIOCSETP, &new_sgttyb); new_tchars = old_tchars; new_tchars.t_intrc = -1; new_tchars.t_quitc = -1; (void)ioctl(0, TIOCSETC, &new_tchars); } else { (void)ioctl(0, TIOCSETP, &old_sgttyb); (void)ioctl(0, TIOCSETC, &old_tchars); } } #endif /* defined(HAVE_TCGETATTR) */ unsigned int TTYget() { ECHAR c; int s; TTYflush(); if (el_Pushed) { el_Pushed = 0; return el_PushBack; } if (*el_Input) return *el_Input++; s = read(0, &c, (ESIZE_T)1) == 1 ? c : EOF; return s; } void rl_add_slash(char *path,char *p) { struct stat Sb; if (stat(path, &Sb) >= 0) (void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " "); } int el_is_directory(char *path) { struct stat Sb; if ((stat(path, &Sb) >= 0) && S_ISDIR(Sb.st_mode)) return 1; else return 0; } void do_user_intr() { if (el_user_intr) kill(getpid(),SIGINT); } speech_tools/siod/siodp.h0000644000076400007640000001403611223223772014113 0ustar awbawb/* Scheme In One Defun, but in C this time. * COPYRIGHT (c) 1988-1992 BY * * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * * See the source file SLIB.C for more information. * Declarations which are private to SLIB.C internals. */ #ifndef __SIODP_H__ #define __SIODP_H__ #include "io.h" typedef int (*repl_getc_fn)(FILE *); typedef void (*repl_ungetc_fn)(int,FILE *); /* Will get to editline functions if supported */ extern repl_getc_fn siod_fancy_getc; extern repl_ungetc_fn siod_fancy_ungetc; extern "C" const char *repl_prompt; extern char *tkbuffer; extern LISP heap,heap_end,heap_org; extern LISP oblistvar; extern LISP open_files; extern LISP eof_val; extern LISP siod_docstrings; extern int siod_interactive; void sock_acknowledge_error(); extern FILE *fwarn; extern LISP unbound_marker; extern long gc_kind_copying; extern LISP freelist; extern long gc_cells_allocated; extern int siod_server_socket; extern "C" int rl_pos; struct user_type_hooks { char *name; char gc_free_once; LISP (*gc_relocate)(LISP); void (*gc_scan)(LISP); LISP (*gc_mark)(LISP); void (*gc_free)(LISP); void (*gc_clear)(LISP); void (*prin1)(LISP, FILE *); void (*print_string)(LISP, char *); LISP (*leval)(LISP, LISP *, LISP *); long (*c_sxhash)(LISP,long); LISP (*fast_print)(LISP,LISP); LISP (*fast_read)(int,LISP); LISP (*equal)(LISP,LISP);}; struct catch_frame {LISP tag; LISP retval; jmp_buf cframe; struct catch_frame *next;}; struct gc_protected {LISP *location; long length; struct gc_protected *next;}; #define NEWCELL(_into,_type) \ {if (gc_kind_copying == 1) \ {if ((_into = heap) >= heap_end) \ gc_fatal_error(); \ heap = _into+1;} \ else \ {if NULLP(freelist) \ gc_for_newcell(); \ _into = freelist; \ freelist = CDR(freelist); \ ++gc_cells_allocated;} \ (*_into).gc_mark = 0; \ (*_into).type = (short) _type;} #if 0 #define NEWCELL(_into,_type) NNEWCELL(&_into,_type) void NNEWCELL (LISP *_into,long _type); #endif #ifdef THINK_C extern int ipoll_counter; void full_interrupt_poll(int *counter); #define INTERRUPT_CHECK() if (--ipoll_counter < 0) full_interrupt_poll(&ipoll_counter) #else #define INTERRUPT_CHECK() #endif extern char *stack_limit_ptr; #define STACK_LIMIT(_ptr,_amt) (((char *)_ptr) - (_amt)) /* This is wrong if stack grows in different direction */ #define STACK_CHECK(_ptr) \ if (((char *) (_ptr)) < stack_limit_ptr) err_stack((char *) _ptr); #define TKBUFFERN 256 void err_stack(char *); #if defined(VMS) && defined(VAX) #define SIG_restargs ,... #else #define SIG_restargs #endif void init_storage(int init_heap_size); void init_subrs_base(void); void init_subrs_core(void); void init_subrs_doc(void); void init_subrs_file(void); void init_subrs_format(void); void init_subrs_list(void); void init_subrs_math(void); void init_subrs_sys(void); void init_subrs_srv(void); void init_subrs_str(void); void init_subrs_xtr(void); void need_n_cells(int n); char *must_malloc(unsigned long size); LISP gc_relocate(LISP x); void gc_fatal_error(void); void gc_for_newcell(void); struct user_type_hooks *get_user_type_hooks(long type); void gc_mark(LISP ptr); LISP newcell(long type); void put_st(const char *st); int f_getc(FILE *f); void f_ungetc(int c, FILE *f); long no_interrupt(long n); LISP readtl(struct gen_readio *f); long repl_driver(long want_sigint,long want_init,struct repl_hooks *); LISP leval_args(LISP l,LISP env); LISP extend_env(LISP actuals,LISP formals,LISP env); LISP envlookup(LISP var,LISP env); LISP closure(LISP env,LISP code); extern struct catch_frame *catch_framep; void close_open_files(void); void close_open_files_upto(LISP end); void pprintf(FILE *fd,LISP exp,int indent,int width, int depth,int length); #if 0 void handle_sigfpe(int sig SIG_restargs); void handle_sigint(int sig SIG_restargs); void err_ctrl_c(void); double myruntime(void); void grepl_puts(char *,void (*)(char *)); LISP gen_intern(char *name,int freeable); void scan_registers(void); void init_storage_1(int heap_size); LISP get_newspace(void); void scan_newspace(LISP newspace); void free_oldspace(LISP space,LISP end); void gc_stop_and_copy(void); void gc_mark_and_sweep(void); void gc_ms_stats_start(void); void gc_ms_stats_end(void); void mark_protected_registers(void); void mark_locations(LISP *start,LISP *end); void mark_locations_array(LISP *x,long n); void gc_sweep(void); LISP leval_setq(LISP args,LISP env); LISP syntax_define(LISP args); LISP leval_define(LISP args,LISP env); LISP leval_if(LISP *pform,LISP *penv); LISP leval_lambda(LISP args,LISP env); LISP leval_progn(LISP *pform,LISP *penv); LISP leval_or(LISP *pform,LISP *penv); LISP leval_and(LISP *pform,LISP *penv); LISP leval_catch(LISP args,LISP env); LISP lthrow(LISP tag,LISP value); LISP leval_let(LISP *pform,LISP *penv); LISP reverse(LISP l); LISP let_macro(LISP form); LISP leval_quote(LISP args,LISP env); LISP leval_tenv(LISP args,LISP env); int flush_ws(struct gen_readio *f,const char *eoferr); LISP lreadr(struct gen_readio *f); LISP lreadparen(struct gen_readio *f); LISP arglchk(LISP x); int rfs_getc(unsigned char **p); void rfs_ungetc(unsigned char c,unsigned char **p); LISP lreadstring(struct gen_readio *f); void file_gc_free(LISP ptr); void file_prin1(LISP ptr,FILE *f); LISP fd_to_scheme_file(int fd, const char *name, const char *how, int close_on_error); LISP lgetc(LISP p); LISP lputc(LISP c,LISP p); LISP lputs(LISP str,LISP p); LISP lftell(LISP file); LISP lfseek(LISP file,LISP offset,LISP direction); LISP lfread(LISP size,LISP file); LISP lfwrite(LISP string,LISP file); LISP leval_while(LISP args,LISP env); void init_subrs_a(void); void init_subrs_1(void); LISP stack_limit(LISP,LISP); void err0(void); void pr(LISP); void prp(LISP *); LISP closure_code(LISP exp); LISP closure_env(LISP exp); LISP lwhile(LISP form,LISP env); LISP siod_send_lisp_to_client(LISP x); #endif #endif speech_tools/siod/io.h0000644000076400007640000000622607262605664013422 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /************************************************************************/ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* Date: Tue Jun 10 1997 */ /************************************************************************/ /* */ /* FD opening functions. */ /* */ /************************************************************************/ #ifndef __IO_H__ #define __IO_H__ int fd_open_stdinout(const char *r_or_w); int fd_open_file(const char *name, const char *r_or_w); int fd_open_url(const char *protocol, const char *host, const char *port, const char *path, const char *r_or_w); #endif speech_tools/siod/EST_SiodServer.h0000644000076400007640000000770507262616577015623 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ #ifndef __EST_SIODSERVER_H__ #define __EST_SIODSERVER_H__ #include "EST_Server.h" #include "siod.h" VAL_REGISTER_CLASS_DCLS(scheme,obj) /** Simple scheme server. * * @author Richard Caley * @version $Id: EST_SiodServer.h,v 1.2 2001/04/04 13:11:27 awb Exp $ */ class EST_SiodServer : public EST_Server { public: class ResultHandler : public EST_Server::ResultHandler { public: ResultHandler(); virtual void process(void); virtual ~ResultHandler(); }; class RequestHandler : public EST_Server::RequestHandler { public: RequestHandler(); virtual EST_String process(void); virtual ~RequestHandler(); }; EST_SiodServer(EST_String name="siod"); EST_SiodServer(EST_String name, ostream *trace); /// Create a server connection by explicitly saying where to connect to. EST_SiodServer(EST_String hostname, int port); EST_SiodServer(EST_String hostname, int port, ostream *trace); /**@name Server end constructors */ //@{ EST_SiodServer(Mode mode, EST_String name); EST_SiodServer(Mode mode, EST_String name, ostream *trace); //@} /// Destroy the connection. ~EST_SiodServer(); virtual bool parse_command(const EST_String command, EST_String &package, EST_String &operation, Args &arguments); virtual EST_String build_command(const EST_String package, const EST_String operation, const Args &arguments); virtual bool parse_result(const EST_String resultString, Result &res); virtual EST_String build_result(const Result &res); }; #endif speech_tools/siod/siodeditline.h0000644000076400007640000000714707262605664015472 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : December 1998 */ /*-----------------------------------------------------------------------*/ /* */ /* An interface to Rich $alz's editline library offer GNU readline */ /* functionality */ /* */ /*=======================================================================*/ #ifndef __SIODEDITLINE_H__ #define __SIODEDITLINE_H__ #ifdef __cplusplus extern "C" { #endif int siod_el_getc(FILE *f); void siod_el_ungetc(int c, FILE *f); void siod_el_init(void); char **siod_variable_generator(char *text,int length); char **siod_command_generator(char *text,int length); const char *siod_docstring(const char *symbol); const char *siod_manual_sym(const char *symbol); void siod_saydocstring(const char *symbol); extern int editline_histsize; extern int el_no_echo; extern char *editline_history_file; #ifndef TRUE #define TRUE (1==1) #endif #ifndef FALSE #define FALSE (1==0) #endif #ifdef __cplusplus } #endif #endif speech_tools/siod/editline.h0000644000076400007640000001410607262616577014611 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* this version of editline does not have the the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /****************************************************************************/ /* $Revision: 1.2 $ ** ** Internal header file for editline library. ** */ /* Explicit configuration for Unix environment which will effectively be */ /* set up by the Speech Tools configuration by this point -- awb */ #define ANSI_ARROWS #define HAVE_TCGETATTR #define HAVE_STDLIB #define HIDE #define USE_DIRENT #define SYS_UNIX /* will all work without this except long lines */ #define USE_TERMCAP /* ** Command status codes (moved from editline.h). */ typedef enum _STATUS { CSdone, CSeof, CSmove, CSdispatch, CSstay } STATUS; typedef STATUS (*Keymap_Function)(); #include #if defined(HAVE_STDLIB) #include #include #endif /* defined(HAVE_STDLIB) */ #if defined(SYS_UNIX) #include "el_unix.h" #endif /* defined(SYS_UNIX) */ #if defined(SYS_OS9) #include "os9.h" #endif /* defined(SYS_OS9) */ #if !defined(ESIZE_T) #define ESIZE_T unsigned int #endif /* !defined(ESIZE_T) */ typedef unsigned char ECHAR; #if defined(HIDE) #define STATIC static #else #define STATIC /* NULL */ #endif /* !defined(HIDE) */ #if !defined(CONST) #if defined(__STDC__) #define CONST const #else #define CONST #endif /* defined(__STDC__) */ #endif /* !defined(CONST) */ #define MEM_INC 64 #define SCREEN_INC 256 #if 0 #define DISPOSE(p) free((char *)(p)) #define NEW(T, c) \ ((T *)malloc((unsigned int)(sizeof (T) * (c)))) #define RENEW(p, T, c) \ (p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c)))) #define STRDUP(X) strdup(X) #endif #define COPYFROMTO(new, p, len) \ (void)memcpy((char *)(new), (char *)(p), (int)(len)) /* CSTR EST replacements -- awb */ #include "EST_walloc.h" #define DISPOSE(p) wfree(p) #define NEW(T,c) walloc(T,c) #define RENEW(p,T,c) (p = wrealloc(p,T,c)) #define STRDUP(X) wstrdup(X) /* ** Variables and routines internal to this package. */ extern int rl_eof; extern int rl_erase; extern int rl_intr; extern int rl_kill; extern int rl_quit; extern int el_user_intr; /* with SIGINT if non-zero */ extern int el_no_echo; /* e.g under emacs, don't echo except prompt */ extern char *rl_complete(char *pathname, int *unique); extern int rl_list_possib(char *pathname,char ***avp); extern char *editline_history_file; void rl_ttyset(int Reset); void rl_add_slash(char *path,char *p); int el_is_directory(char *path); void do_user_intr(); #if !defined(HAVE_STDLIB) extern char *getenv(); extern char *malloc(); extern char *realloc(); extern char *memcpy(); extern char *strcat(); extern char *strchr(); extern char *strrchr(); extern char *strcpy(); extern char *strdup(); extern int strcmp(); extern int strlen(); extern int strncmp(); #endif /* !defined(HAVE_STDLIB) */ /* Added prototypes for available functions in editline -- awb */ char * readline(CONST char* prompt); void add_history(char *p); void read_history(const char *history_file); void write_history(const char *history_file); typedef char **EL_USER_COMPLETION_FUNCTION_TYPE(char *text,int start, int end); extern EL_USER_COMPLETION_FUNCTION_TYPE*el_user_completion_function; char *el_current_sym(); void el_redisplay(); void el_bind_key_in_metamap(char c, Keymap_Function func); speech_tools/siod/el_unix.h0000644000076400007640000000671307262616577014464 0ustar awbawb/****************************************************************************/ /* */ /* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */ /* */ /* This software is not subject to any license of the American Telephone */ /* and Telegraph Company or of the Regents of the University of California. */ /* */ /* Permission is granted to anyone to use this software for any purpose on */ /* any computer system, and to alter it and redistribute it freely, subject */ /* to the following restrictions: */ /* 1. The authors are not responsible for the consequences of use of this */ /* software, no matter how awful, even if they arise from flaws in it. */ /* 2. The origin of this software must not be misrepresented, either by */ /* explicit claim or by omission. Since few users ever read sources, */ /* credits must appear in the documentation. */ /* 3. Altered versions must be plainly marked as such, and must not be */ /* misrepresented as being the original software. Since few users */ /* ever read sources, credits must appear in the documentation. */ /* 4. This notice may not be removed or altered. */ /* */ /****************************************************************************/ /* */ /* This is a line-editing library, it can be linked into almost any */ /* program to provide command-line editing and recall. */ /* */ /* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */ /* by rsalz@osf.org (Rich $alz) */ /* */ /****************************************************************************/ /* */ /* The version contained here has some modifications by awb@cstr.ed.ac.uk */ /* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */ /* library and Scheme-in-one-defun in particular. All modifications to */ /* to this work are continued with the same copyright above. That is */ /* This version editline does not have the the "no commercial use" */ /* restriction that some of the rest of the EST library may have */ /* awb Dec 30 1998 */ /* */ /****************************************************************************/ /* $Revision: 1.2 $ ** ** Editline system header file for Unix. */ #define CRLF "\r\n" #define FORWARD STATIC #include #include #if defined(SYSTEM_IS_WIN32) #else # if defined(USE_DIRENT) # include typedef struct dirent DIRENTRY; # else # include typedef struct direct DIRENTRY; # endif #endif #if !defined(S_ISDIR) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif speech_tools/java/Makefile0000644000076400007640000000601307262605664014257 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=.. DIRNAME=java VERSION_DIRS = basic_version ALL_DIRS= common basic_version cpp_version media_version DEPEND_DIRS = common build_basic_version_from = common basic_version build_cpp_version_from = common cpp_version build_media_version_from = common media_version FILES = Makefile java.mak java_cpp.mak java_media.mak ReadMe LOCAL_CLEAN = $(VERSION_DIRS:%=%_build) # We don't compile in here for Visual C++ VC_IGNORE=yes # ALL = .sub_directories .javalib ALL = check_and_make include $(TOP)/config/common_make_rules include $(EST)/config/rules/build_dir.mak check_and_make: $(VERSION_DIRS:%=create_%_build) $(VERSION_DIRS:%=%_build) speech_tools/java/java.mak0000644000076400007640000000706707262605664014244 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Make rules for Java module ## ## ## ########################################################################### INCLUDE_JAVA=1 MOD_DESC_JAVA=Basic Java classes ifeq ($(DIRNAME),.) EXTRA_LIB_BUILD_DIRS := java $(EXTRA_LIB_BUILD_DIRS) endif include $(EST)/config/compilers/$(JAVA_COMPILER).mak ifndef JAVA_COMPILER .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| No Java compiler specified" @echo "+--------------------------------------------------" @exit 1 endif ifeq ($(JAVA_COMPILER),none) .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| No Java compiler specified" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/java/java_cpp.mak0000644000076400007640000000742607262605664015105 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Make rules for Java module ## ## ## ########################################################################### INCLUDE_JAVA_CPP=1 MOD_DESC_JAVA_CPP=Java interface to C++ classes PROJECT_LIBRARIES := $(PROJECT_LIBRARIES_JAVA) $(PROJECT_LIBRARIES) PROJECT_SHARED_LIBRARIES := $(PROJECT_SHARED_LIBRARIES) $(PROJECT_LIBRARIES_JAVA) PROJECT_ALL_LIBRARIES := $(PROJECT_ALL_LIBRARIES) $(PROJECT_LIBRARIES_JAVA) ifeq ($(DIRNAME),java) VERSION_DIRS += cpp_version endif ifndef SHARED .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must compile SHARED to include Java support." @echo "+--------------------------------------------------" @exit 1 endif ifndef INCLUDE_JAVA .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include java support to get Java C++ support" @echo "| of C++ classes" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/java/java_media.mak0000644000076400007640000000676107262605664015403 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Make rules for Java module ## ## ## ########################################################################### INCLUDE_JAVA_MEDIA=1 MOD_DESC_JAVA_MEDIA=Java interface with Media API support ifeq ($(DIRNAME),java) VERSION_DIRS += media_version endif SYSTEM_JAVA_CLASSPATH:=$(SYSTEM_JAVA_MEDIA_CLASSPATH):$(SYSTEM_JAVA_CLASSPATH) SYSTEM_LD_LIBRARY_PATH:=$(SYSTEM_JAVA_MEDIA_LIBRARY):$(SYSTEM_LD_LIBRARY_PATH) ifndef INCLUDE_JAVA .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include java support to get Java media API" @echo "| support." @echo "+--------------------------------------------------" @exit 1 endif speech_tools/java/ReadMe0000644000076400007640000000021507262605664013675 0ustar awbawb This directory tree contains a set of Java classes which give access to the Edinburgh speech tools. At the moment these are quite limited. speech_tools/java/common/Makefile0000644000076400007640000000507507262605664015556 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../.. DIRNAME=java/common BUILD_DIRS = cstr NEED_JAVA = true FILES = Makefile ALL = .sub_directories .javalib -include Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/Makefile0000644000076400007640000000512407262605664016524 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../.. DIRNAME=java/common/cstr BUILD_DIRS = awt util est testPrograms NEED_JAVA = true FILES = Makefile ALL = .sub_directories -include ../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/awt/Makefile0000644000076400007640000000517607262605664017326 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME=java/common/cstr/awt JAVA_CLASSES = ScrollWindow ImageCanvas XColor ColorSelection NEED_JAVA = true FILES = Makefile $(JAVA_CLASSES:=.java) ALL = .java -include ../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/awt/ScrollWindow.java0000644000076400007640000001052607262605664021152 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Thu Apr 9 1998 \\ // -------------------------------------------------------------------- \\ package cstr.awt; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.event.*; import cstr.est.*; public class ScrollWindow extends Frame implements ActionListener, WindowListener { ScrollPane scroller; Canvas canvas; private void init(String title, Component contents, int width, int height) { setTitle(title); setSize(width, height); scroller = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); scroller.add(contents); scroller.doLayout(); MenuBar mb = new MenuBar(); setMenuBar(mb); Menu cMenu = new Menu("Control", true); mb.add(cMenu); MenuItem mItem = new MenuItem("Quit"); mItem.addActionListener(this); cMenu.add(mItem); addWindowListener(this); setLayout(new BorderLayout()); add("Center", scroller); pack(); } public ScrollWindow(String name, Component contents) { super(); init(name, contents, 500, 500); } public ScrollWindow(String name, Component contents, int width, int height) { super(); init(name, contents, width, height); } public void quit() { dispose(); } public void quit(String s) { dispose(); } public void actionPerformed(ActionEvent event) { quit("action"); } public void windowClosing(WindowEvent event) { quit("close"); } public void windowOpened(WindowEvent event) { } public void windowClosed(WindowEvent event) { } public void windowIconified(WindowEvent event) { } public void windowDeiconified(WindowEvent event) { } public void windowActivated(WindowEvent event) { } public void windowDeactivated(WindowEvent event) { } } speech_tools/java/common/cstr/awt/ImageCanvas.java0000644000076400007640000001125407262605664020701 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Thu Apr 9 1998 \\ // -------------------------------------------------------------------- \\ package cstr.awt; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; public class ImageCanvas extends Canvas { Image image; int pwidth, pheight; private void init(Image im, double xscale, double yscale) { pwidth = (int)(im.getWidth(this)*xscale); pheight = (int)(im.getHeight(this)*yscale); if (xscale != 1.0 || yscale != 1.0) { ImageFilter filter = new ReplicateScaleFilter(pwidth, pheight); image = createImage(new FilteredImageSource(im.getSource(), filter)); } else image = im; } public ImageCanvas(Image touse, double xscale, double yscale) { super(); init(touse, xscale, yscale); } public ImageCanvas(ImageProducer prod, double xscale, double yscale) { super(); init(createImage(prod), xscale, yscale); } public ImageCanvas(Image touse, double scale) { super(); init(touse, scale, scale); } public ImageCanvas(ImageProducer prod, double scale) { super(); init(createImage(prod), scale, scale); } public ImageCanvas(Image touse) { super(); init(touse, 1.0, 1.0); } public ImageCanvas(ImageProducer prod) { super(); init(createImage(prod), 1.0, 1.0); } public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) { int oh =pheight; int ow = pwidth; if ((flags & ImageObserver.WIDTH) != 0) pwidth = w; if ((flags & ImageObserver.HEIGHT) != 0 ) pheight = h; if (pwidth!= ow || pheight != oh) setSize(pwidth, pheight); repaint(); return !((flags & ImageObserver.ALLBITS) != 0); } public Dimension getPreferredSize() { return new Dimension(pwidth, pheight); } public Dimension getMinimumSize() { return new Dimension(pwidth, pheight); } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { g.drawImage(image, 0, 0, pwidth, pheight, this); } } speech_tools/java/common/cstr/awt/XColor.java0000644000076400007640000001340707262616577017740 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Thu Apr 9 1998 \\ // -------------------------------------------------------------------- \\ // Extend awt.Color to understand X11 color names. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.awt ; import java.lang.*; import java.io.*; import java.util.*; import java.awt.*; public class XColor extends Color { protected static String rgbFile; protected static Hashtable colors = new Hashtable(100); protected static Reader rgbStream; protected static StreamTokenizer rgbTok; protected String name; static { rgbFile = System.getProperty("est.rgbFile"); } public XColor(float r, float g, float b) { super(r,g,b); name=null; } public XColor(int rgb) { super(rgb); name=null; } public XColor(int r, int g, int b) { super(r,g,b); name=null; } public XColor(String n) { super(x11ColorRGB(n)); name=n; } public XColor(String n, int i) { super(x11ColorRGBThrow(n)); name=n; } public static int x11ColorRGBThrow(String name) throws IllegalArgumentException { int c = x11ColorRGB(name); if (c<0) throw new IllegalArgumentException("Can't find color '"+name+"'"); return c; } public static int x11ColorRGB(String name) { name = name.toLowerCase(); Integer rgbI = (Integer)colors.get(name); if (rgbI != null) return rgbI.intValue(); if (name.startsWith("#")) try { return Integer.parseInt(name.substring(1), 16); } catch (NumberFormatException ex) { System.err.println("Can't parse color '"+name+"'"); return 0; }; if (rgbStream == null) try { rgbStream = new FileReader(rgbFile); rgbTok = new StreamTokenizer(rgbStream); rgbTok.parseNumbers(); rgbTok.ordinaryChar('\n'); } catch (FileNotFoundException ex) { System.err.println("can't open '" + rgbFile + "' " + ex.getMessage()); } int r=0; int g=0; int b=0; String n=""; try { while (1==1) { int t = rgbTok.nextToken(); if (t == rgbTok.TT_EOF) break; if (t == '\n') continue; if ( t == '!') { while (t != '\n' && t != rgbTok.TT_EOF) t = rgbTok.nextToken(); continue; } if ( t == rgbTok.TT_NUMBER) r = (int)rgbTok.nval; t = rgbTok.nextToken(); if ( t == rgbTok.TT_NUMBER) g = (int)rgbTok.nval; t = rgbTok.nextToken(); if ( t == rgbTok.TT_NUMBER) b = (int)rgbTok.nval; n=""; while ((t = rgbTok.nextToken()) != '\n' && t != rgbTok.TT_EOF) { if (!n.equals("")) n = n + " "; n = n + rgbTok.sval; } int rgb = (r<<16)|(g<<8)|(b); colors.put(n.toLowerCase(), new Integer(rgb)); if (name.equals(n.toLowerCase())) return rgb; } } catch (IOException ex) { System.err.println(ex.getMessage()); } System.err.println("Can't find color '"+name+"'"); return -1; } public static String getName(Color c) { return "#"+Integer.toString(c.getRGB(), 16); } public String getName() { if (name != null) return name; return getName(this); } } speech_tools/java/common/cstr/awt/ColorSelection.java0000644000076400007640000000701007262605664021442 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // A selection of colors from which colors can be selected. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.awt ; import java.lang.*; import java.util.*; import java.awt.*; public class ColorSelection { protected Color [] colors; protected int pos; public ColorSelection(Color [] cols) { colors = cols; pos=0; } public ColorSelection(Color col) { colors = new Color [] {col}; pos=0; } public ColorSelection(String cols) { StringTokenizer tok = new StringTokenizer(cols, ","); int n = tok.countTokens(); colors = new Color[n]; for(int i=0; i= colors.length) pos -= colors.length; if (pos >= colors.length) return Color.black; return colors[pos++]; } } speech_tools/java/common/cstr/util/Makefile0000644000076400007640000000534007262605664017501 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME=java/common/cstr/util BUILD_DIRS = JAVA_CLASSES = SparseArray LongHash Featured Named Keyed \ TraceStream Trace Painter ImagePainter PaintPainter PaintCache \ BadValueException EnumValues Enum FILES = Makefile $(JAVA_CLASSES:=.java) ALL = .java -include ../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/util/SparseArray.java0000644000076400007640000000734707262605664021151 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Feb 17 1998 \\ // -------------------------------------------------------------------- \\ // An array with only a few entries. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util ; import java.lang.*; import java.util.*; import java.awt.*; public class SparseArray { int [] keys; Object [] vals; int used; int size; public SparseArray(int initn) { used=0; size = initn; keys = new int[size]; vals = new Object[size]; } public SparseArray() { this(10); } public void put(int n, Object v) { for(int i=0; i>4)%l); } private final class LongBucket { long key; Object value; LongBucket next; public LongBucket(long k, Object v, LongBucket n) { key=k; value=v; next=n; } } } speech_tools/java/common/cstr/util/Featured.java0000644000076400007640000000554707262605664020454 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Interface just for something with a name. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util; import java.lang.*; public interface Featured { public String getFeature(String n); } speech_tools/java/common/cstr/util/Named.java0000644000076400007640000000557507262605664017742 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Interface just for something with a name. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util; import java.lang.*; public interface Named { public String getName(); public void setName(String Name); } speech_tools/java/common/cstr/util/Keyed.java0000644000076400007640000000553107262605664017747 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Interface just for something with a unique key. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util; import java.lang.*; public interface Keyed { public Object getKey(); } speech_tools/java/common/cstr/util/TraceStream.java0000644000076400007640000001004507262605664021114 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // A single stream of trace output. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util ; import java.lang.*; import java.util.*; import java.awt.*; // Record for a single stream public final class TraceStream { protected String name; protected boolean off; protected boolean bol; protected Vector saved; public TraceStream(String n) { this(n, false, false); } public TraceStream(String n, boolean o, boolean s) { name=n; setOn(o); setSave(s); bol=true; Trace.streams.put(name, this); } public void setOn(boolean o) { off=!o; } public void setSave(boolean s) { if (s && saved==null) saved=new Vector(5); if (!s && saved != null) { Vector pending=saved; saved=null; for(int i=0; iThread.MIN_PRIORITY && p < op) //threads[ti].setPriority(p+1); if (p>max) { max=p; maxi=ti; } } if (maxi>=0) { // System.out.println("top="+maxi+"="+topPriority); threads[maxi].setPriority(topPriority); } // dumpP(); } } protected synchronized void checkChunk(int i, Graphics g) { if (i Thread.MIN_PRIORITY) // p= topPriority-1; p= Thread.MIN_PRIORITY+1; else p =Thread.MIN_PRIORITY; } else p = topPriority; // p = Thread.MAX_PRIORITY; if (p>=Thread.MIN_PRIORITY) t.setPriority(p); } } // dumpP(); } } } public void paint(Graphics g) { Rectangle r = g.getClipBounds(); int c1 = r.x / chunkSize; int cn = (r.x+r.width) / chunkSize; if (cn >= chunks.length) cn = chunks.length-1; if ( c1 == cn) { checkChunk(c1, g); int ix = r.x % chunkSize; g.drawImage(chunks[c1], r.x, r.y, r.x+r.width, r.y+r.height, ix, r.y, ix+r.width, r.y+r.height, comp); } else { int ix = r.x % chunkSize; int wx = r.x; int w = chunkSize - ix; checkChunk(c1, g); g.drawImage(chunks[c1], wx, r.y, wx+w, r.y+r.height, ix, r.y, ix+w, r.y+r.height, comp); for(int c = c1+1; c < cn; c++) { ix = 0; wx = c * chunkSize; w = chunkSize; checkChunk(c, g); g.drawImage(chunks[c], wx, r.y, wx+w, r.y+r.height, ix, r.y, ix+w, r.y+r.height, comp); } ix = 0; wx = cn * chunkSize; w = (r.x + r.width) % chunkSize; checkChunk(cn, g); g.drawImage(chunks[cn], wx, r.y, wx+w, r.y+r.height, ix, r.y, ix+w, r.y+r.height, comp); } } protected synchronized void blit(Graphics g, int i) { g.setClip(0,0, width, height); if (i=0) values[e.index] = e; } } return values; } } speech_tools/java/common/cstr/util/Enum.java0000644000076400007640000001010307262616577017606 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Simple Enumerated type superclass. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.util ; import java.lang.*; import java.util.*; import java.awt.*; public abstract class Enum { String name; String longName; Object info; int index; abstract public EnumValues getValuesTable(); protected static EnumValues init(String n) { return new EnumValues(n); } protected Enum(String s, String ls, Object o) { setup(s, ls, o); } protected Enum(String s, String ls, boolean real) { setup(s, ls, real?null:Enum.class); } protected void setup(String s, String ls, Object o) { name=s; longName=ls; info=o; EnumValues values = getValuesTable(); index=values.add(this); } protected void alias(String a) { EnumValues values = getValuesTable(); values.add(this, a); } protected static Enum getValue(String s, EnumValues values) throws IllegalArgumentException { return values.getValue(s); } protected static Object getValues(EnumValues values) { return (Object)values.getValues(); } public boolean isReal() { return info != Enum.class; } public String toString() { return name; } public String toString(boolean lng) { return lng?longName:name; } public Object getInfo() { return info; } } speech_tools/java/common/cstr/est/Makefile0000644000076400007640000000515107262605664017317 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME=java/common/cstr/est BUILD_DIRS = awt JAVA_CLASSES = SocketsFile ServerConnection NEED_JAVA = true FILES = Makefile $(JAVA_CLASSES:=.java) ALL = .sub_directories include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/est/SocketsFile.java0000644000076400007640000001167207262605664020742 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Interface to the file in ~/.fringe/ which contains pointers to \\ // running fringe process \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.awt.*; import java.io.*; import java.net.*; public class SocketsFile { protected static Random random = new Random(); protected String filename; public SocketsFile(String fn) { filename=fn; } public String setSocket(String type, String name, ServerSocket s) throws IOException { int port = s.getLocalPort(); int cookie = random.nextInt(); InetAddress address = s.getInetAddress(); Properties props = new Properties(); try { InputStream is = new FileInputStream(filename); props.load(is); } catch (IOException ex) { } props.put(name+".type", type); props.put(name+".host", address.getHostName()); props.put(name+".address", address.getHostAddress()); props.put(name+".cookie", Integer.toString(cookie)); props.put(name+".port", Integer.toString(port)); OutputStream os = new FileOutputStream(filename); props.save(os, "Fringe Sockets"); return Integer.toString(cookie); } protected static void sendCookie(Socket s, String cookie) { try { Writer w = new OutputStreamWriter(s.getOutputStream()); w.write("//"); w.write(cookie); w.write("\n"); w.flush(); } catch (IOException ex) { } } public Socket getSocket(String myType, String name) throws IOException { Socket s=null; Properties props = new Properties(); InputStream is = new FileInputStream(filename); props.load(is); String type = props.getProperty(name+".type"); String hostname = props.getProperty(name+".host"); String address = props.getProperty(name+".address"); String portStr = props.getProperty(name+".port"); String cookieStr = props.getProperty(name+".cookie"); if (!myType.equals(type)) return null; if (address != null && portStr != null) { int port = Integer.parseInt(portStr); s = new Socket(address, port); } if (s != null && cookieStr !=null && !cookieStr.equals("none")) sendCookie(s, cookieStr); return s; } } speech_tools/java/common/cstr/est/ServerConnection.java0000644000076400007640000001124107262605664022005 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Wrapper around a socket which is connected to Fringe. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.io.*; import java.net.*; public class ServerConnection { private static String command_term = "//End//"; private static String result_term = "//End//"; private Socket s; private BufferedReader reader; private BufferedWriter writer; public ServerConnection(Socket sk) throws IOException { setSocket(sk); } public void setSocket(Socket sk) throws IOException { s=sk; try { if (s == null) throw new IOException("no socket"); Reader r = new InputStreamReader(s.getInputStream()); reader = new BufferedReader(r); Writer w = new OutputStreamWriter(s.getOutputStream()); writer = new BufferedWriter(w); } catch (IOException e) { reader=null; writer=null; throw e; } } protected String readResult() throws IOException { while (true) { StringBuffer res = new StringBuffer(100); String status = null; while (true) { String line = reader.readLine(); if (line.startsWith(result_term)) { status = line.substring(result_term.length()); break; } res.append(line); } if (status.equals("OK")) return res.toString(); else if (status.equals("ERROR")) return "!"+res.toString(); else if (status.equals("VAL")) System.err.println("Warning, intermediate value '"+res.toString()+"'"); else throw new IOException("Uknknown value type "+status); } } public String sendCommand(String command) throws IOException { writer.write(command, 0, command.length()); writer.newLine(); writer.write(command_term, 0, command_term.length()); writer.newLine(); writer.flush(); String result = readResult(); return result; } public String sendCommand(StringBuffer command) throws IOException { return sendCommand(command.toString()); } } speech_tools/java/common/cstr/est/awt/Item_Content_Window.java0000644000076400007640000000750507262616577023246 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Window which displays an Item_Content object. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est.awt ; import java.lang.*; import java.util.*; import java.awt.*; import cstr.est.*; public class Item_Content_Window extends Container { protected Item_Content content; protected Item item; public Item_Content_Window(Item_Content cont) { super(); setLayout(new GridLayout(0,2)); content=cont; item=cont.getItem(); update(); } public void update() { removeAll(); if (content != null) { String [] names = getFeatureNames(content); Label l; for(int i=0; inlines?nlines:height-l; System.out.println("g"); wave.cpp_getScanlines(channel, line, l, n, x, chunk, width, height, amplitude); System.out.println("s"); sendLine(line, l, n); } System.out.println("end send"); sendComplete(ImageConsumer.STATICIMAGEDONE); System.out.println("end prod"); } } speech_tools/java/common/cstr/est/awt/Makefile0000644000076400007640000000523407262605664020114 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../../.. DIRNAME = java/common/cstr/est/awt BUILD_DIRS = JAVA_CLASSES = Item_Content_Window WaveImageSource NEED_JAVA = true FILES = $(JAVA_CLASSES:%=%.java) Makefile ALL = .java .buildlib -include ../../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/testPrograms/Makefile0000644000076400007640000000516407262605664021222 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME=java/common/cstr/testPrograms BUILD_DIRS = JAVA_CLASSES = WaveTest PlayWave NEED_JAVA=1 FILES = Makefile $(JAVA_CLASSES:=.java) ALL = .java -include ../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/common/cstr/testPrograms/WaveTest.java0000644000076400007640000001217107262605664022163 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Friday 12th September 1997 \\ // -------------------------------------------------------------------- \\ // Simple test program to see if wave class works. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.testPrograms; import java.awt.*; import java.util.*; import java.awt.event.*; import java.awt.image.*; import java.lang.*; import java.io.*; import cstr.awt.*; import cstr.est.*; import cstr.est.awt.*; public class WaveTest { public static void useage(String com) { System.out.println("Useage: WaveTest FILENAME " + com); System.exit(1); } public static int save(Wave wv, int pos, String[] args) { if (args.length - pos <3) useage("save NEWFILENAME FORMAT"); try { wv.save(args[pos+1], args[pos+2]); } catch (IOException e) { System.out.println("Save Error: " + e.getMessage()); System.exit(1); } return 3; } public static int display(Wave wv, int pos, String[] args) { if (args.length - pos <1) useage("display"); ImageProducer prod = new WaveImageSource(wv, 0, 400, 500, 1500, 150); ImageCanvas canvas = new ImageCanvas(prod); ScrollWindow win = new ScrollWindow(wv.name(), canvas, 500, 250); try { win.setVisible(true); } catch (AWTError e) { System.out.println("Exit: " + e.getMessage()); } return 1; } public static int resample(Wave wv, int pos, String[] args) { if (args.length - pos < 2) useage("resample RATE"); int rate=0; try { rate = Integer.decode(args[pos+1]).intValue(); } catch (NumberFormatException e) { System.out.println("Sample rate must be integer > 0 not " + args[pos+1]); System.exit(1); } if (rate <= 0) { System.out.println("Sample rate must be > 0"); System.exit(1); } wv.resample(rate); return 2; } public static void main(String [] args) { System.runFinalizersOnExit(true); Wave wv = new Wave(); if (args.length < 1) { useage("COMMAND {ARGS...} ..."); return; } try { wv.load(args[0]); } catch (FileNotFoundException e) { System.out.println("Load Error: " + e.getMessage()); return; } int pos=1; while (pos < args.length) { if (args[pos].equals("save")) pos += save(wv, pos, args); else if (args[pos].equals("resample")) pos += resample(wv, pos, args); else if (args[pos].equals("display")) pos += display(wv, pos, args); else useage("save/resample/display ..."); } } } speech_tools/java/common/cstr/testPrograms/PlayWave.java0000644000076400007640000000647510121072172022137 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Test program to play waveforms. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.testPrograms; import java.lang.*; import java.util.*; import java.io.*; import java.awt.*; import cstr.est.*; public class PlayWave { public static void main(String [] args) { File file = new File(args[0]); try { Wave wv = new Wave(file); wv.play(); } catch (Exception ex) { System.out.println("Error: "+ex+" "+ex.getMessage()); ex.printStackTrace(); } // If we get here play has finished, but stupid JMF // has left threads running so the *%!%!%!*!* interpreter won't // exit. System.exit(0); } } speech_tools/java/basic_version/Makefile0000644000076400007640000000512007262605664017103 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../.. DIRNAME=java/basic_version FILES = Makefile Makefile.version BUILD_DIRS=cstr NEED_JAVA=true ALL = .sub_directories .javalib include $(TOP)/config/common_make_rules -include Makefile.version speech_tools/java/basic_version/Makefile.version0000644000076400007640000000523307262605664020574 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Suplimental make information for this version CODE_VERSION=basic LOCAL_JAVA_CLASS_LIBRARY=$(TOP)/lib/est_$(CODE_VERSION).jar LOCAL_JAVA_CLASSPATH=$(EST_HOME)/speech_tools/lib/est_$(CODE_VERSION).jar JAVA_TOP_PACK=cstr LOCAL_JAVA_ROOT=$(TOP)/java/$(CODE_VERSION)_version_build speech_tools/java/basic_version/cstr/Makefile0000644000076400007640000000516207262605664020064 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../.. DIRNAME=java/basic_version/cstr ALL_DIRS = est BUILD_DIRS = awt est util testPrograms NEED_JAVA = true FILES = Makefile ALL = .sub_directories -include ../../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/basic_version/cstr/est/Wave.java0000644000076400007640000001402507262605664020762 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not delete. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // A simple java wave class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.net.*; import java.io.*; import sun.applet.*; public class Wave { int rate; int amplitude_cache=-1; short [] data; File fn; public Wave() { data=null; fn=null; } public Wave(byte [] bytes) throws UnsupportedEncodingException { fn=null; if (!parse(bytes)) { throw new UnsupportedEncodingException("Can't create Wave from this bytestream"); } } public Wave(File file) throws UnsupportedEncodingException, IOException { FileInputStream is = new FileInputStream(file); int n=0; byte [] buf = new byte[n]; while (true) { byte [] ibuf = new byte[10240]; int nr = is.read(ibuf, 0, 10240); if (nr == -1) break; if (n==0) { buf = ibuf; n = nr; } else { byte [] nbuf = new byte[n+nr]; for(int i=0; i=0 && d > amplitude_cache) amplitude_cache=d; if (d<0 && -d > amplitude_cache) amplitude_cache=-d; } return amplitude_cache; } public int num_samples() { return data.length; } public void cpp_getScanlines(int c, byte[] line, int lstart, int lnum, int x, int chunk, int width, int height, int amplitude ) { } private File mkFilename() { StringBuffer fn= new StringBuffer(50); fn.append("/tmp/jsapi_"); fn.append(this.toString()); fn.append(".au"); return new File(fn.toString()); } public boolean parse(byte[] bytes) { //clip = new AppletAudioClip(bytes); fn=mkFilename(); try { FileOutputStream os = new FileOutputStream(fn); os.write(bytes); os.close(); } catch (IOException ex) { System.err.println("IO Exception: "+ex.getMessage()); return false; } int magic = (bytes[0] <<24) + (bytes[1] <<16) + (bytes[2] <<8) + bytes[3]; int smagic = (bytes[3] <<24) + (bytes[2] <<16) + (bytes[1] <<8) + bytes[0]; if (magic == 0x2e736e64) { return true; } return false; } public void play() { if (fn != null) { try { String command = "na_play "+fn.toString(); // System.out.println("play command "+command); Process p = Runtime.getRuntime().exec(command); p.waitFor(); } catch (IOException ex) { } catch (InterruptedException ex) { } } } public void stop() { } public void load(String filename) throws FileNotFoundException { throw new FileNotFoundException("Load Not yet Implemented"); } public void save(String filename, String format) throws IOException { throw new IOException("Save Not yet Implemented"); } } speech_tools/java/basic_version/cstr/est/Item_Content.java0000644000076400007640000000777707262616577022475 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Wed Feb 25 1998 \\ // -------------------------------------------------------------------- \\ // Items in a stream. Wrapper around EST_StreamItem. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; public class Item_Content implements Featured { public Item_Content() { this(0L, true); } public Item_Content(long handle) { this(handle, false); } Item_Content(long handle, boolean m) { } protected void finalize() throws Throwable { super.finalize(); } public String name() { return "DUMMY"; } public String getName() { return name(); } public Features getFeatures() { return new Features(); } public Item getItem() { return null; } public String [] featureNames() { return null; } public boolean featurePresent(String n) { return false; } public String getS(String n) { return null; } public String getFeature(String n) { return null; } public float getF(String n) { return (float)0.0; } public float getStartTime() { return (float)0.0; } public float getMidTime() { return (float)0.0; } public float getEndTime() { return (float)0.0; } } speech_tools/java/basic_version/cstr/est/Item.java0000644000076400007640000001072107262605664020755 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Mar 31 1998 \\ // -------------------------------------------------------------------- \\ // Java wrapper around items. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; import java.io.*; public class Item implements Named, Keyed, Featured { public Item() { this(0L, true, null); } public Item(long handle) { this(handle, false, null); } public Item(long handle, Object utterance) { this(handle, false, utterance); } Item(long handle, boolean m, Object from_utterance) { } protected void finalize() throws Throwable { super.finalize(); } protected final Item getItem(long handle) { return null; } public String name() { return null; } public String getName() { return null; } public void setName(String name) { } public final Item_Content getContent() { return null; } public final Object getKey() { return null; } public String getS(String n) { return null; } public String getS(String n, String def) { return def; } public String getFeature(String n) { return null; } public float getF(String n) { return (float)0.0; } public String type() { return null; } public float getStartTime() { return (float)0.0; } public float getMidTime() { return (float)0.0; } public float getEndTime() { return (float)0.0; } public Item next() { return null; } public Item prev() { return null; } public Item up() { return null; } public Item down() { return null; } } speech_tools/java/basic_version/cstr/est/Features.java0000644000076400007640000001005307262616577021640 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Pretended EST_Features class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import cstr.util.*; public class Features implements Featured { String [] cachedFeatureNames; public Features() { this(0L, true); } public Features(long handle) { this(handle, false); } Features(long handle, boolean m) { } protected void finalize() throws Throwable { super.finalize(); } public String [] names() { if (cachedFeatureNames ==null) cachedFeatureNames = new String [0]; return cachedFeatureNames; } public void getPaths(String prefix, Vector names, boolean paths, boolean leaves) { } public boolean present(String n) { return false; } public String getS(String n) { return ""; } public String getS(String n, String def) { return def; } public String getFeature(String n) { return ""; } public float getF(String n) { return (float)0.0; } public float getF(String n, float def) { return def; } public Object get(String n) { return null; } public Object get(String n, Object def) { return def; } public void set(String n, float val) { } public void set(String n, String val) { } static { } } speech_tools/java/basic_version/cstr/est/Makefile0000644000076400007640000000570707262616577020671 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME = java/basic_version/cstr/est JUST_BUILD_DIRS = awt ALL_DIRS = LOCAL_JAVA_NATIVE_CLASSES = JAVA_NATIVE_CLASSES =$(LOCAL_JAVA_NATIVE_CLASSES) LOCAL_JAVA_CLASSES = $(LOCAL_JAVA_NATIVE_CLASSES) Wave Item_Content Item Features JAVA_CLASSES = $(LOCAL_JAVA_CLASSES) SocketsFile ServerConnection CPPSRCS = $(JAVA_NATIVE_CLASSES:%=%.cc) SRCS = $(CPPSRCS) OBJS_estjava = $(SRCS:.cc=.o) FILES = $(LOCAL_JAVA_CLASSES:%=%.java) $(LOCAL_JAVA_NATIVE_CLASSES:%=%.cc) Makefile ALL = .java -include ../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/cpp_version/Makefile0000644000076400007640000000511607262605664016611 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../.. DIRNAME=java/cpp_version FILES = Makefile Makefile.version BUILD_DIRS=cstr NEED_JAVA=true ALL = .sub_directories .javalib include $(TOP)/config/common_make_rules -include Makefile.version speech_tools/java/cpp_version/Makefile.version0000644000076400007640000000523107262605664020273 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Suplimental make information for this version CODE_VERSION=cpp LOCAL_JAVA_CLASS_LIBRARY=$(TOP)/lib/est_$(CODE_VERSION).jar LOCAL_JAVA_CLASSPATH=$(EST_HOME)/speech_tools/lib/est_$(CODE_VERSION).jar JAVA_TOP_PACK=cstr LOCAL_JAVA_ROOT=$(TOP)/java/$(CODE_VERSION)_version_build speech_tools/java/cpp_version/cstr/Makefile0000644000076400007640000000516107262605664017564 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../.. DIRNAME=java/cpp_version/cstr ALL_DIRS = est BUILD_DIRS = awt est util testPrograms NEED_JAVA = true FILES = Makefile ALL = .sub_directories -include ../../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/cpp_version/cstr/est/Wave.cc0000644000076400007640000002470107262616577020136 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Wave. */ /* */ /*************************************************************************/ #include #include #include "jni_Wave.h" #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_audio.h" #include "EST_inline_utils.h" static jobject wave_class; static jfieldID handle_field; static inline short abs(short s) { return s>=0?s:-s; } static EST_Option wave_play_ops; JNIEXPORT jboolean JNICALL Java_cstr_est_Wave_initialise_1cpp (JNIEnv *env, jclass myclass) { wave_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Wave_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Wave_create_1cpp_1wave(JNIEnv *env, jobject self) { EST_Wave *wave = new EST_Wave; env->SetLongField(self, handle_field, (jlong)wave); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Wave_destroy_1cpp_1wave (JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); delete wave; return 1; } JNIEXPORT jstring JNICALL Java_cstr_est_Wave_cpp_1name (JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return env->NewStringUTF(wave->name()); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1setName (JNIEnv *env, jobject self, jstring jname) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); const char *name=env->GetStringUTFChars(jname, 0); wave->set_name(name); env->ReleaseStringUTFChars(jname, name); } JNIEXPORT jstring JNICALL Java_cstr_est_Wave_cpp_1load (JNIEnv *env, jobject self, jstring jfilename) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *res = ""; EST_read_status stat = wave->load(filename); env->ReleaseStringUTFChars(jfilename, filename); if (stat == read_format_error) res = "wave format error"; else if (stat == read_error) res = "wave load error"; return env->NewStringUTF(res); } JNIEXPORT jstring JNICALL Java_cstr_est_Wave_cpp_1save (JNIEnv *env, jobject self, jstring jfilename, jstring jformat) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *format = env->GetStringUTFChars(jformat, 0); const char *res = ""; EST_write_status stat = wave->save(filename, format); env->ReleaseStringUTFChars(jfilename, filename); env->ReleaseStringUTFChars(jformat, format); if (stat == write_error) res = "wave save error"; return env->NewStringUTF(res); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1resample (JNIEnv *env, jobject self, jint rate) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); wave->resample(rate); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1set_1play_1ops(JNIEnv *env, jclass myclass, jstring jprotocol, jstring jcommand, jstring jserver ) { (void)myclass; const char *protocol = env->GetStringUTFChars(jprotocol, 0); const char *command = env->GetStringUTFChars(jcommand, 0); const char *server = env->GetStringUTFChars(jserver, 0); if (*protocol) wave_play_ops.add_item("-p",protocol); if (*command) wave_play_ops.add_item("-command",command); if (*server) wave_play_ops.add_item("-display",server); wave_play_ops.add_item("-otype","riff"); env->ReleaseStringUTFChars(jprotocol, protocol); env->ReleaseStringUTFChars(jcommand, command); env->ReleaseStringUTFChars(jserver, server); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1play (JNIEnv *env, jobject self, jfloat start_t, jfloat end_t) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); EST_Wave wv; int start = (int)(start_t * wave->sample_rate() + 0.5); int end = (int)(end_t * wave->sample_rate() + 0.5); wave_subwave(wv, *wave, start, end-start); // EST_write_status st = wv.save("/tmp/est_java_wave", "nist"); play_wave(wv, wave_play_ops); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1play_1all (JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); play_wave(*wave, wave_play_ops); } JNIEXPORT jint JNICALL Java_cstr_est_Wave_cpp_1num_1channels(JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return wave->num_channels(); } JNIEXPORT jint JNICALL Java_cstr_est_Wave_cpp_1num_1samples(JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return wave->num_samples(); } JNIEXPORT jint JNICALL Java_cstr_est_Wave_cpp_1sample_1rate(JNIEnv *env, jobject self) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return wave->sample_rate(); } JNIEXPORT jint JNICALL Java_cstr_est_Wave_cpp_1amplitude(JNIEnv *env, jobject self, jint c) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); short a=0; for(int i=0; inum_samples(); i++) { short p = wave->a(i,c); if (abs(p) > a) a=abs(p); } return a; } JNIEXPORT jint JNICALL Java_cstr_est_Wave_a__II(JNIEnv *env, jobject self, jint x, jint c) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return wave->a(x,c); } JNIEXPORT jint JNICALL Java_cstr_est_Wave_a__FI(JNIEnv *env, jobject self, jfloat t, jint c) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); return wave->a(irint(t*wave->sample_rate()),c); } JNIEXPORT void JNICALL Java_cstr_est_Wave_cpp_1getScanlines(JNIEnv *env, jobject self, jint c, jbyteArray line, jint lstart, jint lnum, jint xoff, jint chunk, jint width, jint height, jint amp) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); jbyte *pixels = env->GetByteArrayElements(line, 0); int num_samples = wave->num_samples(); short *data = wave->values().memory(); int channels = wave->num_channels(); for(int l=lstart; lmin && la <=max)|| (la > min && a <=max)) fl++; la=a; } lpixels[i-xoff] = fl<5?fl:4; from=to; } } } JNIEXPORT jint JNICALL Java_cstr_est_Wave_cpp_1getMin(JNIEnv *env, jobject self, jint c, jint x1, jint x2) { EST_Wave *wave = (EST_Wave *) env->GetLongField(self, handle_field); int minv=64000; if (x1<0) x1 = 0; if (x2>wave->num_samples()) x2 = wave->num_samples(); for(int x=x1; xa(x,c); if (vGetLongField(self, handle_field); int maxv=-64000; if (x1<0) x1 = 0; if (x2>wave->num_samples()) x2 = wave->num_samples(); for(int x=x1; xa(x, c); if (v>maxv) maxv=v; } return maxv; } speech_tools/java/cpp_version/cstr/est/Track.cc0000644000076400007640000002206510330403606020252 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface Between Java And C++ For Est_Track. */ /* */ /*************************************************************************/ #include #include "jni_Track.h" #include "EST_Track.h" #include "EST_track_aux.h" static jobject track_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } static jint frame_before(EST_Track *track, jfloat t) { if (track->equal_space()) { float s = track->shift(); int f = (int)(t/s)-1; if (f<0) f=0; // fprintf(stderr, "fb t=%f s=%f f=%d\n", t, s, f); return f; } else { int f=0; for(int i=0; inum_frames(); f=i++) if (track->t(i)>=t) break; return f; } } static jint frame_after(EST_Track *track, jfloat t) { if (track->equal_space()) { float s = track->shift(); int f = (int)(t/s)+1; if (f>track->num_frames()) f=track->num_frames(); // fprintf(stderr, "fa t=%f s=%f f=%d\n", t, s, f); return f; } else { int i; for(i=0; inum_frames(); i++) if (track->t(i)>=t) break; return i; } } JNIEXPORT jboolean JNICALL Java_cstr_est_Track_initialise_1cpp (JNIEnv *env, jclass myclass) { track_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Track_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Track_create_1cpp_1track(JNIEnv *env, jobject self) { EST_Track *track = new EST_Track; // printf("create track %p\n", track); env->SetLongField(self, handle_field, (jlong)track); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Track_destroy_1cpp_1track (JNIEnv *env, jobject self) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); // printf("destroy track %p\n", track); delete track; return 1; } JNIEXPORT jstring JNICALL Java_cstr_est_Track_cpp_1name (JNIEnv *env, jobject self) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return env->NewStringUTF(track->name()); } JNIEXPORT jstring JNICALL Java_cstr_est_Track_cpp_1load (JNIEnv *env, jobject self, jstring jfilename) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *res = ""; EST_read_status stat = track->load(filename); env->ReleaseStringUTFChars(jfilename, filename); if (stat == read_format_error) res = "track format error"; else if (stat == read_error) res = "track load error"; return env->NewStringUTF(res); } JNIEXPORT jstring JNICALL Java_cstr_est_Track_cpp_1save (JNIEnv *env, jobject self, jstring jfilename, jstring jformat, jfloat start, jfloat end) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *format = env->GetStringUTFChars(jformat, 0); const char *res = ""; int sframe = frame_before(track, start); int eframe = frame_after(track, end); EST_Track segment; track->sub_track(segment, sframe, eframe-sframe, 0, EST_ALL); EST_write_status stat = segment.save(filename, format); env->ReleaseStringUTFChars(jfilename, filename); env->ReleaseStringUTFChars(jformat, format); if (stat == write_error) res = "track save error"; return env->NewStringUTF(res); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1num_1frames(JNIEnv *env, jobject self) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->num_frames(); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1num_1channels(JNIEnv *env, jobject self) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->num_channels(); } JNIEXPORT jfloat JNICALL Java_cstr_est_Track_cpp_1getEndTime(JNIEnv *env, jobject self) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); int f = track->num_frames()-1; return f>=0?track->t(f):0.0; } JNIEXPORT jstring JNICALL Java_cstr_est_Track_cpp_1channelName(JNIEnv *env, jobject self, jint i) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); EST_String cname(i>=0 && i < track->num_channels() ?track->channel_name(i) :EST_String::Empty); return env->NewStringUTF(cname); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1channelPosition(JNIEnv *env, jobject self, jstring jname) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); int p = track->channel_position(name); env->ReleaseStringUTFChars(jname, name); return p; } JNIEXPORT jfloat JNICALL Java_cstr_est_Track_a__II(JNIEnv *env, jobject self, jint f, jint c) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->a((int)f,(int)c); } JNIEXPORT jfloat JNICALL Java_cstr_est_Track_a__FI(JNIEnv *env, jobject self, jfloat t, jint c) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->a((float)t,(int)c); } JNIEXPORT jfloat JNICALL Java_cstr_est_Track_cpp_1t(JNIEnv *env, jobject self, jint f) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->t((int)f); } JNIEXPORT jboolean JNICALL Java_cstr_est_Track_cpp_1val(JNIEnv *env, jobject self, jint f) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->val((int)f); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1frameBefore(JNIEnv *env, jobject self, jfloat t) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return frame_before(track, t); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1frameAfter(JNIEnv *env, jobject self, jfloat t) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return frame_after(track, t); } JNIEXPORT jint JNICALL Java_cstr_est_Track_cpp_1frameNearest(JNIEnv *env, jobject self, jfloat t) { EST_Track *track = (EST_Track *) env->GetLongField(self, handle_field); return track->index(t); } speech_tools/java/cpp_version/cstr/est/Utterance.cc0000644000076400007640000001657610330403606021152 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Utterance. */ /* */ /*************************************************************************/ #include #include "jni_Utterance.h" #include "ling_class/EST_Utterance.h" static jobject utterance_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Utterance_initialise_1cpp (JNIEnv *env, jclass myclass) { utterance_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Utterance_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Utterance_create_1cpp_1utterance(JNIEnv *env, jobject self) { EST_Utterance *utterance = new EST_Utterance; // printf("create utterance %p\n", utterance); env->SetLongField(self, handle_field, (jlong)utterance); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Utterance_destroy_1cpp_1utterance (JNIEnv *env, jobject self) { EST_Utterance *utterance = (EST_Utterance *) env->GetLongField(self, handle_field); // printf("destroy utterance %p\n", utterance); if (utterance) delete utterance; return 1; } JNIEXPORT jint JNICALL Java_cstr_est_Utterance_cpp_1num_1relations(JNIEnv *env, jobject self) { EST_Utterance *utterance = (EST_Utterance *)env->GetLongField(self, handle_field); return utterance->num_relations(); } JNIEXPORT jboolean JNICALL Java_cstr_est_Utterance_cpp_1has_1relation(JNIEnv *env, jobject self, jstring jname) { EST_Utterance *utterance = (EST_Utterance *)env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); bool has = utterance->relation_present(name); env->ReleaseStringUTFChars(jname, name); return has; } JNIEXPORT jlong JNICALL Java_cstr_est_Utterance_cpp_1relation_1n(JNIEnv *env, jobject self, jint n) { EST_Utterance *utterance = (EST_Utterance *)env->GetLongField(self, handle_field); EST_Relation * rel=NULL; EST_Features::Entries p; for(p.begin(utterance->relations); p && n>0; ++p,n--) ; if (n==0) rel = relation(p->v); return (jlong)rel; } JNIEXPORT jlong JNICALL Java_cstr_est_Utterance_cpp_1relation(JNIEnv *env, jobject self, jstring jname) { EST_Utterance *utterance = (EST_Utterance *)env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); if (!utterance->relation_present(name)) return (jlong)0l; EST_Relation * rel = utterance->relation(name); env->ReleaseStringUTFChars(jname, name); return (jlong)rel; } JNIEXPORT jlong JNICALL Java_cstr_est_Utterance_cpp_1create_1relation(JNIEnv *env, jobject self, jstring jname) { EST_Utterance *utterance = (EST_Utterance *)env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); if (utterance->relation_present(name)) return (jlong)0l; EST_Relation * rel = utterance->create_relation(name); env->ReleaseStringUTFChars(jname, name); return (jlong)rel; } JNIEXPORT jstring JNICALL Java_cstr_est_Utterance_cpp_1load (JNIEnv *env, jobject self, jstring jfilename) { EST_Utterance *utterance = (EST_Utterance *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); EST_String fn(filename); EST_read_status stat = read_ok; CATCH_ERRORS() { env->ReleaseStringUTFChars(jfilename, filename); return env->NewStringUTF(EST_error_message); } stat = utterance->load(fn); END_CATCH_ERRORS(); env->ReleaseStringUTFChars(jfilename, filename); const char *res = ""; if (stat == read_format_error) res = "utterance format error"; else if (stat != read_ok) res = "utterance load error"; return env->NewStringUTF(res); } JNIEXPORT jstring JNICALL Java_cstr_est_Utterance_cpp_1save (JNIEnv *env, jobject self, jstring jfilename, jstring jformat) { const EST_Utterance *utterance = (EST_Utterance *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *format = env->GetStringUTFChars(jformat, 0); const char *res = ""; EST_write_status stat = format[0]=='\0' ? utterance->save(filename) : utterance->save(filename,format); env->ReleaseStringUTFChars(jfilename, filename); env->ReleaseStringUTFChars(jformat, format); if (stat == write_error) res = "utterance save error"; return env->NewStringUTF(res); } speech_tools/java/cpp_version/cstr/est/Relation.cc0000644000076400007640000001763211465017155021001 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Relation. */ /* */ /*************************************************************************/ #include #include "jni_Relation.h" #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" static jobject relation_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Relation_initialise_1cpp (JNIEnv *env, jclass myclass) { relation_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Relation_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Relation_create_1cpp_1relation(JNIEnv *env, jobject self, jlong handle ) { EST_Relation *relation =(handle == 0L ? (new EST_Relation) : (EST_Relation *)handle ); // printf("create relation %p\n", relation); env->SetLongField(self, handle_field, (jlong)relation); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Relation_destroy_1cpp_1relation (JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); // printf("destroy relation %p\n", relation); delete relation; return 1; } JNIEXPORT jstring JNICALL Java_cstr_est_Relation_cpp_1name(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); return env->NewStringUTF(relation->name()); } JNIEXPORT jstring JNICALL Java_cstr_est_Relation_cpp_1getFeature (JNIEnv *env, jobject self, jstring jn) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); const char *n = env->GetStringUTFChars(jn, 0); const char *v = (relation->f.present(n) ? (const char *)relation->f.S(n) : ""); env->ReleaseStringUTFChars(jn, n); return env->NewStringUTF(v); } JNIEXPORT jstring JNICALL Java_cstr_est_Relation_cpp_1type(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item * hd = relation->head(); const char *type; if (!hd) type = "empty"; else { type = "linear"; while (hd) { if (hd->up() || hd->down()) { type = "tree"; break; } hd=hd->next(); } } return env->NewStringUTF(type); } JNIEXPORT jstring JNICALL Java_cstr_est_Relation_cpp_1load (JNIEnv *env, jobject self, jstring jfilename) { EST_Relation *stream = (EST_Relation *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *res = ""; EST_read_status stat = stream->load(filename); env->ReleaseStringUTFChars(jfilename, filename); if (stat == read_format_error) res = "stream format error"; else if (stat == read_error) res = "stream load error"; return env->NewStringUTF(res); } JNIEXPORT jstring JNICALL Java_cstr_est_Relation_cpp_1save (JNIEnv *env, jobject self, jstring jfilename, jstring jformat) { EST_Relation *stream = (EST_Relation *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *format = env->GetStringUTFChars(jformat, 0); const char *res = ""; EST_write_status stat = stream->save(filename); env->ReleaseStringUTFChars(jfilename, filename); env->ReleaseStringUTFChars(jformat, format); if (stat == write_error) res = "stream save error"; return env->NewStringUTF(res); } JNIEXPORT jlong JNICALL Java_cstr_est_Relation_cpp_1head(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item *item = relation->head(); return (long)item; } JNIEXPORT jlong JNICALL Java_cstr_est_Relation_cpp_1tail(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item * item = relation->tail(); return (long)item; } JNIEXPORT jlong JNICALL Java_cstr_est_Relation_cpp_1append(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item * item = relation->append(); return (long)item; } JNIEXPORT void JNICALL Java_cstr_est_Relation_cpp_1removeItemList(JNIEnv *env, jobject self, jlong ihandle ) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item * item = (EST_Item *)ihandle; remove_item_list(relation, item); } JNIEXPORT jlong JNICALL Java_cstr_est_Relation_cpp_1findItem(JNIEnv *env, jobject self, jfloat time) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item * item = relation->head(); while (item!=NULL && item->F("end", 0.0) < time) item = item->next(); return (long)item; } JNIEXPORT jfloat JNICALL Java_cstr_est_Relation_cpp_1getEndTime(JNIEnv *env, jobject self) { EST_Relation *relation = (EST_Relation *) env->GetLongField(self, handle_field); EST_Item *item = relation->tail(); return item?item->F("end",0.0):0.0; } speech_tools/java/cpp_version/cstr/est/Item.cc0000644000076400007640000002071610330403606020105 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Item. */ /* */ /*************************************************************************/ #include #include "jni_Item.h" #include "ling_class/EST_Item.h" #include "ling_class/EST_item_aux.h" static jobject item_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_initialise_1cpp (JNIEnv *env, jclass myclass) { item_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_create_1cpp_1item(JNIEnv *env, jobject self, jlong handle ) { EST_Item *item =(handle == 0L ? (new EST_Item) : (EST_Item *)handle ); // printf("create item %p\n", item); env->SetLongField(self, handle_field, (jlong)item); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_destroy_1cpp_1item (JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); // printf("destroy item %p\n", item); delete item; return 1; } JNIEXPORT jstring JNICALL Java_cstr_est_Item_cpp_1name(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); EST_String name = item->name(); return env->NewStringUTF(name); } JNIEXPORT jstring JNICALL Java_cstr_est_Item_cpp_1getS(JNIEnv *env, jobject self, jstring jname, jstring jdef) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); EST_feat_status status=efs_ok; // cout << "GetS " << name << "\n"; EST_String val= ""; val = getString(*item, name, EST_String::Empty, status); // cout << "ReleaseStringUTFChars(jname, name); if (status != efs_ok) return jdef; // cout << "return\n"; return env->NewStringUTF(val); } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_cpp_1getF(JNIEnv *env, jobject self, jstring jname, jfloat def) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); EST_feat_status status=efs_ok; float val = getFloat(*item, name, def, status); env->ReleaseStringUTFChars(jname, name); return val; } JNIEXPORT void JNICALL Java_cstr_est_Item_cpp_1set__Ljava_lang_String_2F(JNIEnv *env, jobject self, jstring jname, jfloat val) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); item->set(name, val); env->ReleaseStringUTFChars(jname, name); } JNIEXPORT void JNICALL Java_cstr_est_Item_cpp_1set__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject self, jstring jname, jstring jval) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); const char *val = env->GetStringUTFChars(jval, 0); item->set(name, val); env->ReleaseStringUTFChars(jname, name); env->ReleaseStringUTFChars(jval, val); } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_cpp_1getStartTime(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return item?start(*item):0.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_cpp_1getMidTime(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return item?mid(*item):0.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_cpp_1getTime(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return item?time(*item):0.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_cpp_1getEndTime(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return item?end(*item):0.0; } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1getContent(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); EST_Item_Content *itemc = item->contents(); return (long)itemc; } JNIEXPORT jstring JNICALL Java_cstr_est_Item_cpp_1type(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); const char *type; if (parent(item) != NULL || daughter1(item) != NULL) type = "tree"; else type = "linear"; return env->NewStringUTF(type); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1next(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->next(); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1prev(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->prev(); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1up(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->up(); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1down(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->down(); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1insert_1after(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->insert_after(); } JNIEXPORT jlong JNICALL Java_cstr_est_Item_cpp_1insert_1before(JNIEnv *env, jobject self) { EST_Item *item = (EST_Item *) env->GetLongField(self, handle_field); return (long)item->insert_before(); } speech_tools/java/cpp_version/cstr/est/Item_Content.cc0000644000076400007640000002745410330403606021605 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Item_Content. */ /* */ /*************************************************************************/ #include #include "jni_Item_Content.h" #include "ling_class/EST_Item_Content.h" #include "ling_class/EST_item_content_aux.h" #include "ling_class/EST_item_aux.h" #include "ling_class/EST_Relation.h" static jclass features_class; static jmethodID features_cons; static jclass string_class; static jclass float_class; static jmethodID float_cons; static jclass int_class; static jmethodID int_cons; static jobject itemContent_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_1Content_initialise_1cpp (JNIEnv *env, jclass myclass) { itemContent_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } features_class = (jclass)env->NewGlobalRef(env->FindClass("cstr/est/Features")); features_cons = env->GetMethodID(features_class, "", "(J)V"); if (!features_cons) { printf("can't find features_cons!\n"); return 0; } string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); float_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Float")); float_cons = env->GetMethodID(float_class, "", "(F)V"); if (!float_cons) { printf("can't find float_cons!\n"); return 0; } int_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Integer")); int_cons = env->GetMethodID(int_class, "", "(I)V"); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_1Content_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_1Content_create_1cpp_1itemContent(JNIEnv *env, jobject self, jlong handle ) { EST_Item_Content *itemContent = (handle==0L ? (new EST_Item_Content) : (EST_Item_Content *)handle ); // printf("create itemContent %p\n", itemContent); env->SetLongField(self, handle_field, (jlong)itemContent); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_1Content_destroy_1cpp_1itemContent (JNIEnv *env, jobject self) { EST_Item_Content *itemContent = (EST_Item_Content *) env->GetLongField(self, handle_field); // printf("destroy itemContent %p\n", itemContent); delete itemContent; return 1; } JNIEXPORT jobjectArray JNICALL Java_cstr_est_Item_1Content_cpp_1featureNames (JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); int n; EST_Features::Entries p; n=0; for (p.begin(item->f); p != 0; ++p) n++; jobjectArray names = env->NewObjectArray(n, string_class, NULL); p.beginning(); for(int i=0; iNewStringUTF(p->k); env->SetObjectArrayElement(names, i, fn); ++p; } return names; } JNIEXPORT jlong JNICALL Java_cstr_est_Item_1Content_cpp_1getItem__(JNIEnv *env, jobject self) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); if (item_c->relations.length() == 0) return 0L; EST_Litem *p; p = item_c->relations.list.head(); EST_Item *i = item(item_c->relations.list(p).v); return (long)i; } JNIEXPORT jlong JNICALL Java_cstr_est_Item_1Content_cpp_1getItem__Ljava_lang_String_2(JNIEnv *env, jobject self, jstring jrelName) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); const char * relName = env->GetStringUTFChars(jrelName, 0); EST_Item *i = item_c->Relation(relName); env->ReleaseStringUTFChars(jrelName, relName); return (long)i; } JNIEXPORT jlong JNICALL Java_cstr_est_Item_1Content_cpp_1getItem__J(JNIEnv *env, jobject self, jlong relh) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); EST_Relation *rel = (EST_Relation *)relh; EST_Item *i = item_c->Relation(rel->name()); return (long)i; } JNIEXPORT jstring JNICALL Java_cstr_est_Item_1Content_cpp_1getS(JNIEnv *env, jobject self, jstring jname, jstring jdef, jlong relHandle) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); EST_Relation *rel = (EST_Relation *)relHandle; const char *name = env->GetStringUTFChars(jname, 0); EST_String val; EST_feat_status stat=efs_ok; if (rel != NULL) { // cout << "getS " << name << " in " << rel->name() << "\n"; EST_Item *item = item_c->Relation(rel->name()); val = getString(*item, name, EST_String::Empty, stat); } else { // cout << "getS " << name << " in no relation \n"; val = getString(*item_c, name, EST_String::Empty, stat); } env->ReleaseStringUTFChars(jname, name); if (stat != efs_ok) return jdef; return env->NewStringUTF(val); } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_1Content_cpp_1getF(JNIEnv *env, jobject self, jstring jname, jfloat def, jlong relHandle) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); EST_Relation *rel = (EST_Relation *)relHandle; const char *name = env->GetStringUTFChars(jname, 0); float val; EST_feat_status stat=efs_ok; if (rel != NULL) { EST_Item *item = item_c->Relation(rel->name()); val = getFloat(*item, name, def, stat); } else val = getFloat(*item_c, name, def, stat); env->ReleaseStringUTFChars(jname, name); return val; } JNIEXPORT jobject JNICALL Java_cstr_est_Item_1Content_cpp_1get(JNIEnv *env, jobject self, jstring jname, jobject jdef, jlong relHandle) { EST_Item_Content *item_c = (EST_Item_Content *) env->GetLongField(self, handle_field); EST_Relation *rel = (EST_Relation *)relHandle; const char *name = env->GetStringUTFChars(jname, 0); EST_Val def("hidden"); const EST_Val *val; if (rel != NULL) { EST_Item *item = item_c->Relation(rel->name()); val = &(item->f(name, def)); } else val = &(item_c)->f(name, def); env->ReleaseStringUTFChars(jname, name); if (&def == val) { //fprintf(stderr, "get %s =%s\n", name, "def"); return jdef; } jobject jval; val_type t = val->type(); //fprintf(stderr, "get %s =%s (%s)\n", name, (const char *)val->S(), t); if (t==val_type_feats) { jval = env->NewObject(features_class, features_cons, (jlong)feats(*val)); } else if (t==val_float) { jval = env->NewObject(float_class, float_cons, (jfloat)val->F()); } else if (t==val_int) { jval = env->NewObject(int_class, int_cons, (jint)val->I()); } else { jval = env->NewStringUTF(val->S()); } return jval; } JNIEXPORT void JNICALL Java_cstr_est_Item_1Content_cpp_1set__Ljava_lang_String_2F(JNIEnv *env, jobject self, jstring jname, jfloat val) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); item->f.set(name, val); env->ReleaseStringUTFChars(jname, name); } JNIEXPORT void JNICALL Java_cstr_est_Item_1Content_cpp_1set__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject self, jstring jname, jstring jval) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); const char *val = env->GetStringUTFChars(jval, 0); item->f.set(name, val); env->ReleaseStringUTFChars(jname, name); env->ReleaseStringUTFChars(jval, val); } JNIEXPORT jboolean JNICALL Java_cstr_est_Item_1Content_cpp_1featurePresent(JNIEnv *env, jobject self, jstring jname) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); int val = item->f.present(name); env->ReleaseStringUTFChars(jname, name); return val; } JNIEXPORT jlong JNICALL Java_cstr_est_Item_1Content_cpp_1getFeatures(JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); return item?(long)(EST_Features *)&(item->f):0L; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_1Content_cpp_1getTime(JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); return item?time(*item):-1.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_1Content_cpp_1getMidTime(JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); return item?mid(*item):-1.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_1Content_cpp_1getStartTime(JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); return item?start(*item):-1.0; } JNIEXPORT jfloat JNICALL Java_cstr_est_Item_1Content_cpp_1getEndTime(JNIEnv *env, jobject self) { EST_Item_Content *item = (EST_Item_Content *) env->GetLongField(self, handle_field); return item?end(*item):-1.0; } speech_tools/java/cpp_version/cstr/est/Sigpr.cc0000644000076400007640000000670307262605664020315 0ustar awbawb /************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996,1997 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */ /* -------------------------------------------------------------------- */ /* Interface to signal processing code. */ /* */ /*************************************************************************/ #include #include #include "jni_Sigpr.h" #include "sigpr/EST_spectrogram.h" #include "sigpr/EST_misc_sigpr.h" JNIEXPORT void JNICALL Java_cstr_est_Sigpr_cpp_1spectrogram(JNIEnv *env, jclass myclass, jlong waveh, jlong trackh, jfloat shift, jfloat length, jint order, jfloat floor, jfloat ceil) { (void)env; (void)myclass; EST_Wave *wave = (EST_Wave *)waveh; EST_Track *sg = (EST_Track *)trackh; EST_Wave pwave; EST_pre_emphasis(*wave, pwave, 0.94); raw_spectrogram(*sg, pwave, length, shift, order); scale_spectrogram(*sg, 1.0, floor, ceil); } speech_tools/java/cpp_version/cstr/est/Features.cc0000644000076400007640000002040610330403606020761 0ustar awbawb /*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1995,1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author: Richard Caley */ /* ------------------------------------------------------------------- */ /* Interface between java and C++ for EST_Features. */ /* */ /*************************************************************************/ #include #include "jni_Features.h" #include "EST_Features.h" static jclass features_class; static jmethodID features_cons; static jclass string_class; static jclass float_class; static jmethodID float_cons; static jclass int_class; static jmethodID int_cons; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Features_initialise_1cpp (JNIEnv *env, jclass myclass) { features_class = (jclass)env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "cpp_handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } features_cons = env->GetMethodID(features_class, "", "(J)V"); if (!features_cons) { printf("can't find features_cons!\n"); return 0; } string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); float_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Float")); float_cons = env->GetMethodID(float_class, "", "(F)V"); if (!float_cons) { printf("can't find float_cons!\n"); return 0; } int_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Integer")); int_cons = env->GetMethodID(int_class, "", "(I)V"); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Features_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Features_create_1cpp_1features(JNIEnv *env, jobject self, jlong handle ) { EST_Features *features = (handle==0L ? (new EST_Features) : (EST_Features *)handle ); // printf("create features %p\n", features); env->SetLongField(self, handle_field, (jlong)features); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Features_destroy_1cpp_1features (JNIEnv *env, jobject self) { EST_Features *features = (EST_Features *) env->GetLongField(self, handle_field); // printf("destroy features %p\n", features); delete features; return 1; } JNIEXPORT jobjectArray JNICALL Java_cstr_est_Features_cpp_1featureNames (JNIEnv *env, jobject self) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); int n; EST_Features::Entries p; n=0; for (p.begin(*f); p != 0; ++p) n++; jobjectArray names = env->NewObjectArray(n, string_class, NULL); p.beginning(); for(int i=0; iNewStringUTF(p->k); env->SetObjectArrayElement(names, i, fn); ++p; } return names; } JNIEXPORT jstring JNICALL Java_cstr_est_Features_cpp_1getS(JNIEnv *env, jobject self, jstring jname, jstring jdef) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); EST_Val def; const EST_Val &val = f->val_path(name, def); env->ReleaseStringUTFChars(jname, name); if (&def == &val) return jdef; return env->NewStringUTF(val.S()); } JNIEXPORT jfloat JNICALL Java_cstr_est_Features_cpp_1getF(JNIEnv *env, jobject self, jstring jname, jfloat def) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); float val = f->F(name, def); env->ReleaseStringUTFChars(jname, name); return val; } JNIEXPORT jobject JNICALL Java_cstr_est_Features_cpp_1get(JNIEnv *env, jobject self, jstring jname, jobject jdef) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); EST_Val def("hidden"); const EST_Val &val = f->val(name, def); env->ReleaseStringUTFChars(jname, name); if (&def == &val) { //fprintf(stderr, "get %s =%s\n", name, "def"); return jdef; } jobject jval; val_type t = val.type(); //fprintf(stderr, "get %s =%s (%s)\n", name, (const char *)val.S(), t); if (t==val_type_feats) { jval = env->NewObject(features_class, features_cons, (jlong)feats(val)); } else if (t==val_float) { jval = env->NewObject(float_class, float_cons, (jfloat)val.F()); } else if (t==val_int) { jval = env->NewObject(int_class, int_cons, (jint)val.I()); } else { jval = env->NewStringUTF(val.S()); } return jval; } JNIEXPORT void JNICALL Java_cstr_est_Features_cpp_1set__Ljava_lang_String_2F(JNIEnv *env, jobject self, jstring jname, jfloat val) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); f->set(name, val); env->ReleaseStringUTFChars(jname, name); } JNIEXPORT void JNICALL Java_cstr_est_Features_cpp_1set__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject self, jstring jname, jstring jval) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); const char *val = env->GetStringUTFChars(jval, 0); f->set(name, val); env->ReleaseStringUTFChars(jname, name); env->ReleaseStringUTFChars(jval, val); } JNIEXPORT jboolean JNICALL Java_cstr_est_Features_cpp_1present(JNIEnv *env, jobject self, jstring jname) { EST_Features *f = (EST_Features *) env->GetLongField(self, handle_field); const char *name = env->GetStringUTFChars(jname, 0); int val = f->present(name); env->ReleaseStringUTFChars(jname, name); return val; } speech_tools/java/cpp_version/cstr/est/Wave.java0000644000076400007640000001501207262605664020460 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Friday 12th September 1997 \\ // -------------------------------------------------------------------- \\ // Wrapper around the EST_Wave class. This is pretty horrible in that \\ // it uses a long to hold a pointer to a wave. There must be a better \\ // way. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.util.*; import java.lang.*; import java.io.*; public class Wave { long cpp_handle; int [] amplitudes; public Wave() { create_cpp_wave(); } public Wave(byte [] bytes) throws UnsupportedEncodingException { if (!parse(bytes)) { throw new UnsupportedEncodingException("Can't create Wave from this bytestream"); } } public Wave(File file) throws UnsupportedEncodingException, IOException { throw new IOException("Can't load from files yet"); } protected void finalize() throws Throwable { destroy_cpp_wave(); super.finalize(); } public long getHandle() { return cpp_handle; } private native String cpp_name(); public String name() { return cpp_name(); } private native void cpp_setName(String name); public void setName(String name) { cpp_setName(name); } public String getName() { return cpp_name(); } private native String cpp_load(String filename); public void load(String filename) throws FileNotFoundException { String res = cpp_load(filename); if (!res.equals("")) throw new FileNotFoundException(res); amplitudes = new int[num_channels()]; } private native String cpp_save(String filename, String format); public void save(String filename, String format) throws IOException { String res = cpp_save(filename, format); if (!res.equals("")) throw new IOException(res); } private native void cpp_resample(int rate); public void resample(int rate) { cpp_resample(rate); } private static native void cpp_set_play_ops(String protocol, String command, String server); public static void set_play_ops(String protocol, String command, String server) { cpp_set_play_ops(protocol, command, server); } private native void cpp_play(float start, float end); public void play(float start, float end) { System.out.println("play st"); if (end > start) cpp_play(start, end); System.out.println("play end"); } private native void cpp_play_all(); public void play() { cpp_play_all(); } private native int cpp_num_samples(); public int num_samples() { return cpp_num_samples(); } private native int cpp_num_channels(); public int num_channels() { return cpp_num_channels(); } private native int cpp_sample_rate(); public int sample_rate() { return cpp_sample_rate(); } private native int cpp_amplitude(int c); public int amplitude(int c) { if (amplitudes[c] > 0) return amplitudes[c]; int a = cpp_amplitude(c); amplitudes[c] = a; return a; } public native int a(int x, int c); public native int a(float t, int c); native public void cpp_getScanlines(int c, byte[] line, int lstart, int lnum, int x, int chunk, int width, int height, int amplitude ); public boolean parse(byte[] bytes) { return false; } native public final int cpp_getMin(int c, int x1, int x2); native public final int cpp_getMax(int c, int x1, int x2); private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_wave(); private native boolean destroy_cpp_wave(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Wave C++ fails"); } } speech_tools/java/cpp_version/cstr/est/Track.java0000644000076400007640000001332707262605664020631 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Friday 12th September 1997 \\ // -------------------------------------------------------------------- \\ // Wrapper around the EST_Track class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.util.*; import java.lang.*; import java.io.*; public class Track { private long cpp_handle; public Track() { create_cpp_track(); } protected void finalize() throws Throwable { destroy_cpp_track(); super.finalize(); } public long getHandle() { return cpp_handle; } private native String cpp_name(); public String name() { return cpp_name(); } private native String cpp_load(String filename); public void load(File filename) throws FileNotFoundException { String res = cpp_load(filename.getPath()); if (!res.equals("")) throw new FileNotFoundException(res); } private native String cpp_save(String filename, String format, float start, float end); public void save(File filename, TrackFileFormat format, float start, float end) throws IOException { String res = cpp_save(filename.getPath(), format.toString(), start, end); if (!res.equals("")) throw new IOException(res); } public void save(File filename, float start, float end) throws IOException { String res = cpp_save(filename.getPath(), TrackFileFormat.EST_BINARY.toString(), start, end); if (!res.equals("")) throw new IOException(res); } private native int cpp_num_frames(); public int num_frames() { return cpp_num_frames(); } private native int cpp_num_channels(); public int num_channels() { return cpp_num_channels(); } private native String cpp_channelName(int i); public String channelName(int i) { return cpp_channelName(i); } private native int cpp_channelPosition(String n); public int channelPosition(String n) { return cpp_channelPosition(n); } public native float a(int i, int c); public native float a(float t, int c); private native float cpp_t(int i); public float t(int i) { return cpp_t(i); } private native boolean cpp_val(int i); public boolean val(int i) { return cpp_val(i); } private native int cpp_frameBefore(float time); public int frameBefore(float time) { return cpp_frameBefore(time); } private native int cpp_frameAfter(float time); public int frameAfter(float time) { return cpp_frameAfter(time); } private native int cpp_frameNearest(float time); public int frameNearest(float time) { return cpp_frameNearest(time); } private native float cpp_getEndTime(); public float getEndTime() { return cpp_getEndTime(); } private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_track(); private native boolean destroy_cpp_track(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Track C++ fails"); } } speech_tools/java/cpp_version/cstr/est/Utterance.java0000644000076400007640000001266007262616577021523 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Friday 12th September 1997 \\ // -------------------------------------------------------------------- \\ // Wrapper around the EST_Utterance class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.util.*; import java.lang.*; import java.io.*; import cstr.util.*; public class Utterance { private long cpp_handle; private LongHash cache; public Utterance() { create_cpp_utterance(); cache = new LongHash(200); } protected void finalize() throws Throwable { destroy_cpp_utterance(); super.finalize(); } final Item getItem(long handle) { Item i; i = (Item)cache.get(handle); if (i==null) { i = new Item(handle, this); cache.put(handle, i); } return i; } private native int cpp_num_relations(); public int num_relations() { return cpp_num_relations(); } private native boolean cpp_has_relation(String name); public boolean has_relation(String n) { return cpp_has_relation(n); } private native long cpp_relation_n(int n); public Relation relation(int n) { return new Relation(cpp_relation_n(n), this); } private native long cpp_relation(String name); public Relation relation(String n) { long rel_h = cpp_relation(n); if (rel_h==0) return null; else return new Relation(rel_h, this); } private native long cpp_create_relation(String name); public Relation create_relation(String name) { long rel_h = cpp_create_relation(name); if (rel_h==0) return null; else return new Relation(rel_h, this); } private native String cpp_load(String filename); public void load(String filename) throws FileNotFoundException { String res = cpp_load(filename); if (!res.equals("")) throw new FileNotFoundException(res); } private native String cpp_save(String filename, String format); public void save(String filename, UtteranceFileFormat format) throws IOException { String res = cpp_save(filename, format.toString()); if (!res.equals("")) throw new IOException(res); } public void save(String filename) throws IOException { save(filename, UtteranceFileFormat.EST_ASCII); } private native int cpp_findItem(float time); public int findItem(float time) { return cpp_findItem(time); } private native float cpp_getEndTime(); public float getEndTime() { return cpp_getEndTime(); } private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_utterance(); private native boolean destroy_cpp_utterance(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Utterance C++ fails"); } } speech_tools/java/cpp_version/cstr/est/Relation.java0000644000076400007640000002134007262616577021341 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Mar 31 1998 \\ // -------------------------------------------------------------------- \\ // Java wrapper around relations. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.awt.*; import java.io.*; import cstr.util.*; public class Relation implements Featured { private long cpp_handle; private Utterance utterance; private boolean mine; public Relation() { this(0L, null, true); } public Relation(long handle) { this(handle, null, false); } public Relation(long handle, Utterance u) { this(handle, u, false); } Relation(long handle, Utterance u, boolean m) { create_cpp_relation(handle); utterance=u; mine=m; } protected void finalize() throws Throwable { if (mine) destroy_cpp_relation(); super.finalize(); } protected final Item getItem(long handle) { Item i; if (utterance != null) i = utterance.getItem(handle); else i = new Item(handle); return i; } private native String cpp_name(); public String name() { return cpp_name(); } public String getName() { return cpp_name(); } public long getHandle() { return cpp_handle; } public boolean equals(Object o) { return o instanceof Relation && ((Relation)o).cpp_handle == cpp_handle; } private native String cpp_type(); public String type() { return cpp_type(); } private native String cpp_getFeature(String n); public String getFeature(String n) { if (n.equals("_NAME_")) return getName(); else return cpp_getFeature(n); } public String getS(String n) { if (n.equals("_NAME_")) return getName(); else return cpp_getFeature(n); } public String [] featureNames() { return featureNames(false, true); } public String [] featureNames(boolean nodes, boolean leaves) { Vector names = new Vector(); Hashtable found = new Hashtable(); Enumeration is = getElements(); while (is.hasMoreElements()) { Item item = (Item)is.nextElement(); Item_Content cont = item.getContent(); Vector paths = new Vector(); cont.getFeatures().getPaths(null, paths, nodes, leaves); for(int i=0; i< paths.size(); i++) { String name = (String)paths.elementAt(i); if (found.get(name) != null) continue; for(int p=0; p0) continue; if (cmp< 0) { names.insertElementAt(name, p); found.put(name,name); } name=null; break; } if (name != null) { names.addElement(name); found.put(name, name); } } } String [] ns = new String[names.size()]; for(int i=0; i= 0 && current.getEndTime() > endTime) current = null; return n; } } } speech_tools/java/cpp_version/cstr/est/Item.java0000644000076400007640000001625207262616577020470 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Mar 31 1998 \\ // -------------------------------------------------------------------- \\ // Java wrapper around items. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; import java.io.*; public class Item implements Named, Keyed, Featured { private long cpp_handle; private boolean mine; private Utterance utterance; private Item_Content contents; public Item() { this(0L, true, null); } public Item(long handle) { this(handle, false, null); } public Item(long handle, Utterance utterance) { this(handle, false, utterance); } Item(long handle, boolean m, Utterance from_utterance) { utterance = from_utterance; create_cpp_item(handle); mine=m; } protected void finalize() throws Throwable { if (mine) destroy_cpp_item(); super.finalize(); } protected final Item getItem(long handle) { Item i; if (utterance != null) i = utterance.getItem(handle); else i = new Item(handle); return i; } public long getHandle() { return cpp_handle; } private native String cpp_name(); public String name() { return cpp_name(); } public String getName() { return cpp_name(); } private native void cpp_setName(String name); public void setName(String name) { cpp_setName(name); } private native long cpp_getContent(); public final Item_Content getContent() { if (contents==null) contents = new Item_Content(cpp_getContent()); return contents; } public final Object getKey() { return getContent(); } public final int hashCode() { return (int)cpp_getContent(); } public final boolean equals(Object i) { return i instanceof Item && ((Item)i).cpp_handle == cpp_handle; } private native String cpp_getS(String n, String def); public String getS(String n, String def) { return cpp_getS(n, def); } public String getS(String n) { return cpp_getS(n, ""); } public String getFeature(String n) { return cpp_getS(n, ""); } private native float cpp_getF(String n, float def); public float getF(String n, float def) { return cpp_getF(n, def); } public float getF(String n) { return cpp_getF(n, 0); } private native void cpp_set(String n, float val); public void set(String n, float val) { cpp_set(n, val); } private native void cpp_set(String n, String val); public void set(String n, String val) { cpp_set(n, val); } private native String cpp_type(); public String type() { return cpp_type(); } private native float cpp_getStartTime(); public float getStartTime() { return cpp_getStartTime(); } private native float cpp_getMidTime(); public float getMidTime() { return cpp_getMidTime(); } private native float cpp_getTime(); public float getTime() { return cpp_getTime(); } private native float cpp_getEndTime(); public float getEndTime() { return cpp_getEndTime(); } private native long cpp_next(); public Item next() { long h = cpp_next(); if (h==0) return null; else return getItem(h); } private native long cpp_prev(); public Item prev() { long h = cpp_prev(); if (h==0) return null; else return getItem(h); } private native long cpp_up(); public Item up() { long h = cpp_up(); if (h==0) return null; else return getItem(h); } private native long cpp_down(); public Item down() { long h = cpp_down(); if (h==0) return null; else return getItem(h); } private native long cpp_insert_after(); public Item insert_after() { long h = cpp_insert_after(); if (h==0) return null; else return getItem(h); } private native long cpp_insert_before(); public Item insert_before() { long h = cpp_insert_before(); if (h==0) return null; else return getItem(h); } private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_item(long handle); private native boolean destroy_cpp_item(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Item C++ fails"); } } speech_tools/java/cpp_version/cstr/est/Item_Content.java0000644000076400007640000001564507262616577022167 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Wed Feb 25 1998 \\ // -------------------------------------------------------------------- \\ // Items in a stream. Wrapper around EST_StreamItem. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; public class Item_Content implements Featured { private long cpp_handle; private boolean mine; private String [] cachedFeatureNames; public Item_Content() { this(0L, true); } public Item_Content(long handle) { this(handle, false); } Item_Content(long handle, boolean m) { create_cpp_itemContent(handle); mine=m; } protected void finalize() throws Throwable { if (mine) destroy_cpp_itemContent(); super.finalize(); } private native long cpp_getItem(); public Item getItem() { return new Item(cpp_getItem()); } private native long cpp_getItem(String relName); public Item getItem(String relName) { long h = cpp_getItem(relName); return h==0L?null:new Item(h); } private native long cpp_getItem(long relh); public Item getItem(Relation rel) { long h = cpp_getItem(rel.getHandle()); return h==0L?null:new Item(h); } private native String [] cpp_featureNames(); public String [] featureNames() { if (cachedFeatureNames ==null) cachedFeatureNames = cpp_featureNames(); return cachedFeatureNames; } private native boolean cpp_featurePresent(String n); public boolean featurePresent(String n) { return cpp_featurePresent(n); } private native String cpp_getS(String n, String def, long r); public String getS(String n, Relation r) { return cpp_getS(n, "", r.getHandle()); } public String getSdef(String n, String def, Relation r) { return cpp_getS(n, def, r.getHandle()); } public String getS(String n) { return cpp_getS(n, "", 0L); } public String getFeature(String n) { return cpp_getS(n, "", 0L); } private native float cpp_getF(String n, float def, long r); public float getF(String n, Relation r) { return cpp_getF(n,(float)0.0,r.getHandle()); } public float getF(String n, float def, Relation r) { return cpp_getF(n,def,r.getHandle()); } public float getF(String n) { return cpp_getF(n,(float)0.0,0L); } private native Object cpp_get(String n, Object def, long r); public Object get(String n, Relation r) { return cpp_get(n,null,r.getHandle()); } public Object get(String n, Object def, Relation r) { return cpp_get(n,def,r.getHandle()); } public Object get(String n) { return cpp_get(n,null,0L); } private native void cpp_set(String n, float val); public void set(String n, float val) { cpp_set(n, val); } private native void cpp_set(String n, String val); public void set(String n, String val) { cpp_set(n, val); } public String name() { return cpp_getS("name", "", 0L); } public String getName() { return cpp_getS("name", "", 0L); } private native long cpp_getFeatures(); public Features getFeatures() { long fh = cpp_getFeatures(); return new Features(fh); } private native float cpp_getStartTime(); public float getStartTime() { return cpp_getStartTime(); } private native float cpp_getMidTime(); public float getMidTime() { return cpp_getMidTime(); } private native float cpp_getTime(); public float getTime() { return cpp_getTime(); } private native float cpp_getEndTime(); public float getEndTime() { return cpp_getEndTime(); } public final int hashCode() { return (int)cpp_handle; } public boolean equals(Object i) { return i instanceof Item_Content && ((Item_Content)i).cpp_handle == cpp_handle; } private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_itemContent(long handle); private native boolean destroy_cpp_itemContent(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Item_Content C++ fails"); } } speech_tools/java/cpp_version/cstr/est/Sigpr.java0000644000076400007640000000651707262605664020654 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Signal Processing Tools \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.awt.*; public class Sigpr { private native static void cpp_spectrogram(long whandle, long thandle, float shift, float length, int order, float floor, float ceil); public static Track spectrogram(Wave wv, float shift, float length, int order, float floor, float ceil) { Track sg = new Track(); cpp_spectrogram(wv.getHandle(), sg.getHandle(), shift, length, order, floor, ceil); return sg; } } speech_tools/java/cpp_version/cstr/est/Features.java0000644000076400007640000001435407262616577021351 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // EST Features mapped to Java. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import cstr.util.*; public class Features implements Featured { private long cpp_handle; private boolean mine; private String [] cachedFeatureNames; public Features() { this(0L, true); } public Features(long handle) { this(handle, false); } Features(long handle, boolean m) { // System.out.println("create "+handle+":"+m); create_cpp_features(handle); mine=m; } protected void finalize() throws Throwable { if (mine) destroy_cpp_features(); super.finalize(); } private native String [] cpp_featureNames(); public String [] names() { if (cachedFeatureNames ==null) cachedFeatureNames = cpp_featureNames(); return cachedFeatureNames; } public void getPaths(String prefix, Vector names, boolean nodes, boolean leaves) { String [] fns = names(); // System.err.println("getFeatureNames:"+fns.length); for(int i=0; i #include "jni_Skeleton.h" #include "ling_class/EST_Skeleton.h" static jobject skeleton_class; static jfieldID handle_field; static inline short abs(short s) { return s>0?s:-s; } JNIEXPORT jboolean JNICALL Java_cstr_est_Skeleton_initialise_1cpp (JNIEnv *env, jclass myclass) { skeleton_class = env->NewGlobalRef(myclass); handle_field = env->GetFieldID(myclass, "handle", "J"); if (!handle_field) { printf("can't find handle!\n"); return 0; } return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Skeleton_finalise_1cpp (JNIEnv *env, jclass myclass) { (void)env; (void)myclass; return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Skeleton_create_11skeleton(JNIEnv *env, jobject self) { EST_Skeleton *skeleton = new EST_Skeleton; // printf("create skeleton %p\n", skeleton); env->SetLongField(self, handle_field, (jlong)skeleton); return 1; } JNIEXPORT jboolean JNICALL Java_cstr_est_Skeleton_destroy_11skeleton (JNIEnv *env, jobject self) { EST_Skeleton *skeleton = (EST_Skeleton *) env->GetLongField(self, handle_field); // printf("destroy skeleton %p\n", skeleton); delete skeleton; return 1; } JNIEXPORT jstring JNICALL Java_cstr_est_Skeleton_1name(JNIEnv *env, jobject self) { EST_Skeleton *skeleton = (EST_Skeleton *) env->GetLongField(self, handle_field); return env->NewStringUTF(skeleton->name()); } JNIEXPORT jstring JNICALL Java_cstr_est_Skeleton_1load (JNIEnv *env, jobject self, jstring jfilename) { EST_Skeleton *skeleton = (EST_Skeleton *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *res = ""; EST_read_status stat = skeleton->load(filename); env->ReleaseStringUTFChars(jfilename, filename); if (stat == read_format_error) res = "skeleton format error"; else if (stat == read_error) res = "skeleton load error"; return env->NewStringUTF(res); } JNIEXPORT jstring JNICALL Java_cstr_est_Skeleton_1save (JNIEnv *env, jobject self, jstring jfilename, jstring jformat) { const EST_Skeleton *skeleton = (EST_Skeleton *) env->GetLongField(self, handle_field); const char *filename = env->GetStringUTFChars(jfilename, 0); const char *format = env->GetStringUTFChars(jformat, 0); const char *res = ""; EST_write_status stat = skeleton->save(filename,format); env->ReleaseStringUTFChars(jfilename, filename); env->ReleaseStringUTFChars(jformat, format); if (stat == write_error) res = "skeleton save error"; return env->NewStringUTF(res); } speech_tools/java/cpp_version/cstr/est/skeleton.java0000644000076400007640000001005510044502523021362 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Mar 31 1998 \\ // -------------------------------------------------------------------- \\ // Java wrapper around relations. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est.cpp ; import java.lang.*; import java.util.*; import java.awt.*; import java.io.*; public class skeleton { private long cpp_handle; public Skeleton() { create_cpp_utterance(); } protected void finalize() throws Throwable { destroy_cpp_utterance(); super.finalize(); } private native String cpp_name(); public String name() { return cpp_name(); } private native String cpp_load(String filename); public void load(String filename) throws FileNotFoundException { String res = cpp_load(filename); if (!res.equals("")) throw new FileNotFoundException(res); } private native int cpp_findItem(float time); public int findItem(float time) { return cpp_findItem(time); } private native float cpp_getEndTime(); public float getEndTime() { return cpp_getEndTime(); } private native static boolean initialise_cpp(); private native static boolean finalise_cpp(); private native boolean create_cpp_utterance(); private native boolean destroy_cpp_utterance(); static { System.loadLibrary("estjava"); if (!initialise_cpp()) throw new ExceptionInInitializerError("Skeleton C++ fails"); } } speech_tools/java/media_version/Makefile0000644000076400007640000000512007262605664017101 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../.. DIRNAME=java/media_version FILES = Makefile Makefile.version BUILD_DIRS=cstr NEED_JAVA=true ALL = .sub_directories .javalib include $(TOP)/config/common_make_rules -include Makefile.version speech_tools/java/media_version/Makefile.version0000644000076400007640000000523307262605664020572 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Suplimental make information for this version CODE_VERSION=media LOCAL_JAVA_CLASS_LIBRARY=$(TOP)/lib/est_$(CODE_VERSION).jar LOCAL_JAVA_CLASSPATH=$(EST_HOME)/speech_tools/lib/est_$(CODE_VERSION).jar JAVA_TOP_PACK=cstr LOCAL_JAVA_ROOT=$(TOP)/java/$(CODE_VERSION)_version_build speech_tools/java/media_version/cstr/Makefile0000644000076400007640000000516307262605664020063 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../.. DIRNAME=java/media_version/cstr ALL_DIRS = est BUILD_DIRS = awt est util testPrograms NEED_JAVA = true FILES = Makefile ALL = .sub_directories -include ../../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/java/media_version/cstr/est/Wave.java0000644000076400007640000002217707262605664020767 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not delete. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // A simple java wave class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.net.*; import java.io.*; import javax.media.*; import javax.media.protocol.*; class PlayWatcher implements ControllerListener { private boolean finished; public PlayWatcher() { finished=false; } public synchronized void waitForPlay() { while (!finished) try { this.wait(); } catch (InterruptedException e) { } } public synchronized void controllerUpdate(ControllerEvent e) { Player p = (Player)e.getSourceController(); if (e instanceof StopEvent) { p.removeControllerListener(this); p.deallocate(); p.close(); finished=true; this.notifyAll(); } } } public class Wave { int amplitude_cache=-1; short [] samples; // byte [] sbytes; int channels; int sample_rate; File fn; public Wave() { samples=null; fn=null; } public Wave(byte [] bytes) throws UnsupportedEncodingException { fn=null; if (!parse(bytes)) { throw new UnsupportedEncodingException("Can't create Wave from this bytestream"); } } public Wave(File file) throws UnsupportedEncodingException, IOException { fn=null; FileInputStream is = new FileInputStream(file); int n=0; byte [] buf = new byte[n]; while (true) { byte [] ibuf = new byte[10240]; int nr = is.read(ibuf, 0, 10240); if (nr == -1) break; if (n==0) { buf = ibuf; n = nr; } else { byte [] nbuf = new byte[n+nr]; for(int i=0; i=0 && d > amplitude_cache) amplitude_cache=d; if (d<0 && -d > amplitude_cache) amplitude_cache=-d; } return amplitude_cache; } public int num_samples() { return samples.length; } public void cpp_getScanlines(int c, byte[] line, int lstart, int lnum, int x, int chunk, int width, int height, int amplitude ) { } private File mkFilename() { StringBuffer fn= new StringBuffer(50); fn.append("/tmp/jsapi_"); fn.append(this.toString()); fn.append(".au"); return new File(fn.toString()); } private final int mkint(byte b0, byte b1, byte b2, byte b3) { int r = (((short)b3) & 255); r += (((short)b2) & 255) << 8; r += (((short)b1) & 255) << 16; r += (((short)b0) & 255) << 24; return r; } private final short mkshort(byte b0, byte b1) { short r = (short)(((short)b1) & 255); r += (short)(((short)b0) & 255) << 8; return r; } public boolean parse(byte[] bytes) { int magic = (bytes[0] <<24) + (bytes[1] <<16) + (bytes[2] <<8) + bytes[3]; int smagic = (bytes[3] <<24) + (bytes[2] <<16) + (bytes[1] <<8) + bytes[0]; if (magic == 0x2e736e64) { // Sun snd, shorts, unswapped int hdr_size = mkint(bytes[4], bytes[5], bytes[6], bytes[7]); int hdr_data_size = mkint(bytes[8], bytes[9], bytes[10], bytes[11]); int hdr_encoding = mkint(bytes[12], bytes[13], bytes[14], bytes[15]); int hdr_sample_rate = mkint(bytes[16], bytes[17], bytes[18], bytes[19]); int hdr_channels = mkint(bytes[20], bytes[21], bytes[22], bytes[23]); if (hdr_encoding != 3) return false; sample_rate = hdr_sample_rate; channels = hdr_channels; int pos = hdr_size; int nsamples = (bytes.length-pos)/2/channels; // System.out.println("sr="+sample_rate+" c="+channels+" nsamp="+nsamples); samples = new short[nsamples]; //sbytes = new byte[nsamples*2]; for(int s=0; s= wave.samples.length; } public boolean willReadBlock() { return false; } private final void insert_int(byte b[], int p, int v) { b[p++] = (byte)((v >>24)&255); b[p++] = (byte)((v >>16)&255); b[p++] = (byte)((v >>8)&255); b[p++] = (byte)((v)&255); } private int fill_in_header(byte b[], int p) { insert_int(b, p, 0x2e736e64); insert_int(b, p+4, 24); insert_int(b, p+8, wave.samples.length*2); insert_int(b, p+12, 3); insert_int(b, p+16, wave.sample_rate); insert_int(b, p+20, wave.channels); return 24; } public int read(byte buffer[], int offset, int length) { int n=0; // System.out.println("read o="+offset+" l="+length); if (pos == -2) return -1; if (pos < 0) { n = header.length; if (n > length) n = length; for(int b=0; b= header.length) pos=0; return n; } int nsamp = length/2; // System.out.println("\tnsamp="+nsamp+" pos="+pos+" len="+wave.samples.length); if (nsamp > wave.samples.length-pos) nsamp = wave.samples.length-pos; // System.out.println("\tnsamp="+nsamp); for(int s=0; s>8)&255); buffer[offset++] = (byte)(samp&255); // buffer[offset++] = wave.sbytes[(s+pos)*2]; // buffer[offset++] = wave.sbytes[(s+pos)*2+1]; } if (nsamp==0) pos =-2; else pos += nsamp; return nsamp*2; } public Object[] getControls() { return new Object[0]; } public Object getControl(String controlType) { return null; } } public class WaveDataSource extends PullDataSource { MediaLocator locator; Wave wave; WavePullSourceStream stream; public WaveDataSource(Wave wv) { super(); wave=wv; } public void connect() { stream = new WavePullSourceStream(wave); } public void disconnect() { stream = null; } public void initCheck() throws Error { if (stream==null) throw new Error("Uninitialised Data Source Error"); } public String getContentType() { if (stream != null) return stream.getContentDescriptor().getContentType(); return "audio.basic"; } public void setLocator(MediaLocator l) { locator=l; } public MediaLocator getLocator() { return locator; } public void start() { initCheck(); } public void stop() { initCheck(); } public PullSourceStream[] getStreams() { initCheck(); return new PullSourceStream[] {stream}; } public Time getDuration() { initCheck(); return new Time((double)wave.samples.length/(double)wave.sample_rate); } public Object[] getControls() { return new Object[0]; } public Object getControl(String controlType) { return null; } } speech_tools/java/media_version/cstr/est/Item_Content.java0000644000076400007640000001000407262616577022444 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Wed Feb 25 1998 \\ // -------------------------------------------------------------------- \\ // Items in a stream. Wrapper around EST_StreamItem. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est ; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; public class Item_Content implements Featured { public Item_Content() { this(0L, true); } public Item_Content(long handle) { this(handle, false); } Item_Content(long handle, boolean m) { } protected void finalize() throws Throwable { super.finalize(); } public String name() { return "DUMMY"; } public String getName() { return name(); } public Features getFeatures() { return new Features(); } public Item getItem() { return null; } public String [] featureNames() { return null; } public boolean featurePresent(String n) { return false; } public String getS(String n) { return null; } public String getFeature(String n) { return null; } public float getF(String n) { return (float)0.0; } public float getStartTime() { return (float)0.0; } public float getMidTime() { return (float)0.0; } public float getEndTime() { return (float)0.0; } } speech_tools/java/media_version/cstr/est/Item.java0000644000076400007640000001072107262605664020753 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // Date: Tue Mar 31 1998 \\ // -------------------------------------------------------------------- \\ // Java wrapper around items. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import java.awt.*; import cstr.util.*; import java.io.*; public class Item implements Named, Keyed, Featured { public Item() { this(0L, true, null); } public Item(long handle) { this(handle, false, null); } public Item(long handle, Object utterance) { this(handle, false, utterance); } Item(long handle, boolean m, Object from_utterance) { } protected void finalize() throws Throwable { super.finalize(); } protected final Item getItem(long handle) { return null; } public String name() { return null; } public String getName() { return null; } public void setName(String name) { } public final Item_Content getContent() { return null; } public final Object getKey() { return null; } public String getS(String n) { return null; } public String getS(String n, String def) { return def; } public String getFeature(String n) { return null; } public float getF(String n) { return (float)0.0; } public String type() { return null; } public float getStartTime() { return (float)0.0; } public float getMidTime() { return (float)0.0; } public float getEndTime() { return (float)0.0; } public Item next() { return null; } public Item prev() { return null; } public Item up() { return null; } public Item down() { return null; } } speech_tools/java/media_version/cstr/est/Features.java0000644000076400007640000001005407262616577021637 0ustar awbawb //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Centre for Speech Technology Research \\ // University of Edinburgh, UK \\ // Copyright (c) 1996,1997 \\ // All Rights Reserved. \\ // Permission is hereby granted, free of charge, to use and distribute \\ // this software and its documentation without restriction, including \\ // without limitation the rights to use, copy, modify, merge, publish, \\ // distribute, sublicense, and/or sell copies of this work, and to \\ // permit persons to whom this work is furnished to do so, subject to \\ // the following conditions: \\ // 1. The code must retain the above copyright notice, this list of \\ // conditions and the following disclaimer. \\ // 2. Any modifications must be clearly marked as such. \\ // 3. Original authors' names are not deleted. \\ // 4. The authors' names are not used to endorse or promote products \\ // derived from this software without specific prior written \\ // permission. \\ // THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK \\ // DISCLAIM ALL WARRANTIES With REGARD TO THIS SOFTWARE, INCLUDING \\ // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT \\ // SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE \\ // FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES \\ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN \\ // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, \\ // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF \\ // THIS SOFTWARE. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Author: Richard Caley (rjc@cstr.ed.ac.uk) \\ // -------------------------------------------------------------------- \\ // Pretended EST_Features class. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package cstr.est; import java.lang.*; import java.util.*; import cstr.util.*; public class Features implements Featured { String [] cachedFeatureNames; public Features() { this(0L, true); } public Features(long handle) { this(handle, false); } Features(long handle, boolean m) { } protected void finalize() throws Throwable { super.finalize(); } public String [] names() { if (cachedFeatureNames ==null) cachedFeatureNames = new String [0]; return cachedFeatureNames; } public void getPaths(String prefix, Vector names, boolean paths, boolean leaves) { } public boolean present(String n) { return false; } public String getS(String n) { return ""; } public String getS(String n, String def) { return def; } public String getFeature(String n) { return ""; } public float getF(String n) { return (float)0.0; } public float getF(String n, float def) { return def; } public Object get(String n) { return null; } public Object get(String n, Object def) { return def; } public void set(String n, float val) { } public void set(String n, String val) { } static { } } speech_tools/java/media_version/cstr/est/Makefile0000644000076400007640000000572607262616577020670 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### TOP=../../../.. DIRNAME = java/media_version/cstr/est JUST_BUILD_DIRS = awt ALL_DIRS = LOCAL_JAVA_NATIVE_CLASSES = JAVA_NATIVE_CLASSES =$(LOCAL_JAVA_NATIVE_CLASSES) LOCAL_JAVA_CLASSES = $(LOCAL_JAVA_NATIVE_CLASSES) Wave WaveDataSource Item_Content Item Features JAVA_CLASSES = $(LOCAL_JAVA_CLASSES) SocketsFile ServerConnection CPPSRCS = $(JAVA_NATIVE_CLASSES:%=%.cc) SRCS = $(CPPSRCS) OBJS_estjava = $(SRCS:.cc=.o) FILES = $(LOCAL_JAVA_CLASSES:%=%.java) $(LOCAL_JAVA_NATIVE_CLASSES:%=%.cc) Makefile ALL = .java -include ../../Makefile.version include $(TOP)/config/common_make_rules speech_tools/rxp/Makefile0000644000076400007640000000451607262605664014155 0ustar awbawb ########################################################################### ## ## ## Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, ## ## University of Edinburgh. ## ## ## ## THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, ## ## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ## ## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT ## ## IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE ## ## FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ## ## CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ## ## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ## ## ########################################################################### ## ## ## This directory contains an XML parser and trivial interface for its ## ## use in Speech Tools, Festival and Fringe. ## ## ## ## ## ## This parser does not fall under Speech Tools licencing but is also ## ## free to be used for any purpose without fee. Note that other ## ## versions of RXP (with differing functionality) are available from ## ## LTG, HCRC under different licences including the GPL. ## ## ## ########################################################################### TOP=.. DIRNAME=rxp H = SRCSC = charset.c dtd.c string16.c url.c \ ctype16.c input.c stdio16.c system.c xmlparser.c TSRCS = XML_Parser.cc SRCS = $(SRCSC) $(TSRCS) OBJS = $(SRCSC:.c=.o) $(TSRCS:.cc=.o) FILES = Makefile $(SRCS) $(H) rxp.c rxp.mak LOCAL_INCLUDES = -I$(EST)/include/rxp LOCAL_DEFINES = -DCHAR_SIZE=8 LOCAL_DEFAULT_LIBRARY = estbase VC_LOCAL_DEFINES= /DCHAR_SIZE=8 ALL = .buildlib include $(TOP)/config/common_make_rules speech_tools/rxp/charset.c0000644000076400007640000002677307262616577014330 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #include #include #ifdef FOR_LT #include "lt-memory.h" #define Malloc salloc #else #include "system.h" #endif #include "charset.h" #include "string16.h" int iso_to_unicode[8][256]; /* latin-2 ... latin-9 */ int iso_max_val[8]; char8 *unicode_to_iso[8]; /* This table is used to initialise the above arrays */ static int latin_table[8][96] = { /* latin2 */ { 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }, /* latin3 */ { 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, -00001, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, -00001, 0x017b, 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, -00001, 0x017c, 0x00c0, 0x00c1, 0x00c2, -00001, 0x00c4, 0x010a, 0x0108, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, -00001, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, 0x00e0, 0x00e1, 0x00e2, -00001, 0x00e4, 0x010b, 0x0109, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, -00001, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, }, /* latin4 */ { 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, }, /* latin5 */ { 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, }, /* latin6 */ { 0x00a0, -00001, -00001, -00001, 0x00a4, -00001, -00001, -00001, -00001, -00001, -00001, -00001, 0x060c, 0x00ad, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, 0x061b, -00001, -00001, -00001, 0x061f, -00001, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063a, -00001, -00001, -00001, -00001, -00001, 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, 0x0652, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, }, /* latin7 */ { 0x00a0, 0x02bd, 0x02bc, 0x00a3, -00001, -00001, 0x00a6, 0x00a7, 0x00a8, 0x00a9, -00001, 0x00ab, 0x00ac, 0x00ad, -00001, 0x2015, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, -00001, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, -00001, }, /* latin8 */ { 0x00a0, -00001, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x203e, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, -00001, 0x2017, 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, -00001, -00001, -00001, -00001, -00001, }, /* latin9 */ { 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, } }; const char8 *CharacterEncodingName[CE_enum_count] = { "unknown", "unspecified-ascii-superset", "UTF-8", "ISO-646", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "UTF-16", "UTF-16", "ISO-10646-UCS-2", "ISO-10646-UCS-2", }; const char8 *CharacterEncodingNameAndByteOrder[CE_enum_count] = { "unknown", "unspecified_ascii_superset", "UTF-8", "ISO-646", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "UTF-16-B", "UTF-16-L", "ISO-10646-UCS-2-B", "ISO-10646-UCS-2-L", }; struct character_encoding_alias CharacterEncodingAlias[] = { {"ASCII", CE_ISO_646}, {"ISO-Latin-1", CE_ISO_8859_1}, {"ISO-Latin-2", CE_ISO_8859_2}, {"ISO-Latin-3", CE_ISO_8859_3}, {"ISO-Latin-4", CE_ISO_8859_4}, {"ISO-Latin-5", CE_ISO_8859_5}, {"ISO-Latin-6", CE_ISO_8859_6}, {"ISO-Latin-7", CE_ISO_8859_7}, {"ISO-Latin-8", CE_ISO_8859_8}, {"UCS-2", CE_ISO_10646_UCS_2B}, }; const int CE_alias_count = sizeof(CharacterEncodingAlias)/sizeof(CharacterEncodingAlias[0]); CharacterEncoding InternalCharacterEncoding; void init_charset(void) { int i, j; union {char b[2]; short s;} bytes; /* Determine internal encoding */ bytes.s = 1; #if CHAR_SIZE == 8 InternalCharacterEncoding = CE_unspecified_ascii_superset; #else InternalCharacterEncoding = (bytes.b[0] == 0) ? CE_UTF_16B : CE_UTF_16L; #endif /* Make ISO-Latin-N tables */ for(i=0; i<8; i++) { int max = 0x9f; for(j=0; j<0xa0; j++) iso_to_unicode[i][j] = j; for(j=0xa0; j<0x100; j++) { int code = latin_table[i][j-0xa0]; iso_to_unicode[i][j] = code; if(code > max) max = code; } iso_max_val[i] = max; if(!(unicode_to_iso[i] = Malloc(max+1))) { fprintf(stderr, "Malloc failed in charset initialisation\n"); exit(1); } for(j=0; j<0xa0; j++) unicode_to_iso[i][j] = j; for(j=0xa0; j<=max; j++) unicode_to_iso[i][j] = '?'; for(j=0xa0; j<0x100; j++) { int code = latin_table[i][j-0xa0]; if(code != -1) unicode_to_iso[i][code] = j; } } } /* Return true if the encoding has 8-bit input units and is the same as ascii for characters <= 127 */ int EncodingIsAsciiSuperset(CharacterEncoding enc) { return enc >= CE_unspecified_ascii_superset && enc <= CE_ISO_8859_9; } /* * Return true if enc1 and enc2 have the same size input units, and are * the same for Unicode <= 127. * If so, *enc3 is set to enc2 modified to have the same byte order as enc1. */ int EncodingsCompatible(CharacterEncoding enc1, CharacterEncoding enc2, CharacterEncoding *enc3) { if(EncodingIsAsciiSuperset(enc1)) { if(EncodingIsAsciiSuperset(enc2)) { *enc3 = enc2; return 1; } return 0; } if(enc1 == CE_UTF_16B || enc1 == CE_ISO_10646_UCS_2B) { if(enc2 == CE_UTF_16B || enc2 == CE_UTF_16L) *enc3 = CE_UTF_16B; else if(enc2 == CE_ISO_10646_UCS_2B || enc2 == CE_ISO_10646_UCS_2L) *enc3 = CE_ISO_10646_UCS_2B; else return 0; return 1; } if(enc1 == CE_UTF_16L || enc1 == CE_ISO_10646_UCS_2L) { if(enc2 == CE_UTF_16B || enc2 == CE_UTF_16L) *enc3 = CE_UTF_16L; else if(enc2 == CE_ISO_10646_UCS_2B || enc2 == CE_ISO_10646_UCS_2L) *enc3 = CE_ISO_10646_UCS_2L; else return 0; return 1; } return 0; } CharacterEncoding FindEncoding(char8 *name) { int i; for(i=0; i #ifdef FOR_LT #include "lt-memory.h" #include "nsllib.h" #define Malloc salloc #define Realloc srealloc #define Free sfree #else #include "system.h" #endif #include "charset.h" #include "string16.h" #include "dtd.h" #include "url.h" const char8 *DefaultTypeName[DT_enum_count] = { "#required", "bogus1", "#implied", "bogus2" "none", "#fixed", }; const char8 *ContentTypeName[CT_enum_count] = { "mixed", "any", "bogus1", "bogus2", "empty", "element" }; const char8 *AttributeTypeName[AT_enum_count] = { "cdata", "bogus1", "bogus2", "nmtoken", "bogus3", "entity", "idref", "bogus4", "bogus5", "nmtokens", "bogus6", "entities", "idrefs", "id", "notation", "enumeration" }; const char8 *StandaloneDeclarationName[SDD_enum_count] = { "unspecified", "no", "yes" }; static Char *Strndup(const Char *old, int len) { Char *new = Malloc((len+1) * sizeof(Char)); if(!new) return 0; memcpy(new, old, len * sizeof(Char)); new[len] = 0; return new; } /* DTDs */ Dtd NewDtd(void) { Dtd d; if(!(d = Malloc(sizeof(*d)))) return 0; d->name = 0; d->internal_part = 0; d->external_part = 0; d->entities = 0; d->parameter_entities = 0; d->predefined_entities = 0; #ifdef FOR_LT d->doctype = 0; #else d->elements = 0; #endif d->notations = 0; return d; } /* Free a DTD and everything in it */ void FreeDtd(Dtd dtd) { Entity ent, ent1; #ifndef FOR_LT ElementDefinition elem, elem1; #endif NotationDefinition not, not1; if(!dtd) return; /* Free the name */ Free((Char *)dtd->name); /* cast is to get rid of const */ /* Free the entities */ FreeEntity(dtd->internal_part); FreeEntity(dtd->external_part); for(ent = dtd->entities; ent; ent = ent1) { ent1 = ent->next; /* get it before we free ent! */ FreeEntity(ent); } for(ent = dtd->parameter_entities; ent; ent = ent1) { ent1 = ent->next; FreeEntity(ent); } /* The predefined entities are shared, so we don't free them */ #ifndef FOR_LT /* Free the elements (kept elsewhere in NSL) */ for(elem = dtd->elements; elem; elem = elem1) { elem1 = elem->next; FreeElementDefinition(elem); /* Frees the attributes too */ } #endif /* Free the notations */ for(not = dtd->notations; not; not = not1) { not1 = not->next; FreeNotationDefinition(not); } /* Free the dtd itself */ Free(dtd); } /* Entities */ /* * Make a new entity. The name is copied, none of the other * arguments are, but they are freed when the entity is freed! */ Entity NewExternalEntityN(const Char *name, int namelen, const char8 *publicid, const char8 *systemid, NotationDefinition notation, Entity parent) { Entity e; if(!(e = Malloc(sizeof(*e)))) return 0; if(name && !(name = Strndup(name, namelen))) return 0; e->type = ET_external; e->name = name; e->base_url = 0; e->encoding = CE_unknown; e->next = 0; e->parent = parent; e->publicid = publicid; e->systemid = systemid; e->notation = notation; e->version_decl = 0; e->encoding_decl = CE_unknown; e->standalone_decl = SDD_unspecified; e->ddb_filename = 0; e->url = 0; return (Entity)e; } Entity NewInternalEntityN(const Char *name, int namelen, const Char *text, Entity parent, int line_offset, int line1_char_offset, int matches_parent_text) { Entity e; if(!(e = Malloc(sizeof(*e)))) return 0; if(name) if(!(name = Strndup(name, namelen))) return 0; e->type = ET_internal; e->name = name; e->base_url = 0; e->encoding = InternalCharacterEncoding; e->next = 0; e->parent = parent; e->text = text; e->line_offset = line_offset; e->line1_char_offset = line1_char_offset; e->matches_parent_text = matches_parent_text; e->url = 0; return (Entity)e; } void FreeEntity(Entity e) { if(!e) return; Free((void *)e->name); /* The casts are to get rid of the const */ Free((void *)e->base_url); Free((void *)e->url); switch(e->type) { case ET_internal: Free((void *)e->text); break; case ET_external: Free((void *)e->systemid); Free((void *)e->publicid); Free((void *)e->version_decl); Free((void *)e->ddb_filename); break; } Free(e); } const char8 *EntityURL(Entity e) { /* Have we already determined the URL? */ if(e->url) return e->url; if(e->type == ET_internal) { if(e->parent) { const char8 *url = EntityURL(e->parent); if(url) e->url = strdup8(url); } } else e->url = url_merge(e->systemid, e->parent ? EntityBaseURL(e->parent) : 0, 0, 0, 0, 0); return e->url; } /* Returns the URL of the entity if it has one, otherwise the system ID. It will certainly have a URL if it was successfully opened by EntityOpen. Intended for error messages, so never returns NULL. */ const char8 *EntityDescription(Entity e) { if(e->url) return e->url; if(e->type == ET_external) return e->systemid; if(e->parent) return EntityDescription(e->parent); return ""; } void EntitySetBaseURL(Entity e, const char8 *url) { e->base_url = url; } const char8 *EntityBaseURL(Entity e) { if(e->base_url) return e->base_url; if(e->type == ET_internal) { if(e->parent) return EntityBaseURL(e->parent); else return 0; } return EntityURL(e); } Entity DefineEntity(Dtd dtd, Entity e, int pe) { if(pe) { e->next = dtd->parameter_entities; dtd->parameter_entities = e; } else { e->next = dtd->entities; dtd->entities = e; } return e; } Entity FindEntityN(Dtd dtd, const Char *name, int namelen, int pe) { Entity e; if(!pe) for(e = dtd->predefined_entities; e; e = e->next) if(Strncmp(name, e->name, namelen) == 0 && e->name[namelen] == 0) return e; for(e = pe ? dtd->parameter_entities : dtd->entities; e; e=e->next) if(Strncmp(name, e->name, namelen) == 0 && e->name[namelen] == 0) return e; return 0; } /* Elements */ /* * Define a new element. The name is copied, the content model is not, * but it is freed when the element definition is freed! */ ElementDefinition DefineElementN(Dtd dtd, const Char *name, int namelen, ContentType type, Char *content) { #ifdef FOR_LT static struct element_definition e; RHTEntry *entry; struct element_content *c; if (!(entry = DeclareElement(dtd->doctype, name, namelen, 0, (ctVals)type))) { return NULL; }; e.doctype = dtd->doctype; e.name = (Char *)dtd->doctype->elements+entry->keyptr; e.elsum = (NSL_ElementSummary_I *)(dtd->doctype->permanentBase+entry->eval); if(type == CT_element || type == CT_mixed) { if(!(c = Malloc(sizeof(*c)))) return 0; c->elsum = e.elsum; c->content = content; c->next = e.doctype->element_content; e.doctype->element_content = c; } return &e; #else ElementDefinition e; if(!(e = Malloc(sizeof(*e))) || !(name = Strndup(name, namelen))) return 0; e->tentative = 0; e->name = name; e->namelen = namelen; e->type = type; e->content = content; e->attributes = 0; e->next = dtd->elements; dtd->elements = e; return e; #endif } ElementDefinition TentativelyDefineElementN(Dtd dtd, const Char *name, int namelen) { #ifdef FOR_LT static struct element_definition e; RHTEntry *entry; if (!(entry = DeclareElement(dtd->doctype, name, namelen, 0, (ctVals)CT_any))) { return NULL; }; e.doctype = dtd->doctype; e.name = (Char *)dtd->doctype->elements+entry->keyptr; e.elsum = (NSL_ElementSummary_I *)(dtd->doctype->permanentBase+entry->eval); /* XXX use the omitStart field to note that it's tentative. */ e.elsum->omitStart |= 2; return &e; #else ElementDefinition e; if(!(e = Malloc(sizeof(*e))) || !(name = Strndup(name, namelen))) return 0; e->tentative = 1; e->name = name; e->namelen = namelen; e->type = CT_any; e->content = 0; e->attributes = 0; e->next = dtd->elements; dtd->elements = e; return e; #endif } ElementDefinition RedefineElement(ElementDefinition e, ContentType type, Char *content) { #ifdef FOR_LT struct element_content *c; e->elsum->contentType = type; e->elsum->omitStart &= ~2; if(type == CT_element) { if(!(c = Malloc(sizeof(*c)))) return 0; c->elsum = e->elsum; c->content = content; c->next = e->doctype->element_content; e->doctype->element_content = c; } #else e->tentative = 0; e->type = type; e->content = content; #endif return e; } ElementDefinition FindElementN(Dtd dtd, const Char *name, int namelen) { #ifdef FOR_LT /* Derived from FindElementAndName */ static struct element_definition e; RHTEntry *entry; NSL_ElementSummary_I *elsum; if(!dtd->doctype) return 0; entry = rsearch(name, namelen, dtd->doctype->elements); if(!entry) return 0; elsum = (NSL_ElementSummary_I *)(dtd->doctype->permanentBase+entry->eval); e.doctype = dtd->doctype; e.name = (Char *)dtd->doctype->elements+entry->keyptr; #if 0 /* We don't use this so don't waste time on it XXX */ e.namelen = Strlen(e.name); #endif e.elsum = elsum; e.tentative = ((e.elsum->omitStart & 2) != 0); return &e; #else ElementDefinition e, *p; for(p = &dtd->elements, e = *p; e; p = &e->next, e = *p) if(namelen == e->namelen && *name == *e->name && memcmp(name, e->name, namelen*sizeof(Char)) == 0) { *p = e->next; e->next = dtd->elements; dtd->elements = e; return e; } return 0; #endif } /* Free an element definition and its attribute definitions */ void FreeElementDefinition(ElementDefinition e) { #ifndef FOR_LT AttributeDefinition a, a1; #endif if(!e) return; /* Free the element name */ Free((void *)e->name); #ifndef FOR_LT /* Free the content model (kept elsewhere in NSL) */ Free(e->content); /* Free the attributes (kept elsewhere in NSL) */ for(a = e->attributes; a; a = a1) { a1 = a->next; FreeAttributeDefinition(a); } /* Free the ElementDefinition itself */ #endif Free(e); } /* Attributes */ /* * Define a new attribute. The name is copied, the allowed values and * default are not, but they are freed when the attribute definition is freed! */ AttributeDefinition DefineAttributeN(ElementDefinition element, const Char *name, int namelen, AttributeType type, Char **allowed_values, DefaultType default_type, const Char *default_value) { #ifdef FOR_LT int nav = 0; Char *av = allowed_values ? allowed_values[0] : 0; Char **avp; NSL_Doctype_I *doctype = element->doctype; if(!doctype) return 0; if(allowed_values) { for(avp = allowed_values; *avp; avp++) nav++; Free(allowed_values); } if (!(name = DeclareAttr(doctype, name, namelen, (NSL_Attr_Declared_Value)type, av, nav, (NSL_ADefType)default_type, default_value, &element->elsum, element->name))) { return 0; }; return (AttributeDefinition)FindAttrSpec(element->elsum, doctype, name); #else AttributeDefinition a; if(!(a= Malloc(sizeof(*a))) || !(name = Strndup(name, namelen))) return 0; a->name = name; a->namelen = namelen; a->type = type; a->allowed_values = allowed_values; a->default_type = default_type; a->default_value = default_value; a->next = element->attributes; element->attributes = a; return a; #endif } AttributeDefinition FindAttributeN(ElementDefinition element, const Char *name, int namelen) { #ifdef FOR_LT if(!element->doctype) return 0; if(!(name = AttrUniqueName(element->doctype, name, namelen))) return 0; return (AttributeDefinition)FindAttrSpec(element->elsum, element->doctype, name); #else AttributeDefinition a; for(a = element->attributes; a; a = a->next) if(namelen == a->namelen && memcmp(name, a->name, namelen * sizeof(Char)) == 0) return a; return 0; #endif } AttributeDefinition NextAttributeDefinition(ElementDefinition element, AttributeDefinition previous) { #ifdef FOR_LT return 0; /* not implemented */ #else if(previous) return previous->next; else return element->attributes; #endif } /* Free an attribute definition */ void FreeAttributeDefinition(AttributeDefinition a) { #ifndef FOR_LT /* We don't keep anything in the NSL case */ if(!a) return; /* Free the name */ Free((void *)a->name); /* Free the allowed values - we rely on them being allocated as in xmlparser.c: the Char * pointers point into one single block. */ if(a->allowed_values) Free(a->allowed_values[0]); Free(a->allowed_values); /* Free the default value */ Free((void *)a->default_value); /* Free the attribute definition itself */ Free(a); #endif } /* Notations */ /* * Define a new notation. The name is copied, the system and public ids are * not, but they are freed when the notation definition is freed! */ NotationDefinition DefineNotationN(Dtd dtd, const Char *name, int namelen, const char8 *publicid, const char8 *systemid) { NotationDefinition n; if(!(n = Malloc(sizeof(*n))) || !(name = Strndup(name, namelen))) return 0; n->name = name; n->tentative = 1; n->systemid = systemid; n->publicid = publicid; n->next = dtd->notations; dtd->notations = n; return n; } NotationDefinition TentativelyDefineNotationN(Dtd dtd, const Char *name, int namelen) { NotationDefinition n; if(!(n = Malloc(sizeof(*n))) || !(name = Strndup(name, namelen))) return 0; n->name = name; n->tentative = 1; n->systemid = 0; n->publicid = 0; n->next = dtd->notations; dtd->notations = n; return n; } NotationDefinition RedefineNotation(NotationDefinition n, const char8 *publicid, const char8 *systemid) { n->tentative = 0; n->systemid = systemid; n->publicid = publicid; return n; } NotationDefinition FindNotationN(Dtd dtd, const Char *name, int namelen) { NotationDefinition n; for(n = dtd->notations; n; n = n->next) if(Strncmp(name, n->name, namelen) == 0 && n->name[namelen] == 0) return n; return 0; } void FreeNotationDefinition(NotationDefinition n) { if(!n) return; /* Free the name */ Free((void *)n->name); /* Free the ids */ Free((void *)n->systemid); Free((void *)n->publicid); /* Free the notation definition itself */ Free(n); } speech_tools/rxp/string16.c0000644000076400007640000001213307262605664014330 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifdef FOR_LT #include "lt-memory.h" #define Malloc salloc #define Realloc srealloc #define Free sfree #else #include "system.h" #endif #include "charset.h" #include "ctype16.h" #include "string16.h" int strcasecmp8(const char8 *s1, const char8 *s2) { char8 c1, c2; while(1) { c1 = Toupper(*s1++); c2 = Toupper(*s2++); if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } } int strncasecmp8(const char8 *s1, const char8 *s2, size_t n) { char8 c1, c2; while(n-- > 0) { c1 = Toupper(*s1++); c2 = Toupper(*s2++); if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } return 0; } char8 *strdup8(const char8 *s) { char8 *buf; int len; len = strlen8(s); buf = Malloc(len + 1); if(!buf) return 0; strcpy8(buf, s); return buf; } /* * NB these two functions return static storage, use Strdup or strdup8 * if you want to keep the result. */ /* Convert a Latin-1 string to UTF-16 (easy!) */ char16 *char8tochar16(const char8 *s) { static char16 *buf = 0; int i, len; len = strlen8(s); buf = Realloc(buf, (len + 1) * sizeof(char16)); if(!buf) return 0; for(i=0; i 255 ? 'X' : s[i]; buf[i] = 0; return buf; } char16 *strcpy16(char16 *s1, const char16 *s2) { char16 *t = s1; while(*s2) *s1++ = *s2++; *s1 = 0; return t; } char16 *strncpy16(char16 *s1, const char16 *s2, size_t n) { char16 *t = s1; while(n-- > 0 && *s2) *s1++ = *s2++; if(n > 0) *s1 = 0; return t; } char16 *strdup16(const char16 *s) { char16 *buf; int len; len = strlen16(s); buf = Malloc((len + 1) * sizeof(char16)); if(!buf) return 0; strcpy16(buf, s); return buf; } size_t strlen16(const char16 *s) { int len = 0; while(*s++) len++; return len; } char16 *strchr16(const char16 *s, int c) { for( ; *s; s++) if(*s == c) return (char16 *)s; /* Is const bogus or what? */ return 0; } int strcmp16(const char16 *s1, const char16 *s2) { char16 c1, c2; while(1) { c1 = *s1++; c2 = *s2++; if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } } int strncmp16(const char16 *s1, const char16 *s2, size_t n) { char16 c1, c2; while(n-- > 0) { c1 = *s1++; c2 = *s2++; if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } return 0; } /* XXX only works for characters < 256 because Toupper does */ int strcasecmp16(const char16 *s1, const char16 *s2) { char16 c1, c2; while(1) { c1 = Toupper(*s1++); c2 = Toupper(*s2++); if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } } int strncasecmp16(const char16 *s1, const char16 *s2, size_t n) { char16 c1, c2; while(n-- > 0) { c1 = Toupper(*s1++); c2 = Toupper(*s2++); if(c1 == 0 && c2 == 0) return 0; if(c1 == 0) return -1; if(c2 == 0) return 1; if(c1 < c2) return -1; if(c1 > c2) return 1; } return 0; } /* A very naive implementation */ char16 *strstr16(const char16 *s1, const char16 *s2) { int len, first; first = s2[0]; if(first == 0) return (char16 *)s1; len = strlen16(s2); while((s1 = strchr16(s1, first))) { if(strncmp16(s1, s2, len) == 0) return (char16 *)s1; else s1++; } return 0; } speech_tools/rxp/url.c0000644000076400007640000004275307262605664013470 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifdef FOR_LT #include "lt-defs.h" #include "lt-memory.h" #include "lt-errmsg.h" #include "lt-comment.h" #include "lt-safe.h" #include "nsl-err.h" #define Strerror() strErr() #define Malloc salloc #define Realloc srealloc #define Free sfree #define fopen stdsfopen #else #include "system.h" #define LT_ERROR(err, format) fprintf(stderr, format) #define LT_ERROR1(err, format, arg) fprintf(stderr, format, arg) #define LT_ERROR2(err, format, arg1, arg2) fprintf(stderr, format, arg1, arg2) #define LT_ERROR3(err, format, arg1, arg2, arg3) fprintf(stderr, format, arg1, arg2, arg3) #define WARN(err, format) fprintf(stderr, format) #define WARN1(err, format, arg) fprintf(stderr, format, arg) #define Strerror() strerror(errno) #ifdef MAXPATHLEN #define CWDBS MAXPATHLEN+1 #else #define CWDBS 1025 #endif #define GETWD(buf) getcwd(buf,CWDBS) #endif /* FOR_LT */ #include #include #include #include #include #include /* that's where strerror is. really. */ #include #ifdef WIN32 #include #endif #ifdef SOCKETS_IMPLEMENTED #ifdef WIN32 #undef boolean #include #include #else #include #include #include #include #endif #endif #include "string16.h" #include "stdio16.h" #include "url.h" #ifdef HAVE_LIBZ #include "zlib.h" #ifdef macintosh #include #include #endif #endif static FILE16 *http_open(const char *url, const char *host, int port, const char *path, const char *type); static FILE16 *file_open(const char *url, const char *host, int port, const char *path, const char *type); static void parse_url(const char *url, char **scheme, char **host, int *port, char **path); /* Mapping of scheme names to opening functions */ struct { char *scheme; FILE16 *(*open)(const char *, const char *, int, const char *, const char *); } schemes[] = { {(char *)"http", http_open}, {(char *)"file", file_open}, }; #define NSCHEME (sizeof(schemes) / sizeof(schemes[0])) /* Construct a default base URL, essentially file:`pwd`/ */ char *default_base_url(void) { char buf[CWDBS]; char *url; if(!GETWD(buf)) { WARN(LEFILE, "Warning: can't get current directory for default base url\n"); return strdup8("file:/"); } #ifdef WIN32 /* DOS: translate C:\a\b to file:/C:/a/b/ */ /* XXX should we escape anything? */ { char *p; for(p=buf; *p; p++) if(*p == '\\') *p = '/'; } url = Malloc(6 + strlen(buf) + 2); sprintf(url, "file:/%s/", buf); #else #ifdef mac_filenames /* Mac: translate a:b to file:/a/b/ */ /* XXX should escape spaces and slashes, at least */ { char *p; for(p=buf; *p; p++) if(*p == ':') *p = '/'; /* Mac getcwd (always?) has a trailing separator, which we here bash */ if(*--p == '/') *p = 0; } url = Malloc(6 + strlen(buf) + 2); sprintf(url, "file:/%s/", buf); #else /* Unix: translate /a/b to file:/a/b/ */ url = Malloc(5 + strlen(buf) + 2); sprintf(url, "file:%s/", buf); #endif #endif return url; } /* * Merge a URL with a base URL if necessary. * The merged URL is returned. * The parts of the URL are returned in scheme, host, port and path * if these are non-null. * Caller should free the results. */ char *url_merge(const char *url, const char *base, char **_scheme, char **_host, int *_port, char **_path) { char *merged_scheme, *merged_host, *merged_path, *merged_url; char *scheme=0, *host=0, *path=0; char *base_scheme=0, *base_host=0, *base_path=0; char *default_base=0; int port, base_port, merged_port, i, j; char *p; /* First see if we have an absolute URL */ parse_url(url, &scheme, &host, &port, &path); if(scheme && (host || *path == '/')) { merged_scheme = scheme; merged_host = host; merged_port = port; merged_path = path; merged_url = strdup8(url); goto ok; } /* Relative URL, so we need the base URL */ if(!base) base = default_base = default_base_url(); parse_url(base, &base_scheme, &base_host, &base_port, &base_path); if(base_scheme && (base_host || *base_path == '/')) ; else { LT_ERROR1(LEFILE, "Error: bad base URL <%s>\n", base); goto bad; } /* Determine merged path */ if(path[0] == '/') { /* not relative, use as-is */ merged_path = path; path = 0; } else { /* relative, append to base path */ merged_path = Malloc(strlen(base_path) + strlen(path) + 1); strcpy(merged_path, base_path); /* strip last component of base */ for(i=strlen(merged_path)-1; i>=0 && merged_path[i] != '/'; i--) merged_path[i] = '\0'; /* append relative path */ strcat(merged_path, path); /* Remove . and .. components from path */ p = merged_path; for(i=0; p[i]; ) { assert(p[i] == '/'); /* find next segment */ for(j=i+1; p[j] && p[j] != '/'; j++) ; /* Do we have "." ? */ if(j - i == 2 && p[i+1] == '.') { strcpy(&p[i+1], p[j] ? &p[j+1] : &p[j]); continue; } /* Do we have "/.." with != ".." ? */ /* (We know we're not looking at "./" so we don't have to * worry about "./..") */ if(p[j] == '/' && p[j+1] == '.' && p[j+2] == '.' && (p[j+3] == '/' || p[j+3] == '\0') && (j - i != 3 || p[i+1] != '.' || p[i+2] != '.')) { strcpy(&p[i+1], p[j+3] ? &p[j+4] : &p[j+3]); i = 0; /* start again from beginning */ continue; } /* move to next segment */ i = j; } } /* Check for deviant relative URLs like file:foo */ if(scheme && !host && *path != '/') { if(strcmp(scheme, base_scheme) == 0) { WARN1(LEFILE, "Warning: relative URL <%s> contains scheme, contrary to RFC 1808\n", url); } else { LT_ERROR2(LEFILE, "Error: relative URL <%s> has scheme different from base <%s>\n", url, base); goto bad; } } /* Return the parts and the whole thing */ merged_scheme = base_scheme; if(scheme) Free(scheme); if(host) { merged_host = host; Free(base_host); merged_port = port; } else { merged_host = base_host; merged_port = base_port; } Free(path); Free(base_path); merged_url = Malloc(strlen(merged_scheme) + 1 + (merged_host ? 2 + strlen(merged_host) + 10 : 0) + strlen(merged_path) + 1); if(merged_host) { if(merged_port == -1) sprintf(merged_url, "%s://%s%s", merged_scheme, merged_host, merged_path); else sprintf(merged_url, "%s://%s:%d%s", merged_scheme, merged_host, merged_port, merged_path); } else sprintf(merged_url, "%s:%s", merged_scheme, merged_path); ok: Free(default_base); if(_scheme) *_scheme = merged_scheme; else Free(merged_scheme); if(_host) *_host = merged_host; else Free(merged_host); if(_port) *_port = merged_port; if(_path) *_path = merged_path; else Free(merged_path); return merged_url; bad: Free(default_base); Free(scheme); Free(host); Free(path); Free(base_scheme); Free(base_host); Free(base_path); return NULL; } /* * Open a stream to a URL. * url may be a relative URL, in which case it is merged with base, * which is typically the URL of the containing document. If base * is null, file:`pwd`/ is used, which is the right thing to do for * filenames. If base is "", there is no base URL and relative * URLs will fail. * If merged_url is non-null the resulting URL is stored in it. * If type begins "r", the URL is opened for reading, if "w" for * writing. Writing is only supported for file URLs. * If the type begins "rl", the data will be copied to a temporary * file so that seeking is possible (NOT YET IMPLEMENTED). * Returns a FILE16 for success, NULL for failure. */ FILE16 *url_open(const char *url, const char *base, const char *type, char **merged_url) { char *scheme, *host, *path, *m_url; int port, i; FILE16 *f; #ifdef HAVE_LIBZ int len, gzipped = 0; #endif /* Determine the merged URL */ if(!(m_url = url_merge(url, base, &scheme, &host, &port, &path))) return 0; #ifdef HAVE_LIBZ len = strlen(m_url); if(len > 3 && strcmp8(m_url+len-3, ".gz") == 0) gzipped = 1; #endif /* printf("<%s> <%s> <%d> <%s>\n", scheme, host ? host : "", port, path); printf("%s\n", m_url); */ /* Pass to the appropriate opening function */ for(i=0; ih_addr, hostent->h_length); addr.sin_port = htons((u_short)(port == -1 ? 80 : port)); /* Connect */ if(connect(s, (struct sockaddr *)&addr, sizeof(addr)) == -1) { LT_ERROR1(LEFILE, "Error: system call connect failed: %s\n", Strerror()); return 0; } #ifndef WIN32 #ifdef macintosh fin = fdopen(s, "rb"); setvbuf(fin, 0, _IONBF, 0); fout = fdopen(dup(s), "wb"); #else fin = fdopen(s, "r"); setvbuf(fin, 0, _IONBF, 0); fout = fdopen(dup(s), "w"); #endif #endif /* Send the request */ /* * Apparently on the Macintosh, \n might not be ASCII LF, so we'll * use numerics to be sure. */ #ifdef WIN32 sprintf(buf, "GET %s HTTP/1.0\012\015Connection: close\012\015\012\015", path); if (send(s,buf,strlen8(buf),0)==SOCKET_ERROR) { LT_ERROR1(LEFILE, "Error: system call socket failed: %d\n", WSAGetLastError()); /* XXX close the socket? */ return 0; }; #else fprintf(fout, "GET %s HTTP/1.0\012\015Connection: close\012\015\012\015", path); /* We used to test for errors after doing fclose, but this seemed to produce spurious errors under Linux (RedHat 4.2), so now we do fflush and test after that. */ fflush(fout); if(ferror(fout)) { LT_ERROR1(LEWRTF, "Error: write to socket failed: %s\n",Strerror()); fclose(fout); fclose(fin); return 0; } fclose(fout); #endif /* Read the status line */ #ifdef WIN32 for(i=0; i url && *p == ':') { *scheme = Malloc(p - url + 1); strncpy(*scheme, url, p - url); (*scheme)[p - url] = '\0'; url = p+1; } /* Does it have a net_loc? */ if(url[0] == '/' && url[1] == '/') { url += 2; for(p = (char *)url; *p; p++) if(*p == '/') break; /* Does it have a port number? */ for(q = p-1; q >= url; q--) if(!isdigit((int)*q)) break; if(q < p-1 && *q == ':') *port = atoi(q+1); else q = p; *host = Malloc(q - url + 1); strncpy(*host, url, q - url); (*host)[q - url] = '\0'; url = p; } /* The rest is the path */ if(*url) *path = strdup8(url); else *path = strdup8("/"); /* Windoze users have a tendency to use backslashes instead of slashes */ for(p=*path; *p; p++) if(*p == '\\') { if(!warned) { WARN1(LEFILE, "Warning: illegal backslashes in URL path \"%s\"" "replaced by slashes\n", url); warned = 1; } *p = '/'; } } speech_tools/rxp/ctype16.c0000644000076400007640000005027007262605664014152 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #ifdef FOR_LT #include "lt-defs.h" #endif #include "charset.h" #include "ctype16.h" static void init_xml_chartypes(void); unsigned char xml_char_map[1 << CHAR_SIZE]; void init_ctype16(void) { static int init_done = 0; if(!init_done) { init_xml_chartypes(); init_done = 1; } } /* XXX Tolower and Toupper only work for ISO-Latin-1 */ int Tolower(int c) { if(c < 0) /* Sigh, char is probably signed */ c &= 0xff; if((c >= 'A' && c <= 'Z') || (c >= 192 && c <= 214) || (c >= 216 && c <= 222)) return c + 32; else return c; } int Toupper(int c) { if(c < 0) /* Sigh, char is probably signed */ c &= 0xff; if((c >= 'a' && c <= 'z') || (c >= 224 && c <= 246) || (c >= 248 && c <= 254)) return c - 32; else return c; } /* * Notes: * XML spec says 255 is legal even though SGML doesn't. * XML spec says 181 (mu for units) is a letter - is this right? * XML spec says 183 bullet is an extender and thus a namechar. */ static void init_xml_chartypes(void) { int i; for(i = 0; i < 1 << CHAR_SIZE; i++) xml_char_map[i] = 0; /* Legal ASCII characters */ xml_char_map['\t'] |= xml_legal; xml_char_map['\r'] |= xml_legal; xml_char_map['\n'] |= xml_legal; for(i = ' '; i <= 127; i++) xml_char_map[i] |= xml_legal; /* ASCII Letters */ for(i = 'a'; i <= 'z'; i++) xml_char_map[i] |= (xml_namestart | xml_namechar); for(i = 'A'; i <= 'Z'; i++) xml_char_map[i] |= (xml_namestart | xml_namechar); /* ASCII Digits */ for(i = '0'; i <= '9'; i++) xml_char_map[i] |= xml_namechar; /* ASCII Whitespace */ xml_char_map[' '] |= xml_whitespace; xml_char_map['\t'] |= xml_whitespace; xml_char_map['\r'] |= xml_whitespace; xml_char_map['\n'] |= xml_whitespace; /* ASCII Others */ xml_char_map['_'] |= (xml_namestart | xml_namechar); xml_char_map[':'] |= (xml_namestart | xml_namechar); xml_char_map['.'] |= xml_namechar; xml_char_map['-'] |= xml_namechar; #if CHAR_SIZE == 8 /* Treat all non-ASCII chars as namestart, so we don't complain about legal documents. */ for(i = 0xa0; i <= 0xff; i++) xml_char_map[i] |= (xml_namestart | xml_namechar | xml_legal); #else /* Legal Unicode characters */ for(i = 0x80; i <= 0xd7ff; i++) xml_char_map[i] |= xml_legal; for(i = 0xe000; i <= 0xfffd; i++) xml_char_map[i] |= xml_legal; /* Latin-1 Letters */ for(i = 0xc0; i <= 0xd6; i++) xml_char_map[i] |= (xml_namestart | xml_namechar); for(i = 0xd8; i <= 0xf6; i++) xml_char_map[i] |= (xml_namestart | xml_namechar); for(i = 0xf8; i <= 0xff; i++) xml_char_map[i] |= (xml_namestart | xml_namechar); /* Latin-1 Others */ xml_char_map[0xb7] |= xml_namechar; /* raised dot (an extender) */ /* Derived from HTML text of PR-xml-971208 */ /* BaseChar */ #define X (xml_namestart | xml_namechar) for(i = 0x0100; i < 0x0131; i++) xml_char_map[i] |= X; for(i = 0x0134; i < 0x013e; i++) xml_char_map[i] |= X; for(i = 0x0141; i < 0x0148; i++) xml_char_map[i] |= X; for(i = 0x014a; i < 0x017e; i++) xml_char_map[i] |= X; for(i = 0x0180; i < 0x01c3; i++) xml_char_map[i] |= X; for(i = 0x01cd; i < 0x01f0; i++) xml_char_map[i] |= X; for(i = 0x01f4; i < 0x01f5; i++) xml_char_map[i] |= X; for(i = 0x01fa; i < 0x0217; i++) xml_char_map[i] |= X; for(i = 0x0250; i < 0x02a8; i++) xml_char_map[i] |= X; for(i = 0x02bb; i < 0x02c1; i++) xml_char_map[i] |= X; xml_char_map[0x0386] |= X; for(i = 0x0388; i < 0x038a; i++) xml_char_map[i] |= X; xml_char_map[0x038c] |= X; for(i = 0x038e; i < 0x03a1; i++) xml_char_map[i] |= X; for(i = 0x03a3; i < 0x03ce; i++) xml_char_map[i] |= X; for(i = 0x03d0; i < 0x03d6; i++) xml_char_map[i] |= X; xml_char_map[0x03da] |= X; xml_char_map[0x03dc] |= X; xml_char_map[0x03de] |= X; xml_char_map[0x03e0] |= X; for(i = 0x03e2; i < 0x03f3; i++) xml_char_map[i] |= X; for(i = 0x0401; i < 0x040c; i++) xml_char_map[i] |= X; for(i = 0x040e; i < 0x044f; i++) xml_char_map[i] |= X; for(i = 0x0451; i < 0x045c; i++) xml_char_map[i] |= X; for(i = 0x045e; i < 0x0481; i++) xml_char_map[i] |= X; for(i = 0x0490; i < 0x04c4; i++) xml_char_map[i] |= X; for(i = 0x04c7; i < 0x04c8; i++) xml_char_map[i] |= X; for(i = 0x04cb; i < 0x04cc; i++) xml_char_map[i] |= X; for(i = 0x04d0; i < 0x04eb; i++) xml_char_map[i] |= X; for(i = 0x04ee; i < 0x04f5; i++) xml_char_map[i] |= X; for(i = 0x04f8; i < 0x04f9; i++) xml_char_map[i] |= X; for(i = 0x0531; i < 0x0556; i++) xml_char_map[i] |= X; xml_char_map[0x0559] |= X; for(i = 0x0561; i < 0x0586; i++) xml_char_map[i] |= X; for(i = 0x05d0; i < 0x05ea; i++) xml_char_map[i] |= X; for(i = 0x05f0; i < 0x05f2; i++) xml_char_map[i] |= X; for(i = 0x0621; i < 0x063a; i++) xml_char_map[i] |= X; for(i = 0x0641; i < 0x064a; i++) xml_char_map[i] |= X; for(i = 0x0671; i < 0x06b7; i++) xml_char_map[i] |= X; for(i = 0x06ba; i < 0x06be; i++) xml_char_map[i] |= X; for(i = 0x06c0; i < 0x06ce; i++) xml_char_map[i] |= X; for(i = 0x06d0; i < 0x06d3; i++) xml_char_map[i] |= X; xml_char_map[0x06d5] |= X; for(i = 0x06e5; i < 0x06e6; i++) xml_char_map[i] |= X; for(i = 0x0905; i < 0x0939; i++) xml_char_map[i] |= X; xml_char_map[0x093d] |= X; for(i = 0x0958; i < 0x0961; i++) xml_char_map[i] |= X; for(i = 0x0985; i < 0x098c; i++) xml_char_map[i] |= X; for(i = 0x098f; i < 0x0990; i++) xml_char_map[i] |= X; for(i = 0x0993; i < 0x09a8; i++) xml_char_map[i] |= X; for(i = 0x09aa; i < 0x09b0; i++) xml_char_map[i] |= X; xml_char_map[0x09b2] |= X; for(i = 0x09b6; i < 0x09b9; i++) xml_char_map[i] |= X; for(i = 0x09dc; i < 0x09dd; i++) xml_char_map[i] |= X; for(i = 0x09df; i < 0x09e1; i++) xml_char_map[i] |= X; for(i = 0x09f0; i < 0x09f1; i++) xml_char_map[i] |= X; for(i = 0x0a05; i < 0x0a0a; i++) xml_char_map[i] |= X; for(i = 0x0a0f; i < 0x0a10; i++) xml_char_map[i] |= X; for(i = 0x0a13; i < 0x0a28; i++) xml_char_map[i] |= X; for(i = 0x0a2a; i < 0x0a30; i++) xml_char_map[i] |= X; for(i = 0x0a32; i < 0x0a33; i++) xml_char_map[i] |= X; for(i = 0x0a35; i < 0x0a36; i++) xml_char_map[i] |= X; for(i = 0x0a38; i < 0x0a39; i++) xml_char_map[i] |= X; for(i = 0x0a59; i < 0x0a5c; i++) xml_char_map[i] |= X; xml_char_map[0x0a5e] |= X; for(i = 0x0a72; i < 0x0a74; i++) xml_char_map[i] |= X; for(i = 0x0a85; i < 0x0a8b; i++) xml_char_map[i] |= X; xml_char_map[0x0a8d] |= X; for(i = 0x0a8f; i < 0x0a91; i++) xml_char_map[i] |= X; for(i = 0x0a93; i < 0x0aa8; i++) xml_char_map[i] |= X; for(i = 0x0aaa; i < 0x0ab0; i++) xml_char_map[i] |= X; for(i = 0x0ab2; i < 0x0ab3; i++) xml_char_map[i] |= X; for(i = 0x0ab5; i < 0x0ab9; i++) xml_char_map[i] |= X; xml_char_map[0x0abd] |= X; xml_char_map[0x0ae0] |= X; for(i = 0x0b05; i < 0x0b0c; i++) xml_char_map[i] |= X; for(i = 0x0b0f; i < 0x0b10; i++) xml_char_map[i] |= X; for(i = 0x0b13; i < 0x0b28; i++) xml_char_map[i] |= X; for(i = 0x0b2a; i < 0x0b30; i++) xml_char_map[i] |= X; for(i = 0x0b32; i < 0x0b33; i++) xml_char_map[i] |= X; for(i = 0x0b36; i < 0x0b39; i++) xml_char_map[i] |= X; xml_char_map[0x0b3d] |= X; for(i = 0x0b5c; i < 0x0b5d; i++) xml_char_map[i] |= X; for(i = 0x0b5f; i < 0x0b61; i++) xml_char_map[i] |= X; for(i = 0x0b85; i < 0x0b8a; i++) xml_char_map[i] |= X; for(i = 0x0b8e; i < 0x0b90; i++) xml_char_map[i] |= X; for(i = 0x0b92; i < 0x0b95; i++) xml_char_map[i] |= X; for(i = 0x0b99; i < 0x0b9a; i++) xml_char_map[i] |= X; xml_char_map[0x0b9c] |= X; for(i = 0x0b9e; i < 0x0b9f; i++) xml_char_map[i] |= X; for(i = 0x0ba3; i < 0x0ba4; i++) xml_char_map[i] |= X; for(i = 0x0ba8; i < 0x0baa; i++) xml_char_map[i] |= X; for(i = 0x0bae; i < 0x0bb5; i++) xml_char_map[i] |= X; for(i = 0x0bb7; i < 0x0bb9; i++) xml_char_map[i] |= X; for(i = 0x0c05; i < 0x0c0c; i++) xml_char_map[i] |= X; for(i = 0x0c0e; i < 0x0c10; i++) xml_char_map[i] |= X; for(i = 0x0c12; i < 0x0c28; i++) xml_char_map[i] |= X; for(i = 0x0c2a; i < 0x0c33; i++) xml_char_map[i] |= X; for(i = 0x0c35; i < 0x0c39; i++) xml_char_map[i] |= X; for(i = 0x0c60; i < 0x0c61; i++) xml_char_map[i] |= X; for(i = 0x0c85; i < 0x0c8c; i++) xml_char_map[i] |= X; for(i = 0x0c8e; i < 0x0c90; i++) xml_char_map[i] |= X; for(i = 0x0c92; i < 0x0ca8; i++) xml_char_map[i] |= X; for(i = 0x0caa; i < 0x0cb3; i++) xml_char_map[i] |= X; for(i = 0x0cb5; i < 0x0cb9; i++) xml_char_map[i] |= X; xml_char_map[0x0cde] |= X; for(i = 0x0ce0; i < 0x0ce1; i++) xml_char_map[i] |= X; for(i = 0x0d05; i < 0x0d0c; i++) xml_char_map[i] |= X; for(i = 0x0d0e; i < 0x0d10; i++) xml_char_map[i] |= X; for(i = 0x0d12; i < 0x0d28; i++) xml_char_map[i] |= X; for(i = 0x0d2a; i < 0x0d39; i++) xml_char_map[i] |= X; for(i = 0x0d60; i < 0x0d61; i++) xml_char_map[i] |= X; for(i = 0x0e01; i < 0x0e2e; i++) xml_char_map[i] |= X; xml_char_map[0x0e30] |= X; for(i = 0x0e32; i < 0x0e33; i++) xml_char_map[i] |= X; for(i = 0x0e40; i < 0x0e45; i++) xml_char_map[i] |= X; for(i = 0x0e81; i < 0x0e82; i++) xml_char_map[i] |= X; xml_char_map[0x0e84] |= X; for(i = 0x0e87; i < 0x0e88; i++) xml_char_map[i] |= X; xml_char_map[0x0e8a] |= X; xml_char_map[0x0e8d] |= X; for(i = 0x0e94; i < 0x0e97; i++) xml_char_map[i] |= X; for(i = 0x0e99; i < 0x0e9f; i++) xml_char_map[i] |= X; for(i = 0x0ea1; i < 0x0ea3; i++) xml_char_map[i] |= X; xml_char_map[0x0ea5] |= X; xml_char_map[0x0ea7] |= X; for(i = 0x0eaa; i < 0x0eab; i++) xml_char_map[i] |= X; for(i = 0x0ead; i < 0x0eae; i++) xml_char_map[i] |= X; xml_char_map[0x0eb0] |= X; for(i = 0x0eb2; i < 0x0eb3; i++) xml_char_map[i] |= X; xml_char_map[0x0ebd] |= X; for(i = 0x0ec0; i < 0x0ec4; i++) xml_char_map[i] |= X; for(i = 0x0f40; i < 0x0f47; i++) xml_char_map[i] |= X; for(i = 0x0f49; i < 0x0f69; i++) xml_char_map[i] |= X; for(i = 0x10a0; i < 0x10c5; i++) xml_char_map[i] |= X; for(i = 0x10d0; i < 0x10f6; i++) xml_char_map[i] |= X; xml_char_map[0x1100] |= X; for(i = 0x1102; i < 0x1103; i++) xml_char_map[i] |= X; for(i = 0x1105; i < 0x1107; i++) xml_char_map[i] |= X; xml_char_map[0x1109] |= X; for(i = 0x110b; i < 0x110c; i++) xml_char_map[i] |= X; for(i = 0x110e; i < 0x1112; i++) xml_char_map[i] |= X; xml_char_map[0x113c] |= X; xml_char_map[0x113e] |= X; xml_char_map[0x1140] |= X; xml_char_map[0x114c] |= X; xml_char_map[0x114e] |= X; xml_char_map[0x1150] |= X; for(i = 0x1154; i < 0x1155; i++) xml_char_map[i] |= X; xml_char_map[0x1159] |= X; for(i = 0x115f; i < 0x1161; i++) xml_char_map[i] |= X; xml_char_map[0x1163] |= X; xml_char_map[0x1165] |= X; xml_char_map[0x1167] |= X; xml_char_map[0x1169] |= X; for(i = 0x116d; i < 0x116e; i++) xml_char_map[i] |= X; for(i = 0x1172; i < 0x1173; i++) xml_char_map[i] |= X; xml_char_map[0x1175] |= X; xml_char_map[0x119e] |= X; xml_char_map[0x11a8] |= X; xml_char_map[0x11ab] |= X; for(i = 0x11ae; i < 0x11af; i++) xml_char_map[i] |= X; for(i = 0x11b7; i < 0x11b8; i++) xml_char_map[i] |= X; xml_char_map[0x11ba] |= X; for(i = 0x11bc; i < 0x11c2; i++) xml_char_map[i] |= X; xml_char_map[0x11eb] |= X; xml_char_map[0x11f0] |= X; xml_char_map[0x11f9] |= X; for(i = 0x1e00; i < 0x1e9b; i++) xml_char_map[i] |= X; for(i = 0x1ea0; i < 0x1ef9; i++) xml_char_map[i] |= X; for(i = 0x1f00; i < 0x1f15; i++) xml_char_map[i] |= X; for(i = 0x1f18; i < 0x1f1d; i++) xml_char_map[i] |= X; for(i = 0x1f20; i < 0x1f45; i++) xml_char_map[i] |= X; for(i = 0x1f48; i < 0x1f4d; i++) xml_char_map[i] |= X; for(i = 0x1f50; i < 0x1f57; i++) xml_char_map[i] |= X; xml_char_map[0x1f59] |= X; xml_char_map[0x1f5b] |= X; xml_char_map[0x1f5d] |= X; for(i = 0x1f5f; i < 0x1f7d; i++) xml_char_map[i] |= X; for(i = 0x1f80; i < 0x1fb4; i++) xml_char_map[i] |= X; for(i = 0x1fb6; i < 0x1fbc; i++) xml_char_map[i] |= X; xml_char_map[0x1fbe] |= X; for(i = 0x1fc2; i < 0x1fc4; i++) xml_char_map[i] |= X; for(i = 0x1fc6; i < 0x1fcc; i++) xml_char_map[i] |= X; for(i = 0x1fd0; i < 0x1fd3; i++) xml_char_map[i] |= X; for(i = 0x1fd6; i < 0x1fdb; i++) xml_char_map[i] |= X; for(i = 0x1fe0; i < 0x1fec; i++) xml_char_map[i] |= X; for(i = 0x1ff2; i < 0x1ff4; i++) xml_char_map[i] |= X; for(i = 0x1ff6; i < 0x1ffc; i++) xml_char_map[i] |= X; xml_char_map[0x2126] |= X; for(i = 0x212a; i < 0x212b; i++) xml_char_map[i] |= X; xml_char_map[0x212e] |= X; for(i = 0x2180; i < 0x2182; i++) xml_char_map[i] |= X; for(i = 0x3041; i < 0x3094; i++) xml_char_map[i] |= X; for(i = 0x30a1; i < 0x30fa; i++) xml_char_map[i] |= X; for(i = 0x3105; i < 0x312c; i++) xml_char_map[i] |= X; for(i = 0xac00; i < 0xd7a3; i++) xml_char_map[i] |= X; /* CombiningChar */ #undef X #define X xml_namechar for(i = 0x0300; i < 0x0345; i++) xml_char_map[i] |= X; for(i = 0x0360; i < 0x0361; i++) xml_char_map[i] |= X; for(i = 0x0483; i < 0x0486; i++) xml_char_map[i] |= X; for(i = 0x0591; i < 0x05a1; i++) xml_char_map[i] |= X; for(i = 0x05a3; i < 0x05b9; i++) xml_char_map[i] |= X; xml_char_map[0x05bb] |= X; xml_char_map[0x05bd] |= X; xml_char_map[0x05bf] |= X; for(i = 0x05c1; i < 0x05c2; i++) xml_char_map[i] |= X; xml_char_map[0x05c4] |= X; xml_char_map[0x064b] |= X; xml_char_map[0x0652] |= X; xml_char_map[0x0670] |= X; for(i = 0x06d6; i < 0x06dc; i++) xml_char_map[i] |= X; xml_char_map[0x06dd] |= X; xml_char_map[0x06df] |= X; for(i = 0x06e0; i < 0x06e4; i++) xml_char_map[i] |= X; for(i = 0x06e7; i < 0x06e8; i++) xml_char_map[i] |= X; for(i = 0x06ea; i < 0x06ed; i++) xml_char_map[i] |= X; for(i = 0x0901; i < 0x0903; i++) xml_char_map[i] |= X; xml_char_map[0x093c] |= X; for(i = 0x093e; i < 0x094c; i++) xml_char_map[i] |= X; xml_char_map[0x094d] |= X; for(i = 0x0951; i < 0x0954; i++) xml_char_map[i] |= X; for(i = 0x0962; i < 0x0963; i++) xml_char_map[i] |= X; for(i = 0x0981; i < 0x0983; i++) xml_char_map[i] |= X; xml_char_map[0x09bc] |= X; xml_char_map[0x09be] |= X; xml_char_map[0x09bf] |= X; for(i = 0x09c0; i < 0x09c4; i++) xml_char_map[i] |= X; for(i = 0x09c7; i < 0x09c8; i++) xml_char_map[i] |= X; for(i = 0x09cb; i < 0x09cd; i++) xml_char_map[i] |= X; xml_char_map[0x09d7] |= X; for(i = 0x09e2; i < 0x09e3; i++) xml_char_map[i] |= X; xml_char_map[0x0a02] |= X; xml_char_map[0x0a3c] |= X; xml_char_map[0x0a3e] |= X; xml_char_map[0x0a3f] |= X; for(i = 0x0a40; i < 0x0a42; i++) xml_char_map[i] |= X; for(i = 0x0a47; i < 0x0a48; i++) xml_char_map[i] |= X; for(i = 0x0a4b; i < 0x0a4d; i++) xml_char_map[i] |= X; for(i = 0x0a70; i < 0x0a71; i++) xml_char_map[i] |= X; for(i = 0x0a81; i < 0x0a83; i++) xml_char_map[i] |= X; xml_char_map[0x0abc] |= X; for(i = 0x0abe; i < 0x0ac5; i++) xml_char_map[i] |= X; for(i = 0x0ac7; i < 0x0ac9; i++) xml_char_map[i] |= X; for(i = 0x0acb; i < 0x0acd; i++) xml_char_map[i] |= X; for(i = 0x0b01; i < 0x0b03; i++) xml_char_map[i] |= X; xml_char_map[0x0b3c] |= X; for(i = 0x0b3e; i < 0x0b43; i++) xml_char_map[i] |= X; for(i = 0x0b47; i < 0x0b48; i++) xml_char_map[i] |= X; for(i = 0x0b4b; i < 0x0b4d; i++) xml_char_map[i] |= X; for(i = 0x0b56; i < 0x0b57; i++) xml_char_map[i] |= X; for(i = 0x0b82; i < 0x0b83; i++) xml_char_map[i] |= X; for(i = 0x0bbe; i < 0x0bc2; i++) xml_char_map[i] |= X; for(i = 0x0bc6; i < 0x0bc8; i++) xml_char_map[i] |= X; for(i = 0x0bca; i < 0x0bcd; i++) xml_char_map[i] |= X; xml_char_map[0x0bd7] |= X; for(i = 0x0c01; i < 0x0c03; i++) xml_char_map[i] |= X; for(i = 0x0c3e; i < 0x0c44; i++) xml_char_map[i] |= X; for(i = 0x0c46; i < 0x0c48; i++) xml_char_map[i] |= X; for(i = 0x0c4a; i < 0x0c4d; i++) xml_char_map[i] |= X; for(i = 0x0c55; i < 0x0c56; i++) xml_char_map[i] |= X; for(i = 0x0c82; i < 0x0c83; i++) xml_char_map[i] |= X; for(i = 0x0cbe; i < 0x0cc4; i++) xml_char_map[i] |= X; for(i = 0x0cc6; i < 0x0cc8; i++) xml_char_map[i] |= X; for(i = 0x0cca; i < 0x0ccd; i++) xml_char_map[i] |= X; for(i = 0x0cd5; i < 0x0cd6; i++) xml_char_map[i] |= X; for(i = 0x0d02; i < 0x0d03; i++) xml_char_map[i] |= X; for(i = 0x0d3e; i < 0x0d43; i++) xml_char_map[i] |= X; for(i = 0x0d46; i < 0x0d48; i++) xml_char_map[i] |= X; for(i = 0x0d4a; i < 0x0d4d; i++) xml_char_map[i] |= X; xml_char_map[0x0d57] |= X; xml_char_map[0x0e31] |= X; for(i = 0x0e34; i < 0x0e3a; i++) xml_char_map[i] |= X; for(i = 0x0e47; i < 0x0e4e; i++) xml_char_map[i] |= X; xml_char_map[0x0eb1] |= X; for(i = 0x0eb4; i < 0x0eb9; i++) xml_char_map[i] |= X; for(i = 0x0ebb; i < 0x0ebc; i++) xml_char_map[i] |= X; for(i = 0x0ec8; i < 0x0ecd; i++) xml_char_map[i] |= X; for(i = 0x0f18; i < 0x0f19; i++) xml_char_map[i] |= X; xml_char_map[0x0f35] |= X; xml_char_map[0x0f37] |= X; xml_char_map[0x0f39] |= X; xml_char_map[0x0f3e] |= X; xml_char_map[0x0f3f] |= X; for(i = 0x0f71; i < 0x0f84; i++) xml_char_map[i] |= X; for(i = 0x0f86; i < 0x0f8b; i++) xml_char_map[i] |= X; for(i = 0x0f90; i < 0x0f95; i++) xml_char_map[i] |= X; xml_char_map[0x0f97] |= X; for(i = 0x0f99; i < 0x0fad; i++) xml_char_map[i] |= X; for(i = 0x0fb1; i < 0x0fb7; i++) xml_char_map[i] |= X; xml_char_map[0x0fb9] |= X; for(i = 0x20d0; i < 0x20dc; i++) xml_char_map[i] |= X; xml_char_map[0x20e1] |= X; for(i = 0x302a; i < 0x302f; i++) xml_char_map[i] |= X; xml_char_map[0x3099] |= X; xml_char_map[0x309a] |= X; /* Digit */ #undef X #define X xml_namechar for(i = 0x0030; i < 0x0039; i++) xml_char_map[i] |= X; for(i = 0x0660; i < 0x0669; i++) xml_char_map[i] |= X; for(i = 0x06f0; i < 0x06f9; i++) xml_char_map[i] |= X; for(i = 0x0966; i < 0x096f; i++) xml_char_map[i] |= X; for(i = 0x09e6; i < 0x09ef; i++) xml_char_map[i] |= X; for(i = 0x0a66; i < 0x0a6f; i++) xml_char_map[i] |= X; for(i = 0x0ae6; i < 0x0aef; i++) xml_char_map[i] |= X; for(i = 0x0b66; i < 0x0b6f; i++) xml_char_map[i] |= X; for(i = 0x0be7; i < 0x0bef; i++) xml_char_map[i] |= X; for(i = 0x0c66; i < 0x0c6f; i++) xml_char_map[i] |= X; for(i = 0x0ce6; i < 0x0cef; i++) xml_char_map[i] |= X; for(i = 0x0d66; i < 0x0d6f; i++) xml_char_map[i] |= X; for(i = 0x0e50; i < 0x0e59; i++) xml_char_map[i] |= X; for(i = 0x0ed0; i < 0x0ed9; i++) xml_char_map[i] |= X; for(i = 0x0f20; i < 0x0f29; i++) xml_char_map[i] |= X; /* Extender */ #undef X #define X xml_namechar xml_char_map[0x02d0] |= X; xml_char_map[0x02d1] |= X; xml_char_map[0x0387] |= X; xml_char_map[0x0640] |= X; xml_char_map[0x0e46] |= X; xml_char_map[0x0ec6] |= X; xml_char_map[0x3005] |= X; for(i = 0x3031; i < 0x3035; i++) xml_char_map[i] |= X; for(i = 0x309d; i < 0x309e; i++) xml_char_map[i] |= X; for(i = 0x30fc; i < 0x30fe; i++) xml_char_map[i] |= X; /* Ideographic */ #undef X #define X (xml_namestart | xml_namechar) for(i = 0x4e00; i < 0x9fa5; i++) xml_char_map[i] |= X; xml_char_map[0x3007] |= X; for(i = 0x3021; i < 0x3029; i++) xml_char_map[i] |= X; #undef X #endif } speech_tools/rxp/input.c0000644000076400007640000003051007262605664014011 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ /* * This code is in a distressed state due to hackery for windoze. * See comment in url.c. */ #include #include #include #ifdef FOR_LT #include "lt-memory.h" #include "nsllib.h" #define ERR(m) LT_ERROR(NECHAR,m) #define ERR1(m,x) LT_ERROR1(NECHAR,m,x) #define ERR2(m,x,y) LT_ERROR2(NECHAR,m,x,y) #define ERR3(m,x,y,z) LT_ERROR3(NECHAR,m,x,y,z) #define Malloc salloc #define Realloc srealloc #define Free sfree #else #include "system.h" #define ERR(m) fprintf(stderr,m) #define ERR1(m,x) fprintf(stderr,m,x) #define ERR2(m,x,y) fprintf(stderr,m,x,y) #define ERR3(m,x,y,z) fprintf(stderr,m,x,y,z) #endif #include "charset.h" #include "string16.h" #include "dtd.h" #include "input.h" #include "url.h" #include "ctype16.h" static int get_translated_line1(InputSource s); InputSource SourceFromStream(const char8 *description, FILE *file) { Entity e; e = NewExternalEntity(0, 0, description, 0, 0); if(!strchr8(description, '/')) EntitySetBaseURL(e, default_base_url()); return NewInputSource(e, MakeFILE16FromFILE(file, "r")); } InputSource EntityOpen(Entity e) { FILE16 *f16; if(e->type == ET_external) { const char8 *url = EntityURL(e); if(!url || !(f16 = url_open(url, 0, "r", 0))) return 0; } else { f16 = MakeFILE16FromString((char *)e->text, -1, "r"); } return NewInputSource(e, f16); } InputSource NewInputSource(Entity e, FILE16 *f16) { InputSource source; if(!(source = Malloc(sizeof(*source)))) return 0; source->line = 0; source->line_alloc = 0; source->line_length = 0; source->next = 0; source->seen_eoe = 0; source->entity = e; source->file16 = f16; source->bytes_consumed = 0; source->bytes_before_current_line = 0; source->line_end_was_cr = 0; source->line_number = 0; source->not_read_yet = 1; source->nextin = source->insize = 0; source->parent = 0; return source; } int SourceLineAndChar(InputSource s, int *linenum, int *charnum) { Entity e = s->entity, f = e->parent; if(e->type == ET_external) { *linenum = s->line_number; *charnum = s->next; return 1; } if(f && f->type == ET_external) { if(e->matches_parent_text) { *linenum = e->line_offset + s->line_number; *charnum = (s->line_number == 0 ? e->line1_char_offset : 0) + s->next; return 1; } else { *linenum = e->line_offset; *charnum = e->line1_char_offset; return 0; } } if(f && f->matches_parent_text) { *linenum = f->line_offset + e->line_offset; *charnum = (e->line_offset == 0 ? f->line1_char_offset : 0) + e->line1_char_offset; return 0; } return -1; } void SourcePosition(InputSource s, Entity *entity, int *byte_offset) { *entity = s->entity; *byte_offset = SourceTell(s); } int SourceTell(InputSource s) { #if CHAR_SIZE == 8 return s->bytes_before_current_line + s->next; #else switch(s->entity->encoding) { case CE_ISO_10646_UCS_2B: case CE_UTF_16B: case CE_ISO_10646_UCS_2L: case CE_UTF_16L: return s->bytes_before_current_line + 2 * s->next; case CE_ISO_8859_1: case CE_ISO_8859_2: case CE_ISO_8859_3: case CE_ISO_8859_4: case CE_ISO_8859_5: case CE_ISO_8859_6: case CE_ISO_8859_7: case CE_ISO_8859_8: case CE_ISO_8859_9: case CE_unspecified_ascii_superset: return s->bytes_before_current_line + s->next; case CE_UTF_8: if(s->complicated_utf8_line) { /* examine earlier chars in line to see how many bytes they used */ int i, c, n=0; for(i = 0; i < s->next; i++) { c = s->line[i]; if(c <= 0x7f) n += 1; else if(c <= 0x7ff) n += 2; else if(c >= 0xd800 && c <= 0xdfff) /* One of a surrogate pair, count 2 each */ n += 2; else if(c <= 0xffff) n += 3; else if(c <= 0x1ffff) n += 4; else if(c <= 0x3ffffff) n += 5; else n += 6; } return s->bytes_before_current_line + n; } else return s->bytes_before_current_line + s->next; default: return -1; } #endif } int SourceSeek(InputSource s, int offset) { s->line_length = 0; s->next = 0; s->seen_eoe = 0; s->bytes_consumed = s->bytes_before_current_line = offset; s->nextin = s->insize = 0; /* XXX line number will be wrong! */ s->line_number = -999999; return Fseek(s->file16, offset, SEEK_SET); } static int get_translated_line(InputSource s) { /* This is a hack, pending some reorganisation */ struct _FILE16 { void *handle; int handle2, handle3; /* we don't need the rest here */ }; Entity e = s->entity; Char *p; struct _FILE16 *f16 = (struct _FILE16 *)s->file16; if(e->type == ET_external) return get_translated_line1(s); if(!*(Char *)((char *)f16->handle + f16->handle2)) { s->line_length = 0; return 0; } s->line = (Char *)((char *)f16->handle + f16->handle2); for(p=s->line; *p && *p != '\n'; p++) ; if(*p) p++; f16->handle2 = (char *)p - (char *)f16->handle; s->line_length = p - s->line; s->bytes_before_current_line = f16->handle2; return 0; } static int get_translated_line1(InputSource s) { unsigned int c; /* can't use Char, it might be >0x10000 */ unsigned char *inbuf = s->inbuf; int nextin = s->nextin, insize = s->insize; int startin = s->nextin; Char *outbuf = s->line; int outsize = s->line_alloc; int nextout = 0; int remaining = 0; int ignore_linefeed = s->line_end_was_cr; #if CHAR_SIZE == 16 int *to_unicode = 0; /* initialize to shut gcc up */ CharacterEncoding enc = s->entity->encoding; int more, i; s->complicated_utf8_line = 0; if(enc >= CE_ISO_8859_2 && enc <= CE_ISO_8859_9) to_unicode = iso_to_unicode[enc - CE_ISO_8859_2]; #endif s->line_end_was_cr = 0; s->bytes_before_current_line = s->bytes_consumed; while(1) { /* There are never more characters than bytes in the input */ if(outsize < nextout + (insize - nextin)) { outsize = nextout + (insize - nextin); outbuf = Realloc(outbuf, outsize * sizeof(Char)); } while(nextin < insize) { #if CHAR_SIZE == 8 c = inbuf[nextin++]; #else switch(enc) { case CE_ISO_10646_UCS_2B: case CE_UTF_16B: if(nextin+2 > insize) goto more_bytes; c = (inbuf[nextin] << 8) + inbuf[nextin+1]; nextin += 2; break; case CE_ISO_10646_UCS_2L: case CE_UTF_16L: if(nextin+2 > insize) goto more_bytes; c = (inbuf[nextin+1] << 8) + inbuf[nextin]; nextin += 2; break; case CE_ISO_8859_1: case CE_unspecified_ascii_superset: c = inbuf[nextin++]; break; case CE_ISO_8859_2: case CE_ISO_8859_3: case CE_ISO_8859_4: case CE_ISO_8859_5: case CE_ISO_8859_6: case CE_ISO_8859_7: case CE_ISO_8859_8: case CE_ISO_8859_9: c = to_unicode[inbuf[nextin++]]; if(c == (unsigned int)-1) ERR3("Illegal %s character <0x%x> " "at file offset %d\n", CharacterEncodingName[enc], inbuf[nextin-1], s->bytes_consumed + nextin - 1 - startin); break; case CE_UTF_8: c = inbuf[nextin++]; if(c <= 0x7f) break; if(c <= 0xc0 || c >= 0xfe) { ERR2("Illegal UTF-8 start byte <0x%x> " "at file offset %d\n", c, s->bytes_consumed + nextin - 1 - startin); return -1; } if(c <= 0xdf) { c &= 0x1f; more = 1; } else if(c <= 0xef) { c &= 0x0f; more = 2; } else if(c <= 0xf7) { c &= 0x07; more = 3; } else if(c <= 0xfb) { c &= 0x03; more = 4; } else { c &= 0x01; more = 5; } if(nextin+more > insize) { nextin--; goto more_bytes; } s->complicated_utf8_line = 1; for(i=0; i 0x110000 || (c < 0x10000 && !is_xml_legal(c))) if(!(enc == CE_UTF_16L || enc == CE_UTF_16B) || c < 0xd800 || c > 0xdfff) /* We treat the surrogates as legal because we didn't combine them when translating from UTF-16. XXX */ { ERR2("Error: illegal character <0x%x> " "immediately before file offset %d\n", c, s->bytes_consumed + nextin - startin); return -1; } #endif if(c == '\n' && ignore_linefeed) { /* Ignore lf at start of line if last line ended with cr */ ignore_linefeed = 0; s->bytes_before_current_line += (nextin - startin); } else { ignore_linefeed = 0; if(c == '\r') { s->line_end_was_cr = 1; c = '\n'; } #if CHAR_SIZE == 16 if(c >= 0x10000) { /* Use surrogates */ outbuf[nextout++] = ((c - 0x10000) >> 10) + 0xd800; outbuf[nextout++] = ((c - 0x10000) & 0x3ff) + 0xdc00; } else outbuf[nextout++] = c; #else outbuf[nextout++] = c; #endif if(c == '\n') { s->nextin = nextin; s->insize = insize; s->bytes_consumed += (nextin - startin); s->line = outbuf; s->line_alloc = outsize; s->line_length = nextout; return 0; } } } #if CHAR_SIZE == 16 more_bytes: /* Copy down any partial character */ remaining = insize - nextin; for(i=0; ibytes_consumed += (nextin - startin); insize = Readu(s->file16, inbuf+insize-nextin, sizeof(s->inbuf)-remaining); nextin = startin = 0; if(insize <= 0) { s->nextin = nextin; s->insize = 0; s->line = outbuf; s->line_alloc = outsize; s->line_length = nextout; return insize; } insize += remaining; } } void determine_character_encoding(InputSource s) { Entity e = s->entity; int nread; unsigned char *b = (unsigned char *)s->inbuf; b[0] = b[1] = b[2] = b[3] = 0; while(s->insize < 4) { nread = Readu(s->file16, s->inbuf + s->insize, 4 - s->insize); if(nread == -1) return; if(nread == 0) break; s->insize += nread; } #if 0 if(b[0] == 0 && b[1] == 0 && b[2] == 0 && b[3] == '<') e->encoding = CE_ISO_10646_UCS_4B; else if(b[0] == '<' && b[1] == 0 && b[2] == 0 && b[3] == 0) e->encoding = CE_ISO_10646_UCS_4L; else #endif if(b[0] == 0xfe && b[1] == 0xff) { e->encoding = CE_UTF_16B; s->nextin = 2; } else if(b[0] == 0 && b[1] == '<' && b[2] == 0 && b[3] == '?') e->encoding = CE_UTF_16B; else if(b[0] == 0xff && b[1] == 0xfe) { e->encoding = CE_UTF_16L; s->nextin = 2; } else if(b[0] == '<' && b[1] == 0 && b[2] == '?' && b[3] == 0) e->encoding = CE_UTF_16L; else { #if CHAR_SIZE == 8 e->encoding = CE_unspecified_ascii_superset; #else e->encoding = CE_UTF_8; #endif } } int get_with_fill(InputSource s) { assert(!s->seen_eoe); if(get_translated_line(s) != 0) { /* It would be nice to pass this up to the parser, but we don't know anything about parsers here! */ ERR1("I/O error on stream <%s>, ignore further errors\n", EntityDescription(s->entity)); /* Restore old line and return EOE (is this the best thing to do?) */ s->line_length = s->next; s->seen_eoe = 1; return XEOE; } if(s->line_length == 0) { /* Restore old line */ s->line_length = s->next; s->seen_eoe = 1; return XEOE; } s->next = 0; if(s->not_read_yet) s->not_read_yet = 0; else s->line_number++; return s->line[s->next++]; } speech_tools/rxp/stdio16.c0000644000076400007640000005010307262605664014143 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ /* * An implementation of printf that * - allows printing of 16-bit unicode characters and strings * - translates output to a specified character set * * "char8" is 8 bits and contains ISO-Latin-1 (or ASCII) values * "char16" is 16 bits and contains UTF-16 values * "Char" is char8 or char16 depending on whether CHAR_SIZE is 8 or 16 * * Author: Richard Tobin */ #include #include #include #include #ifdef FOR_LT #include "lt-memory.h" #include "nsl-err.h" #define ERR(m) LT_ERROR(NECHAR,m) #define ERR1(m,x) LT_ERROR1(NECHAR,m,x) #define ERR2(m,x,y) LT_ERROR2(NECHAR,m,x,y) #define Malloc salloc #define Realloc srealloc #define Free sfree #else #include "system.h" #define WIN_IMP #define ERR(m) fprintf(stderr,m) #define ERR1(m,x) fprintf(stderr,m,x) #define ERR2(m,x,y) fprintf(stderr,m,x,y) #endif #ifdef WIN32 #undef boolean #include #include #endif #include "charset.h" #include "string16.h" #include "stdio16.h" /* When we return -1 for non-io errors, we set errno to 0 to avoid confusion */ #include #define BufferSize 4096 typedef int ReadProc(FILE16 *file, unsigned char *buf, int max_count); typedef int WriteProc(FILE16 *file, const unsigned char *buf, int count); typedef int SeekProc(FILE16 *file, long offset, int ptrname); typedef int FlushProc(FILE16 *file); typedef int CloseProc(FILE16 *file); struct _FILE16 { void *handle; int handle2, handle3; ReadProc *read; WriteProc *write; SeekProc *seek; FlushProc *flush; CloseProc *close; int flags; CharacterEncoding enc; char16 save; }; #define FILE16_read 0x01 #define FILE16_write 0x02 #define FILE16_close_underlying 0x04 static int FileRead(FILE16 *file, unsigned char *buf, int max_count); static int FileWrite(FILE16 *file, const unsigned char *buf, int count); static int FileSeek(FILE16 *file, long offset, int ptrname); static int FileClose(FILE16 *file); static int FileFlush(FILE16 *file); static int StringRead(FILE16 *file, unsigned char *buf, int max_count); static int StringWrite(FILE16 *file, const unsigned char *buf, int count); static int StringSeek(FILE16 *file, long offset, int ptrname); static int StringClose(FILE16 *file); static int StringFlush(FILE16 *file); #ifdef WIN32 #ifdef SOCKETS_IMPLEMENTED static int WinsockRead(FILE16 *file, unsigned char *buf, int max_count); static int WinsockWrite(FILE16 *file, const unsigned char *buf, int count); static int WinsockSeek(FILE16 *file, long offset, int ptrname); static int WinsockClose(FILE16 *file); static int WinsockFlush(FILE16 *file); #endif #endif #ifdef HAVE_LIBZ static int GzipRead(FILE16 *file, unsigned char *buf, int max_count); static int GzipWrite(FILE16 *file, const unsigned char *buf, int count); static int GzipSeek(FILE16 *file, long offset, int ptrname); static int GzipClose(FILE16 *file); static int GzipFlush(FILE16 *file); #endif FILE16 *Stdin, *Stdout, *Stderr; void init_stdio16(void) { Stdin = MakeFILE16FromFILE(stdin, "r"); SetFileEncoding(Stdin, CE_ISO_8859_1); Stdout = MakeFILE16FromFILE(stdout, "w"); SetFileEncoding(Stdout, CE_ISO_8859_1); Stderr = MakeFILE16FromFILE(stderr, "w"); SetFileEncoding(Stderr, CE_ISO_8859_1); } static int ConvertASCII(const char8 *buf, int count, FILE16 *file); static int ConvertUTF16(const char16 *buf, int count, FILE16 *file); /* Output an ASCII buffer in the specified encoding */ /* In fact, we don't translate the buffer at all if we are outputting an 8-bit encoding, and we treat it as Latin-1 is we are outputting a 16-bit encoding. This means that all the various ASCII supersets will be passed through unaltered in the usual case, since we don't translate them on input either. */ static int ConvertASCII(const char8 *buf, int count, FILE16 *file) { unsigned char outbuf[BufferSize*2]; int i, j; switch(file->enc) { case CE_ISO_8859_1: case CE_ISO_8859_2: case CE_ISO_8859_3: case CE_ISO_8859_4: case CE_ISO_8859_5: case CE_ISO_8859_6: case CE_ISO_8859_7: case CE_ISO_8859_8: case CE_ISO_8859_9: case CE_unspecified_ascii_superset: return file->write(file, (unsigned char *)buf, count); case CE_UTF_8: for(i=j=0; i> 6); outbuf[j++] = 0x80 + (c & 0x3f); } } return file->write(file, outbuf, j); case CE_UTF_16B: case CE_ISO_10646_UCS_2B: for(i=j=0; iwrite(file, outbuf, count*2); case CE_UTF_16L: case CE_ISO_10646_UCS_2L: for(i=j=0; iwrite(file, outbuf, count*2); default: ERR2("Bad output character encoding %d (%s)\n", file->enc, file->enc < CE_enum_count ? CharacterEncodingName[file->enc] : "unknown"); errno = 0; return -1; } } /* Output a UTF-16 buffer in the specified encoding */ static int ConvertUTF16(const char16 *buf, int count, FILE16 *file) { /* size is max for UTF-8 with saved first half */ unsigned char outbuf[BufferSize*3 + 1]; int i, j, tablenum, max; char8 *from_unicode; char32 big; switch(file->enc) { case CE_ISO_8859_1: case CE_unspecified_ascii_superset: for(i=0; iwrite(file, outbuf, count); case CE_ISO_8859_2: case CE_ISO_8859_3: case CE_ISO_8859_4: case CE_ISO_8859_5: case CE_ISO_8859_6: case CE_ISO_8859_7: case CE_ISO_8859_8: case CE_ISO_8859_9: tablenum = (file->enc - CE_ISO_8859_2); max = iso_max_val[tablenum]; from_unicode = unicode_to_iso[tablenum]; for(i=0; iwrite(file, outbuf, count); case CE_UTF_8: for(i=j=0; i> 6); outbuf[j++] = 0x80 + (buf[i] & 0x3f); } else if(buf[i] >= 0xd800 && buf[i] <= 0xdbff) file->save = buf[i]; else if(buf[i] >= 0xdc00 && buf[i] <= 0xdfff) { big = 0x10000 + ((file->save - 0xd800) << 10) + (buf[i] - 0xdc00); outbuf[j++] = 0xf0 + (big >> 18); outbuf[j++] = 0x80 + ((big >> 12) & 0x3f); outbuf[j++] = 0x80 + ((big >> 6) & 0x3f); outbuf[j++] = 0x80 + (big & 0x3f); } else { outbuf[j++] = 0xe0 + (buf[i] >> 12); outbuf[j++] = 0x80 + ((buf[i] >> 6) & 0x3f); outbuf[j++] = 0x80 + (buf[i] & 0x3f); } } return file->write(file, outbuf, j); case CE_UTF_16B: case CE_ISO_10646_UCS_2B: for(i=j=0; i> 8); outbuf[j++] = (buf[i] & 0xff); } return file->write(file, outbuf, count*2); case CE_UTF_16L: case CE_ISO_10646_UCS_2L: for(i=j=0; i> 8); } return file->write(file, outbuf, count*2); default: ERR2("Bad output character encoding %d (%s)\n", file->enc, file->enc < CE_enum_count ? CharacterEncodingName[file->enc] : "unknown"); errno = 0; return -1; } } int Readu(FILE16 *file, unsigned char *buf, int max_count) { return file->read(file, buf, max_count); } int Writeu(FILE16 *file, unsigned char *buf, int count) { return file->write(file, buf, count); } int Fclose(FILE16 *file) { int ret = 0; ret = file->close(file); Free(file); return ret; } int Fseek(FILE16 *file, long offset, int ptrname) { return file->seek(file, offset, ptrname); } int Fflush(FILE16 *file) { return file->flush(file); } FILE *GetFILE(FILE16 *file) { if(file->read == FileRead) return (FILE *)file->handle; else return 0; } void SetCloseUnderlying(FILE16 *file, int cu) { if(cu) file->flags |= FILE16_close_underlying; else file->flags &= ~FILE16_close_underlying; } void SetFileEncoding(FILE16 *file, CharacterEncoding encoding) { file->enc = encoding; } CharacterEncoding GetFileEncoding(FILE16 *file) { return file->enc; } int Fprintf(FILE16 *file, const char *format, ...) { va_list args; va_start(args, format); return Vfprintf(file, format, args); } int Printf(const char *format, ...) { va_list args; va_start(args, format); return Vfprintf(Stdout, format, args); } int Sprintf(void *buf, CharacterEncoding enc, const char *format, ...) { va_list args; va_start(args, format); return Vsprintf(buf, enc, format, args); } int Vprintf(const char *format, va_list args) { return Vfprintf(Stdout, format, args); } int Vsprintf(void *buf, CharacterEncoding enc, const char *format, va_list args) { int nchars; FILE16 file = {0, 0, -1, StringRead, StringWrite, StringSeek, StringFlush, StringClose, FILE16_write}; file.handle = buf; file.enc = enc; nchars = Vfprintf(&file, format, args); file.close(&file); /* Fclose would try to free it */ return nchars; } #define put(x) {nchars++; if(count == sizeof(buf)) {if(ConvertASCII(buf, count, file) == -1) return -1; count = 0;} buf[count++] = x;} int Vfprintf(FILE16 *file, const char *format, va_list args) { char8 buf[BufferSize]; int count = 0; int c, i, n, width, prec; char fmt[200]; char8 val[200]; const char8 *start; const char8 *p; const char16 *q; char16 cbuf[1]; int mflag, pflag, sflag, hflag, zflag; int l, h, L; int nchars = 0; while((c = *format++)) { if(c != '%') { put(c); continue; } start = format-1; width = 0; prec = -1; mflag=0, pflag=0, sflag=0, hflag=0, zflag=0; l=0, h=0, L=0; while(1) { switch(c = *format++) { case '-': mflag = 1; break; case '+': pflag = 1; break; case ' ': sflag = 1; break; case '#': hflag = 1; break; case '0': zflag = 1; break; default: goto flags_done; } } flags_done: if(c == '*') { width = va_arg(args, int); c = *format++; } else if(c >= '0' && c <= '9') { width = c - '0'; while((c = *format++) >= '0' && c <= '9') width = width * 10 + c - '0'; } if(c == '.') { c = *format++; if(c == '*') { prec = va_arg(args, int); c = *format++; } else if(c >= '0' && c <= '9') { prec = c - '0'; while((c = *format++) >= '0' && c <= '9') prec = prec * 10 + c - '0'; } else prec = 0; } switch(c) { case 'l': l = 1; c = *format++; break; case 'h': h = 1; c = *format++; break; #ifdef HAVE_LONG_DOUBLE case 'L': L = 1; c = *format++; break; #endif } if(format - start + 1 > sizeof(fmt)) { ERR("Printf: format specifier too long"); errno = 0; return -1; } strncpy(fmt, start, format - start); fmt[format - start] = '\0'; /* XXX should check it fits in val */ switch(c) { case 'n': *va_arg(args, int *) = nchars; break; case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': if(h) sprintf(val, fmt, va_arg(args, int)); /* promoted to int */ else if(l) sprintf(val, fmt, va_arg(args, long)); else sprintf(val, fmt, va_arg(args, int)); for(p=val; *p; p++) put(*p); break; case 'f': case 'e': case 'E': case 'g': case 'G': #ifdef HAVE_LONG_DOUBLE if(L) sprintf(val, fmt, va_arg(args, long double)); else #endif sprintf(val, fmt, va_arg(args, double)); for(p=val; *p; p++) put(*p); break; case 'c': #if CHAR_SIZE == 16 if(ConvertASCII(buf, count, file) == -1) return -1; count = 0; cbuf[0] = va_arg(args, int); if(ConvertUTF16(cbuf, 1, file) == -1) return -1; #else (void)cbuf; put(va_arg(args, int)); #endif break; case 'p': sprintf(val, fmt, va_arg(args, void *)); for(p=val; *p; p++) put(*p); break; case '%': put('%'); break; case 's': if(l) { static char16 sNULL[] = {'(','N','U','L','L',')',0}; #if CHAR_SIZE == 16 string: #endif q = va_arg(args, char16 *); if(!q) q = sNULL; n = strlen16(q); if(prec >= 0 && n > prec) n = prec; if(n < width && !mflag) for(i=width-n; i>0; i--) put(' '); if(ConvertASCII(buf, count, file) == -1) return -1; count = 0; nchars += n; while(n > 0) { /* ConvertUTF16 can only handle <= BufferSize chars */ if(ConvertUTF16(q, n > BufferSize ? BufferSize : n, file) == -1) return -1; n -= BufferSize; q += BufferSize; } } else { #if CHAR_SIZE == 8 string: #endif p = va_arg(args, char8 *); if(!p) p = "(null)"; n = strlen(p); if(prec >= 0 && n > prec) n = prec; if(n < width && !mflag) for(i=width-n; i>0; i--) put(' '); for(i=0; i0; i--) put(' '); break; case 'S': goto string; default: ERR1("unknown format character %c\n", c); errno = 0; return -1; } } if(count > 0) if(ConvertASCII(buf, count, file) == -1) return -1; return nchars; } static FILE16 *MakeFILE16(const char *type) { FILE16 *file; if(!(file = Malloc(sizeof(*file)))) return 0; file->flags = 0; if(*type == 'r') file->flags |= FILE16_read; else file->flags |= FILE16_write; file->enc = InternalCharacterEncoding; return file; } FILE16 *MakeFILE16FromFILE(FILE *f, const char *type) { FILE16 *file; if(!(file = MakeFILE16(type))) return 0; file->read = FileRead; file->write = FileWrite; file->seek = FileSeek; file->close = FileClose; file->flush = FileFlush; file->handle = f; return file; } static int FileRead(FILE16 *file, unsigned char *buf, int max_count) { FILE *f = file->handle; int count = 0; count = fread(buf, 1, max_count, f); return ferror(f) ? -1 : count; } static int FileWrite(FILE16 *file, const unsigned char *buf, int count) { FILE *f = file->handle; if(count == 0) return 0; return fwrite(buf, 1, count, f) == 0 ? -1 : 0; } static int FileSeek(FILE16 *file, long offset, int ptrname) { FILE *f = file->handle; return fseek(f, offset, ptrname); } static int FileClose(FILE16 *file) { FILE *f = file->handle; return (file->flags & FILE16_close_underlying) ? fclose(f) : 0; } static int FileFlush(FILE16 *file) { FILE *f = file->handle; return fflush(f); } FILE16 *MakeFILE16FromString(void *buf, long size, const char *type) { FILE16 *file; if(!(file = MakeFILE16(type))) return 0; file->read = StringRead; file->write = StringWrite; file->seek = StringSeek; file->close = StringClose; file->flush = StringFlush; file->handle = buf; file->handle2 = 0; file->handle3 = size; return file; } static int StringRead(FILE16 *file, unsigned char *buf, int max_count) { char *p = (char *)file->handle + file->handle2; if(file->handle3 >= 0 && file->handle2 + max_count > file->handle3) max_count = file->handle3 - file->handle2; if(max_count <= 0) return 0; memcpy(buf, p, max_count); file->handle2 += max_count; return max_count; } static int StringWrite(FILE16 *file, const unsigned char *buf, int count) { char *p = (char *)file->handle + file->handle2; if(file->handle3 >= 0 && file->handle2 + count > file->handle3) return -1; memcpy(p, buf, count); file->handle2 += count; return 0; } static int StringSeek(FILE16 *file, long offset, int ptrname) { switch(ptrname) { case SEEK_CUR: offset = file->handle2 + offset; break; case SEEK_END: if(file->handle3 < 0) return -1; offset = file->handle3 + offset; break; } if(file->handle3 >= 0 && offset > file->handle3) return -1; file->handle2 = offset; return 0; } static int StringClose(FILE16 *file) { static char8 null = 0; if(file->flags & FILE16_write) ConvertASCII(&null, 1, file); /* null terminate */ if(file->flags & FILE16_close_underlying) Free((char *)file->handle); return 0; } static int StringFlush(FILE16 *file) { return 0; } #ifdef WIN32 #ifdef SOCKETS_IMPLEMENTED FILE16 *MakeFILE16FromWinsock(int sock, const char *type) { FILE16 *file; if(!(file = MakeFILE16(type))) return 0; file->read = WinsockRead; file->write = WinsockWrite; file->seek = WinsockSeek; file->close = WinsockClose; file->flush = WinsockFlush; file->handle2 = sock; return file; } static int WinsockRead(FILE16 *file, unsigned char *buf, int max_count) { int f = (int)file->handle2; int count; /* "Relax" said the nightman, we are programmed to recv() */ count = recv(f, buf, max_count, 0); return count; } static int WinsockWrite(FILE16 *file, const unsigned char *buf, int count) { /* Not yet implemented */ return -1; } static int WinsockSeek(FILE16 *file, long offset, int ptrname) { return -1; } static int WinsockClose(FILE16 *file) { /* What should happen here? XXX */ return 0; } static int WinsockFlush(FILE16 *file) { return 0; } #endif #endif #ifdef HAVE_LIBZ FILE16 *MakeFILE16FromGzip(gzFile f, const char *type) { FILE16 *file; if(!(file = MakeFILE16(type))) return 0; file->read = GzipRead; file->write = GzipWrite; file->seek = GzipSeek; file->close = GzipClose; file->flush = GzipFlush; file->handle = (void *)f; return file; } static int GzipRead(FILE16 *file, unsigned char *buf, int max_count) { gzFile f = (gzFile)file->handle; int count = 0; int gzerr; const char *errorString; count = gzread(f, buf, max_count); errorString = gzerror(f, &gzerr); if(gzerr != 0 && gzerr != Z_STREAM_END) return -1; return count; } static int GzipWrite(FILE16 *file, const unsigned char *buf, int count) { gzFile f = (gzFile)file->handle; int gzerr; const char *errorString; count = gzwrite(f, (char *)buf, count); errorString = gzerror(f, &gzerr); if(gzerr != 0 && gzerr != Z_STREAM_END) return -1; return count; } static int GzipSeek(FILE16 *file, long offset, int ptrname) { return -1; } static int GzipClose(FILE16 *file) { gzFile f = (gzFile)file->handle; return (file->flags & FILE16_close_underlying) ? gzclose(f) : 0; } static int GzipFlush(FILE16 *file) { return 0; } #endif #ifdef test int main(int argc, char **argv) { short s=3; int n, c; char16 S[] = {'w', 'o', 'r', 'l', 'd', ' ', '' & 0xff, 0xd841, 0xdc42, 0}; n=Printf(argv[1], s, 98765432, &c, 5.3, 3.2L, "hello", S); printf("\nreturned %d, c=%d\n", n, c); n=Printf(argv[1], s, 98765432, &c, 5.3, 3.2L, "hello", S); printf("\nreturned %d, c=%d\n", n, c); n=Printf(argv[1], s, 98765432, &c, 5.3, 3.2L, "hello", S); printf("\nreturned %d, c=%d\n", n, c); n=Printf(argv[1], s, 98765432, &c, 5.3, 3.2L, "hello", S); printf("\nreturned %d, c=%d\n", n, c); return 0; } #endif speech_tools/rxp/system.c0000644000076400007640000000267407262605664014210 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ #include #include "stdio16.h" #include "system.h" void *Malloc(int bytes) { void *mem = malloc(bytes); if(!mem) Fprintf(Stderr, "malloc failed\n"); return mem; } void *Realloc(void *mem, int bytes) { mem = mem ? realloc(mem, bytes) : malloc(bytes); if(!mem) Fprintf(Stderr, "realloc failed\n"); return mem; } void Free(void *mem) { if (mem != 0) free(mem); } speech_tools/rxp/xmlparser.c0000644000076400007640000021107010045556421014656 0ustar awbawb/*************************************************************************/ /* */ /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */ /* University of Edinburgh. */ /* */ /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */ /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */ /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /*************************************************************************/ /* $Id: xmlparser.c,v 1.3 2004/05/04 00:00:17 awb Exp $ */ #ifndef lint static char vcid[] = "$Id: xmlparser.c,v 1.3 2004/05/04 00:00:17 awb Exp $"; #endif /* lint */ /* * XML (and nSGML) parser. * Author: Richard Tobin. */ #include #include #ifdef FOR_LT #include "lt-memory.h" #include "nsllib.h" #define Malloc salloc #define Realloc srealloc #define Free sfree #else #include "system.h" #endif #include "charset.h" #include "string16.h" #include "ctype16.h" #include "dtd.h" #include "input.h" #include "stdio16.h" #include "xmlparser.h" static int transcribe(Parser p, int back, int count); static void pop_while_at_eoe(Parser p); static void maybe_uppercase(Parser p, Char *s); static void maybe_uppercase_name(Parser p); static int str_maybecase_cmp8(Parser p, const char8 *a, const char8 *b); static int is_ascii_alpha(int c); static int is_ascii_digit(int c); static int parse_external_id(Parser p, int required, char8 **publicid, char8 **systemid, int preq, int sreq); static int parse_conditional(Parser p); static int parse_notation_decl(Parser p); static int parse_entity_decl(Parser p, Entity ent, int line, int chpos); static int parse_attlist_decl(Parser p); static int parse_element_decl(Parser p); static ContentParticle parse_cp(Parser p); static ContentParticle parse_choice_or_seq(Parser p); static ContentParticle parse_choice_or_seq_1(Parser p, int nchildren,char sep); static int check_content_decl(Parser p, ContentParticle cp); static int check_content_decl_1(Parser p, ContentParticle cp); static Char *stringify_cp(ContentParticle cp); static void print_cp(ContentParticle cp, FILE16 *f); static int size_cp(ContentParticle cp); void FreeContentParticle(ContentParticle cp); static int parse_reference(Parser p, int pe, int expand, int allow_external); static int parse_character_reference(Parser p, int expand); static const char8 *escape(int c); static int parse_name(Parser p, const char8 *where); static int parse_nmtoken(Parser p, const char8 *where); static int looking_at(Parser p, const char8 *string); static void clear_xbit(XBit xbit); static int expect(Parser p, int expected, const char8 *where); static int expect_dtd_whitespace(Parser p, const char8 *where); static void skip_whitespace(InputSource s); static int skip_dtd_whitespace(Parser p, int allow_pe); static int parse_cdata(Parser p); static int process_nsl_decl(Parser p); static int process_xml_decl(Parser p); static int parse_dtd(Parser p); static int read_markupdecls(Parser p); static int error(Parser p, const char8 *format, ...); static void warn(Parser p, const char8 *format, ...); static void verror(XBit bit, const char8 *format, va_list args); enum literal_type {LT_cdata_attr, LT_tok_attr, LT_plain, LT_entity}; static int parse_string(Parser p, const char8 *where, enum literal_type type); static int parse_pi(Parser p); static int parse_comment(Parser p, int skip); static int parse_pcdata(Parser p); static int parse_starttag(Parser p); static int parse_attribute(Parser p); static int parse_endtag(Parser p); static int parse_markup(Parser p); static int parse(Parser p); static int parse_markupdecl(Parser p); #define require(x) if(x >= 0) {} else return -1 #define require0(x) if(x >= 0) {} else return 0 #define Consume(buf) (buf = 0, buf##size = 0) #define ExpandBuf(buf, sz) \ if(buf##size >= (sz)+1) {} else if((buf = Realloc(buf, (buf##size = sz + 1) * sizeof(Char)))) {} else return error(p, "System error") #define CopyName(n) if((n = Malloc((p->namelen + 1)*sizeof(Char)))) {memcpy(n, p->name, p->namelen * sizeof(Char)); n[p->namelen] = 0;} else return error(p, "System error"); #define CopyName0(n) if((n = Malloc((p->namelen + 1)*sizeof(Char)))) {memcpy(n, p->name, p->namelen * sizeof(Char)); n[p->namelen] = 0;} else {error(p, "System error"); return 0;} const char8 *XBitTypeName[XBIT_enum_count] = { "dtd", "start", "empty", "end", "eof", "pcdata", "pi", "comment", "cdsect", "xml", "error", "warning", "none" }; static Entity xml_builtin_entity; static Entity xml_predefined_entities; int ParserInit(void) { static int initialised = 0; Entity e, f; int i; static const Char lt[] = {'l','t',0}, ltval[] = {'&','#','6','0',';',0}; static const Char gt[] = {'g','t',0}, gtval[] = {'&','#','6','2',';',0}; static const Char amp[] = {'a','m','p',0}, ampval[] = {'&','#','3','8',';',0}; static const Char apos[] = {'a','p','o','s',0}, aposval[] = {'\'',0}; static const Char quot[] = {'q','u','o','t',0}, quotval[] = {'"',0}; static const Char *builtins[5][2] = { {lt, ltval}, {gt, gtval}, {amp, ampval}, {apos, aposval}, {quot, quotval} }; (void)vcid; if(initialised) return 0; initialised = 1; init_charset(); init_ctype16(); init_stdio16(); for(i=0, f=0; i<5; i++, f=e) { e = NewInternalEntity(builtins[i][0], builtins[i][1], xml_builtin_entity, 0, 0, 0); if(!e) return -1; e->next = f; } xml_predefined_entities = e; return 0; } static void skip_whitespace(InputSource s) { int c; while((c = get(s)) != XEOE && is_xml_whitespace(c)) ; unget(s); } /* * Skip whitespace and (optionally) the start and end of PEs. Return 1 if * there actually *was* some whitespace or a PE start/end, -1 if * an error occurred, 0 otherwise. */ static int skip_dtd_whitespace(Parser p, int allow_pe) { int c; int got_some = 0; InputSource s = p->source; while(1) { c = get(s); if(c == XEOE) { got_some = 1; if(s->parent) { if(!allow_pe) return error(p, "PE end not allowed here in internal subset"); if(s->entity->type == ET_external) p->external_pe_depth--; ParserPop(p); s = p->source; } else { unget(s); /* leave the final EOE waiting to be read */ return got_some; } } else if(is_xml_whitespace(c)) { got_some = 1; } else if(c == '%') { /* this complication is needed for source; if(s->entity->type == ET_external) p->external_pe_depth++; got_some = 1; } else { unget(s); return got_some; } } else { unget(s); return got_some; } } } static int expect(Parser p, int expected, const char8 *where) { int c; InputSource s = p->source; c = get(s); if(c != expected) { unget(s); /* For error position */ return error(p, "Expected %s %s, but got %s", escape(expected), where, escape(c)); } return 0; } /* * Expects whitespace or the start or end of a PE. */ static int expect_dtd_whitespace(Parser p, const char8 *where) { int r = skip_dtd_whitespace(p, p->external_pe_depth > 0); if(r < 0) return -1; if(r == 0) return error(p, "Expected whitespace %s", where); return 0; } static void clear_xbit(XBit xbit) { xbit->type = XBIT_none; xbit->s1 = xbit->s2 = 0; xbit->S1 = xbit->S2 = 0; xbit->attributes = 0; xbit->element_definition = 0; } void FreeXBit(XBit xbit) { Attribute a, b; if(xbit->S1) Free(xbit->S1); if(xbit->S2) Free(xbit->S2); if(xbit->type != XBIT_error && xbit->type != XBIT_warning && xbit->s1) Free(xbit->s1); if(xbit->s2) Free(xbit->s2); for(a = xbit->attributes; a; a = b) { b = a->next; if(a->value) Free(a->value); Free(a); } clear_xbit(xbit); } /* * Returns 1 if the input matches string (and consume the input). * Otherwise returns 0 and leaves the input stream where it was. * Case-sensitivity depends on the CaseInsensitive flag. * A space character at end of string matches any (non-zero) amount of * whitespace; space are treated literally elsewhere. * Never reads beyond an end-of-line, except to consume * extra whitespace when the last character of string is a space. * Never reads beyond end-of-entity. */ static int looking_at(Parser p, const char8 *string) { InputSource s = p->source; int c, d; int save = s->next; for(c = *string++; c; c = *string++) { if(at_eol(s)) goto fail; /* We would go over a line end */ d = get(s); if(c == ' ' && *string == 0) { if(d == XEOE || !is_xml_whitespace(d)) goto fail; skip_whitespace(s); } else if((ParserGetFlag(p, CaseInsensitive) && Toupper(d) != Toupper(c)) || (!ParserGetFlag(p, CaseInsensitive) && d != c)) goto fail; } return 1; fail: s->next = save; return 0; } static int parse_name(Parser p, const char8 *where) { InputSource s = p->source; int c, i; c = get(s); if(c == XEOE || !is_xml_namestart(c)) { unget(s); /* For error position */ error(p, "Expected name, but got %s %s", escape(c), where); return -1; } i = 1; while(c = get(s), (c != XEOE && is_xml_namechar(c))) i++; unget(s); p->name = s->line + s->next - i; p->namelen = i; return 0; } static int parse_nmtoken(Parser p, const char8 *where) { InputSource s = p->source; int c, i=0; while(c = get(s), (c !=XEOE && is_xml_namechar(c))) i++; unget(s); if(i == 0) return error(p, "Expected nmtoken value, but got %s %s", escape(c), where); p->name = s->line + s->next - i; p->namelen = i; return 0; } /* Escape a character for printing n an error message. NB returns 5 static storage buffers in rotation. */ static const char8 *escape(int c) { static char8 buf[5][15]; static int bufnum=-1; #if CHAR_SIZE == 8 if(c != XEOE) c &= 0xff; #endif bufnum = (bufnum + 1) % 5; if(c == XEOE) return ""; else if(c >= 33 && c <= 126) sprintf(buf[bufnum], "%c", c); else if(c == ' ') sprintf(buf[bufnum], ""); else sprintf(buf[bufnum], "<0x%x>", c); return buf[bufnum]; } Parser NewParser(void) { Parser p; if(ParserInit() == -1) return 0; p = Malloc(sizeof(*p)); if(!p) return 0; p->state = PS_prolog1; p->document_entity = 0; /* Set at first ParserPush */ p->have_dtd = 0; p->standalone = SDD_unspecified; p->flags = 0; p->source = 0; clear_xbit(&p->xbit); #ifndef FOR_LT p->xbit.nchildren = 0; /* These three should never be changed */ p->xbit.children = 0; p->xbit.parent = 0; #endif p->pbufsize = p->pbufnext = 0; p->pbuf = 0; p->peeked = 0; p->dtd = NewDtd(); p->dtd_callback = p->warning_callback = 0; p->entity_opener = 0; p->callback_arg = 0; p->external_pe_depth = 0; p->element_stack = 0; p->element_stack_alloc = 0; p->element_depth = 0; ParserSetFlag(p, XMLPiEnd, 1); ParserSetFlag(p, XMLEmptyTagEnd, 1); ParserSetFlag(p, XMLPredefinedEntities, 1); ParserSetFlag(p, XMLExternalIDs, 1); ParserSetFlag(p, XMLMiscWFErrors, 1); ParserSetFlag(p, ErrorOnUnquotedAttributeValues, 1); ParserSetFlag(p, XMLLessThan, 1); ParserSetFlag(p, IgnoreEntities, 0); ParserSetFlag(p, ExpandGeneralEntities, 1); ParserSetFlag(p, ExpandCharacterEntities, 1); ParserSetFlag(p, NormaliseAttributeValues, 1); ParserSetFlag(p, WarnOnUndefinedElements, 1); ParserSetFlag(p, WarnOnUndefinedAttributes, 1); ParserSetFlag(p, WarnOnRedefinitions, 1); ParserSetFlag(p, TrustSDD, 1); ParserSetFlag(p, ReturnComments, 1); ParserSetFlag(p, CheckEndTagsMatch, 1); return p; } void FreeParser(Parser p) { while (p->source) ParserPop(p); /* Will close file */ Free(p->pbuf); Free(p->element_stack); Free(p); } InputSource ParserRootSource(Parser p) { InputSource s; for(s=p->source; s && s->parent; s = s->parent) ; return s; } Entity ParserRootEntity(Parser p) { return ParserRootSource(p)->entity; } void ParserSetCallbackArg(Parser p, void *arg) { p->callback_arg = arg; } void ParserSetDtdCallback(Parser p, CallbackProc cb) { p->dtd_callback = cb; } void ParserSetWarningCallback(Parser p, CallbackProc cb) { p->warning_callback = cb; } void ParserSetEntityOpener(Parser p, EntityOpenerProc opener) { p->entity_opener = opener; } #ifndef FOR_LT XBit ReadXTree(Parser p) { XBit bit, tree, child; XBit *children; bit = ReadXBit(p); switch(bit->type) { case XBIT_error: return bit; case XBIT_start: if(!(tree = Malloc(sizeof(*tree)))) { error(p, "System error"); return &p->xbit; } *tree = *bit; while(1) { child = ReadXTree(p); switch(child->type) { case XBIT_error: FreeXTree(tree); return child; case XBIT_eof: FreeXTree(tree); { error(p, "EOF in element"); return &p->xbit; } case XBIT_end: if(child->element_definition != tree->element_definition) { const Char *name1 = tree->element_definition->name, *name2 = child->element_definition->name; FreeXTree(tree); FreeXTree(child); error(p, "Mismatched end tag: expected , got ", name1, name2); return &p->xbit; } FreeXTree(child); return tree; default: children = Realloc(tree->children, (tree->nchildren + 1) * sizeof(XBit)); if(!children) { FreeXTree(tree); FreeXTree(child); error(p, "System error"); return &p->xbit; } child->parent = tree; children[tree->nchildren] = child; tree->nchildren++; tree->children = children; break; } } default: if(!(tree = Malloc(sizeof(*tree)))) { error(p, "System error"); return &p->xbit; } *tree = *bit; return tree; } } void FreeXTree(XBit tree) { int i; for(i=0; inchildren; i++) FreeXTree(tree->children[i]); Free(tree->children); FreeXBit(tree); if(tree->type == XBIT_error) /* error "trees" are always in the Parser structure, not malloced */ return; Free(tree); } #endif /* (not) FOR_LT */ XBit ReadXBit(Parser p) { if(p->peeked) p->peeked = 0; else parse(p); return &p->xbit; } XBit PeekXBit(Parser p) { if(p->peeked) error(p, "Attempt to peek twice"); else { parse(p); p->peeked = 1; } return &p->xbit; } int ParserPush(Parser p, InputSource source) { if(!p->source && !p->document_entity) p->document_entity = source->entity; source->parent = p->source; p->source = source; if(source->entity->type == ET_internal) return 0; /* Look at first few bytes of external entities to guess encoding, then look for an XMLDecl or TextDecl. */ if(source->entity->encoding == CE_unknown) /* we might already know */ determine_character_encoding(source); #if CHAR_SIZE == 8 if(!EncodingIsAsciiSuperset(source->entity->encoding)) return error(p, "Unsupported character encoding %s", CharacterEncodingName[source->entity->encoding]); #else if(source->entity->encoding == CE_unknown) return error(p, "Unknown character encoding"); #endif get(source); unget(source); /* To get the first line read */ source->entity->ml_decl = ML_unspecified; if(looking_at(p, "entity == p->document_entity && !source->entity->version_decl) return error(p, "XML declaration in document entity lacked " "version number"); if(source->entity != p->document_entity && source->entity->standalone_decl != SDD_unspecified) return error(p, "Standalone attribute not allowed except in " "document entity"); return 0; } else if(!ParserGetFlag(p, XMLStrictWFErrors) && looking_at(p, "source; Fclose(source->file16); p->source = source->parent; if(source->entity->type == ET_external) Free(source->line); Free(source); } /* Returns true if the source is at EOE. If so, the EOE will have been read. */ static int at_eoe(InputSource s) { if(!at_eol(s)) return 0; if(s->seen_eoe || get_with_fill(s) == XEOE) return 1; unget(s); return 0; } /* Pops any sources that are at EOE. Leaves source buffer with at least one character in it (except at EOF, where it leaves the EOE unread). */ static void pop_while_at_eoe(Parser p) { while(1) { InputSource s = p->source; if(!at_eoe(s)) return; if(!s->parent) { unget(s); return; } ParserPop(p); } } void ParserSetFlag(Parser p, ParserFlag flag, int value) { if(value) p->flags |= (1 << flag); else p->flags &= ~(1 << flag); if(flag == XMLPredefinedEntities) { if(value) p->dtd->predefined_entities = xml_predefined_entities; else p->dtd->predefined_entities = 0; } } void ParserPerror(Parser p, XBit bit) { int linenum, charnum; InputSource s; Fprintf(Stderr, "%s: %s\n", bit->type == XBIT_error ? "Error" : "Warning", bit->error_message); for(s=p->source; s; s=s->parent) { if(s->entity->name) Fprintf(Stderr, " in entity \"%S\"", s->entity->name); else Fprintf(Stderr, " in unnamed entity"); switch(SourceLineAndChar(s, &linenum, &charnum)) { case 1: Fprintf(Stderr, " at line %d char %d of", linenum+1, charnum+1); break; case 0: Fprintf(Stderr, " defined at line %d char %d of", linenum+1, charnum+1); break; case -1: Fprintf(Stderr, " defined in"); break; } Fprintf(Stderr, " %s\n", EntityDescription(s->entity)); } } static int parse(Parser p) { int c; InputSource s; if(p->state == PS_end || p->state == PS_error) { /* After an error or EOF, just keep returning EOF */ p->xbit.type = XBIT_eof; return 0; } clear_xbit(&p->xbit); if(p->state <= PS_prolog2 || p->state == PS_epilog) skip_whitespace(p->source); restart: pop_while_at_eoe(p); s = p->source; SourcePosition(s, &p->xbit.entity, &p->xbit.byte_offset); switch(c = get(s)) { case XEOE: if(p->state != PS_epilog) return error(p, "Document ends too soon"); p->state = PS_end; p->xbit.type = XBIT_eof; return 0; case '<': return parse_markup(p); case '&': if(ParserGetFlag(p, IgnoreEntities)) goto pcdata; if(p->state <= PS_prolog2) return error(p, "Entity reference not allowed in prolog"); if(looking_at(p, "#")) { /* a character reference - go back and parse as pcdata */ unget(s); goto pcdata; } if(ParserGetFlag(p, ExpandGeneralEntities)) { /* an entity reference - push it and start again */ require(parse_reference(p, 0, 1, 1)); goto restart; } /* not expanding general entities, so treat as pcdata */ goto pcdata; default: pcdata: unget(s); return parse_pcdata(p); } } /* Called after reading '<' */ static int parse_markup(Parser p) { InputSource s = p->source; int c = get(s); switch(c) { case '!': if(looking_at(p, "--")) { if(ParserGetFlag(p, ReturnComments)) return parse_comment(p, 0); else { require(parse_comment(p, 1)); return parse(p); } } else if(looking_at(p, "DOCTYPE ")) return parse_dtd(p); else if(looking_at(p, "[CDATA[")) return parse_cdata(p); else return error(p, "Syntax error after xbit.type = XBIT_end; require(parse_name(p, "after element_depth <= 0) return error(p, "End tag outside of any element", p->namelen, p->name); ent = p->element_stack[--p->element_depth].entity; def = p->element_stack[p->element_depth].definition; if(p->namelen == def->namelen && memcmp(p->name, def->name, p->namelen * sizeof(Char)) == 0) p->xbit.element_definition = def; else return error(p, "Mismatched end tag: expected , got ", def->name, p->namelen, p->name); if(ent != p->source->entity) return error(p, "Element ends in different entity from that " "in which it starts"); if(p->element_depth == 0) p->state = PS_epilog; } else { p->xbit.element_definition = FindElementN(p->dtd, p->name, p->namelen); if(!p->xbit.element_definition) return error(p, "End tag for unknown element %.*S", p->namelen, p->name); } skip_whitespace(p->source); return expect(p, '>', "after name in end tag"); } static int parse_starttag(Parser p) { int c; if(p->state == PS_epilog && !ParserGetFlag(p, AllowMultipleElements)) return error(p, "Document contains multiple elements"); p->state = PS_body; require(parse_name(p, "after <")); maybe_uppercase_name(p); p->xbit.element_definition = FindElementN(p->dtd, p->name, p->namelen); if(!p->xbit.element_definition || p->xbit.element_definition->tentative) { if(p->have_dtd && ParserGetFlag(p, ErrorOnUndefinedElements)) return error(p, "Start tag for undeclared element %.*S", p->namelen, p->name); if(p->have_dtd && ParserGetFlag(p, WarnOnUndefinedElements)) warn(p, "Start tag for undeclared element %.*S; " "declaring it to have content ANY", p->namelen, p->name); if(p->xbit.element_definition) RedefineElement(p->xbit.element_definition, CT_any, 0); else { if(!(p->xbit.element_definition = DefineElementN(p->dtd, p->name, p->namelen, CT_any, 0))) return error(p, "System error"); } } while(1) { InputSource s = p->source; /* We could just do skip_whitespace here, but we will get a better error message if we look a bit closer. */ c = get(s); if(c !=XEOE && is_xml_whitespace(c)) { skip_whitespace(s); c = get(s); } else if(c != '>' && !(ParserGetFlag(p, XMLEmptyTagEnd) && c == '/')) { unget(s); /* For error position */ return error(p, "Expected whitespace or tag end in start tag"); } if(c == '>') { p->xbit.type = XBIT_start; break; } if((ParserGetFlag(p, XMLEmptyTagEnd)) && c == '/') { require(expect(p, '>', "after / in start tag")); p->xbit.type = XBIT_empty; break; } unget(s); require(parse_attribute(p)); } if(ParserGetFlag(p, CheckEndTagsMatch)) { if(p->xbit.type == XBIT_start) { if(p->element_depth == p->element_stack_alloc) { p->element_stack_alloc = p->element_stack_alloc == 0 ? 20 : p->element_stack_alloc * 2; if(!(p->element_stack = Realloc(p->element_stack, (p->element_stack_alloc * sizeof(*p->element_stack))))) return error(p, "System error"); } p->element_stack[p->element_depth].definition = p->xbit.element_definition; p->element_stack[p->element_depth++].entity = p->source->entity; } else if(p->element_depth == 0) p->state = PS_epilog; } if(ParserGetFlag(p, ReturnDefaultedAttributes)) { AttributeDefinition d; Attribute a; for(d=NextAttributeDefinition(p->xbit.element_definition, 0); d; d=NextAttributeDefinition(p->xbit.element_definition, d)) { if(!d->default_value) continue; for(a=p->xbit.attributes; a; a=a->next) if(a->definition == d) break; if(!a) { if(!(a = Malloc(sizeof(*a)))) return error(p, "System error"); a->definition = d; if(!(a->value = Strdup(d->default_value))) return error(p, "System error"); a->quoted = 1; a->next = p->xbit.attributes; p->xbit.attributes = a; } } } return 0; } static int parse_attribute(Parser p) { InputSource s = p->source; AttributeDefinition def; struct attribute *a; int c; require(parse_name(p, "for attribute")); maybe_uppercase_name(p); def = FindAttributeN(p->xbit.element_definition, p->name, p->namelen); if(!def) { if(p->have_dtd && ParserGetFlag(p, ErrorOnUndefinedAttributes)) return error(p, "Undeclared attribute %.*S for element %S", p->namelen, p->name, p->xbit.element_definition->name); if(p->have_dtd && ParserGetFlag(p, WarnOnUndefinedAttributes)) warn(p, "Undeclared attribute %.*S for element %S; " "declaring it as CDATA #IMPLIED", p->namelen, p->name, p->xbit.element_definition->name); if(!(def = DefineAttributeN(p->xbit.element_definition, p->name, p->namelen, AT_cdata, 0, DT_implied, 0))) return error(p, "System error"); } for(a = p->xbit.attributes; a; a = a->next) if(a->definition == def) return error(p, "Repeated attribute %.*S", p->namelen, p->name); if(!(a = Malloc(sizeof(*a)))) return error(p, "System error"); a->value = 0; /* in case of error */ a->next = p->xbit.attributes; p->xbit.attributes = a; a->definition = def; skip_whitespace(s); require(expect(p, '=', "after attribute name")); skip_whitespace(s); c = get(s); unget(s); switch(c) { case '"': case '\'': a->quoted = 1; require(parse_string(p, "in attribute value", a->definition->type == AT_cdata ? LT_cdata_attr : LT_tok_attr)); a->value = p->pbuf; Consume(p->pbuf); break; default: if(ParserGetFlag(p, ErrorOnUnquotedAttributeValues)) return error(p, "Value of attribute is unquoted"); a->quoted = 0; require(parse_nmtoken(p, "in unquoted attribute value")); CopyName(a->value); break; } return 0; } static int transcribe(Parser p, int back, int count) { ExpandBuf(p->pbuf, p->pbufnext + count); memcpy(p->pbuf + p->pbufnext, p->source->line + p->source->next - back, count * sizeof(Char)); p->pbufnext += count; return 0; } /* Called after pushing back the first character of the pcdata */ static int parse_pcdata(Parser p) { int count = 0; InputSource s; Char *buf; int next, buflen; if(p->state <= PS_prolog2) return error(p, "Character data not allowed in prolog"); if(p->state == PS_epilog) return error(p, "Character data not allowed after body"); s = p->source; buf = s->line; next = s->next; buflen = s->line_length; p->pbufnext = 0; while(1) { if(next == buflen) { s->next = next; if(count > 0) { require(transcribe(p, count, count)); } count = 0; if(at_eoe(s)) { if(!ParserGetFlag(p, MergePCData)) goto done; else pop_while_at_eoe(p); } s = p->source; buf = s->line; next = s->next; buflen = s->line_length; if(next == buflen) goto done; /* must be EOF */ } switch(buf[next++]) { case '<': if(!ParserGetFlag(p, XMLLessThan)) { /* In nSGML, don't recognise < as markup unless it looks ok */ if(next == buflen) goto deflt; if(buf[next] != '!' && buf[next] != '/' && buf[next] != '?' && !is_xml_namestart(buf[next])) goto deflt; } s->next = next; if(count > 0) { require(transcribe(p, count+1, count)); } count = 0; if(!ParserGetFlag(p, ReturnComments) && buflen >= next + 3 && buf[next] == '!' && buf[next+1] == '-' && buf[next+2] == '-') { s->next = next + 3; require(parse_comment(p, 1)); buflen = s->line_length; next = s->next; } else { s->next = next-1; goto done; } break; case '&': if(ParserGetFlag(p, IgnoreEntities)) goto deflt; if(!ParserGetFlag(p, MergePCData) && (p->pbufnext > 0 || count > 0)) { /* We're returning references as separate bits, and we've come to one, and we've already got some data to return, so return what we've got and get the reference next time. */ s->next = next-1; if(count > 0) { require(transcribe(p, count, count)); } goto done; } if(buflen >= next+1 && buf[next] == '#') { /* It's a character reference */ s->next = next+1; if(count > 0) { require(transcribe(p, count+2, count)); } count = 0; require(parse_character_reference(p, ParserGetFlag(p, ExpandCharacterEntities))); next = s->next; if(!ParserGetFlag(p, MergePCData)) goto done; } else { /* It's a general entity reference */ s->next = next; if(count > 0) { require(transcribe(p, count+1, count)); } count = 0; require(parse_reference(p, 0, ParserGetFlag(p, ExpandGeneralEntities), 1)); s = p->source; buf = s->line; buflen = s->line_length; next = s->next; if(!ParserGetFlag(p, MergePCData)) goto done; } break; case ']': if(ParserGetFlag(p, XMLMiscWFErrors) && buflen >= next + 2 && buf[next] == ']' && buf[next+1] == '>') return error(p, "Illegal character sequence ']]>' in pcdata"); /* fall through */ default: deflt: count++; break; } } done: p->pbuf[p->pbufnext++] = 0; p->xbit.type = XBIT_pcdata; p->xbit.pcdata_chars = p->pbuf; Consume(p->pbuf); return 0; } /* Called after reading '", bit->comment_chars); if(p->state <= PS_prolog2) Printf("\n"); break; default: fprintf(stderr, "\n***%s\n", XBitTypeName[bit->type]); exit(1); break; } } } int attr_compare(const void *a, const void *b) { return Strcmp((*(Attribute *)a)->definition->name, (*(Attribute *)b)->definition->name); } void print_attrs(ElementDefinition e, Attribute a) { Attribute b; Attribute *aa; int i, n = 0; for(b=a; b; b=b->next) n++; if(n == 0) return; aa = malloc(n * sizeof(*aa)); for(i=0, b=a; b; i++, b=b->next) aa[i] = b; if(strict_xml) qsort((void *)aa, n, sizeof(*aa), attr_compare); for(i=0; idefinition->name); print_text(aa[i]->value); Printf("\""); } free(aa); } void print_text_bit(Char *text) { int i; for(i=0; i<50 && text[i]; i++) if(text[i] == '\n' || text[i] == '\r') text[i] = '~'; Printf("%.50S", text); } void dtd_cb(XBit bit, void *arg) { Printf("In DTD: "); print_bit(arg, bit); } void print_text(Char *text) { Char *pc, *last; if(bits) { Printf("%S", text); return; } for(pc = last = text; *pc; pc++) { if(*pc == '&' || *pc == '<' || *pc == '>' || *pc == '"' || (strict_xml && (*pc == 9 || *pc == 10 || *pc == 13))) { if(pc > last) Printf("%.*S", pc - last, last); switch(*pc) { case '<': Printf("<"); break; case '>': Printf(">"); break; case '&': Printf("&"); break; case '"': Printf("""); break; case 9: Printf(" "); break; case 10: Printf(" "); break; case 13: Printf(" "); break; } last = pc+1; } } if(pc > last) Printf("%.*S", pc - last, last); } InputSource entity_open(Entity ent, void *arg) { if(ent->publicid && strcmp(ent->publicid, "-//RMT//DTD just a test//EN") == 0) { FILE *f; FILE16 *f16; if((f = fopen("/tmp/mydtd", "r"))) { if(!(f16 = MakeFILE16FromFILE(f, "r"))) return 0; SetCloseUnderlying(f16, 1); return NewInputSource(ent, f16); } } return EntityOpen(ent); } speech_tools/rxp/rxp.mak0000644000076400007640000000622507262605664014017 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## -------------------------------------------------------------------- ## ## Richard's (Tobin) XML parser ## ## ## ########################################################################### INCLUDE_RXP=1 MOD_DESC_RXP=Richard Tobin's XML parser ifeq ($(DIRNAME),.) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) rxp endif ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) xml_parser_main.cc endif ifeq ($(DIRNAME),testsuite) TEST_MODULES := xml $(TEST_MODULES) endif speech_tools/wrappers/Makefile0000644000076400007640000000531710065645210015171 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for Wrappers module # #=========================================================================# TOP=.. DIRNAME=wrappers NODEPEND=1 BUILD_DIRS=interface python perl5 ALL = .sub_directories FILES = Makefile wrappers.mak $(COMMON_FILES) include $(TOP)/config/common_make_rules speech_tools/wrappers/wrappers.mak0000644000076400007640000001041110263052744016061 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996-2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Korin Richmond ## ## Date: 15 Apr 2003 ## ## -------------------------------------------------------------------- ## ## ## ## Make definitions for the module which builds bindings for high level ## ## script languages, such as Perl, for selected EST classes and ## ## functionality. This makes use of SWIG ## ## ## ########################################################################### INCLUDE_WRAPPERS = 1 MOD_DESC_WRAPPERS = Script language bindings for EST libraries # not sure what magic it would take to put the contents of the # following ifeq block into $(TOP)/wrappers/Makefile, but in some # ways it would be nicer... ifeq ($(DIRNAME),wrappers) ifndef CONFIG_SWIG_COMPILER .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Please specify path to swig binary in config/config" @echo "+--------------------------------------------------" @exit 1 endif ifeq ($(CONFIG_SWIG_COMPILER),none) .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Please specify path to swig binary in config/config" @echo "+--------------------------------------------------" @exit 1 endif ifneq ($(findstring PYTHON,$(CONFIG_WRAPPER_LANGUAGES)),) BUILD_DIRS+=python endif ifneq ($(findstring PERL5,$(CONFIG_WRAPPER_LANGUAGES)),) BUILD_DIRS+=perl5 endif endif ifeq ($(DIRNAME),.) EXTRA_BUILD_DIRS := $(EXTRA_BUILD_DIRS) wrappers endif speech_tools/wrappers/interface/Makefile0000644000076400007640000000566611461104306017135 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for Wrappers module # #=========================================================================# TOP=../.. DIRNAME=wrappers/interface NODEPEND=1 BUILD_DIRS=python perl5 ALL = .sub_directories COMMON_INTERFACE_FILES = EST_Utterance.i EST_Relation.i EST_Item.i \ EST_Wave.i EST_Track.i EST_SignalProc.i \ EST_pitchmark.i EST_TVector.i EST_TSimpleVector.i EST_FVector.i \ EST_Ngrammar.i EST_error.i EST_rw_status.i FILES = Makefile $(COMMON_INTERFACE_FILES) include $(TOP)/config/common_make_rules speech_tools/wrappers/interface/EST_Utterance.i0000644000076400007640000001214410056153702020304 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 14 Apr 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig interface for EST_Utterance class */ /* */ /*************************************************************************/ %module EST_Utterance %{ #include "ling_class/EST_Utterance.h" %} %include "EST_typemaps.i" %include "EST_error.i" %import "EST_Item.i" %import "EST_Relation.i" // List of functions which can throw errors when called (which need to be // caught or the interpreter will bomb out) %exception EST_Utterance::relation CATCH_EST_ERROR; %exception EST_Utterance::load CATCH_EST_ERROR; %exception EST_Utterance::id CATCH_EST_ERROR; %exception utterance_merge CATCH_EST_ERROR; class EST_Utterance{ private: int highest_id; public: // constructors EST_Utterance(); EST_Utterance(const EST_Utterance &u) { copy(u); } ~EST_Utterance() {clear(); } // initialise utterance void init(); // remove everything in utterance void clear(); // clear the contents of the relations only void clear_relations(); // set the next id to be "n" void set_highest_id( int n ); // return the id of the next item int next_id(); // load an utterance from file void load( const EST_String &filename ); // save an utterance to file void save( const EST_String &filename, const EST_String &type="est_ascii" ) const; // Evaluate all feature functions void evaluate_all_features(); // number of relations in this utterance int num_relations() const { return relations.length(); } // is the relation present? bool relation_present( const EST_String name ) const; // get relation EST_Relation *relation( const char *name, int err_on_not_found=1 ); // return EST_Item whose id is "n" EST_Item *id( const EST_String &n ); // create a new relation EST_Relation *create_relation( const EST_String &relname ); // remove relation void remove_relation( const EST_String &relname ); void sub_utterance( EST_Item *i ); }; int utterance_merge( EST_Utterance &utt, EST_Utterance &sub_utt, EST_Item *utt_root, EST_Item *sub_root ); int utterance_merge( EST_Utterance &utt, EST_Utterance &extra, EST_String feature ); void sub_utterance( EST_Utterance &sub, EST_Item *i ); EST_Utterance *get_utt( EST_Item *s ); speech_tools/wrappers/interface/EST_Relation.i0000644000076400007640000001270011352212617020126 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 14 Apr 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig interface for EST_Relation class */ /* */ /*************************************************************************/ %module EST_Relation %{ #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" %} %include "EST_rw_status.i" %include "EST_typemaps.i" %import "EST_Item.i" class EST_Relation { private: EST_String p_name; EST_Utterance *p_utt; EST_Item *p_head; EST_Item *p_tail; static void node_tidy_up_val( int &k, EST_Val &v ); static void node_tidy_up( int &k, EST_Item *node ); void copy( const EST_Relation &r ); public: EST_Relation(); EST_Relation( const char *name ); EST_Relation( const EST_Relation &r ) { copy(r); } ~EST_Relation(); EST_read_status load( const EST_String &filename, const EST_String &type="esps" ); EST_write_status save(const EST_String &filename, const EST_String &type, bool evaluate_ff = false) const; // Features which belong to the relation rather than its items // EST_Features f; // Evaluate the relation's feature functions // void evaluate_features(); // Evaluate the feature functions of all the items in the relation void evaluate_item_features(); // Clear the relation of items void clear(); // Return the EST_Utterance to which this relation belongs EST_Utterance *utt(); // Set the EST_Utterance to which this relation belongs void set_utt( EST_Utterance *u ); // name of the relation const EST_String &name() const; // Return the head (first) item of the relation EST_Item *head() const; // Return the root item of the relation EST_Item *root() const; // Return the tail (last) item of the relation EST_Item *tail() const; EST_Item *first() const; EST_Item *first_leaf() const; EST_Item *last() const; EST_Item *last_leaf() const; EST_Item *append( EST_Item *si ); EST_Item *prepend( EST_Item *si ); // number of items in this relation int length() const; // return true if relation does not contain any items int empty() const; // remove EST_Item "item" from relation void remove_item( EST_Item *item ); // remove all occurrences of feature "name" from relation's items void remove_item_feature( const EST_String &name ); #ifdef HAVEITEMLISTOUT %extend { %newobject items; inline void items( EST_Item **ITEMLISTOUT ){ *ITEMLISTOUT = self->first(); } } #endif }; //inline bool operator==(const EST_Relation &a, const EST_Relation &b); void copy_relation(const EST_Relation &from, EST_Relation &to); speech_tools/wrappers/interface/EST_Item.i0000644000076400007640000002012611352212617017250 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 14 Apr 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig interface for EST_Item */ /* */ /*************************************************************************/ %module EST_Item %{ #include "ling_class/EST_Item.h" #include "ling_class/EST_item_aux.h" %} %include "EST_Features.i" %include "EST_typemaps.i" %include "EST_error.i" class EST_Item { private: EST_Item_Content *p_contents; EST_Relation *p_relation; EST_Item *n; EST_Item *p; EST_Item *u; EST_Item *d; void unref_contents(); void ref_contents(); void copy(const EST_Item &s); public: // Default constructor EST_Item(); // Copy constructor only makes reference to contents EST_Item(const EST_Item &item); // Includes reference to relation EST_Item(EST_Relation *rel); // Most common form of construction EST_Item(EST_Relation *rel, EST_Item *si); // Deletes it and references to it in its contents ~EST_Item(); ////////////////////////////////////////////////////////////// // %exception { CATCH_EST_ERROR } // return the value of the feature "name" cast as a float const float F(const EST_String &name) const; // return the value of the feature name cast as a EST_String const EST_String S(const EST_String &name) const; // return the value of the feature name cast as a int const int I(const EST_String &name) const; // return the value of the feature name cast as an EST_Features EST_Features &A(const EST_String &name) const; // set feature "name" to some value */ // (note these functions implicitly assume the compiler will // create a temporary EST_String from the "name" argument // when calling the respective C++ functions - it's done like // that because of a conflict between SWIG typemap conversions // and handling of overloaded functions) void set(const char *name, int ival); void set(const char *name, double fval); void set(const char *name, const char *cval); void set(const char *name, EST_Features &f); // set feature "name" to "val", a registered feature function void set_function(EST_String &name, EST_String &funcname); // remove feature "name" void f_remove(const EST_String &name); %exception; // ////////////////////////////////////////////////////////////// // find all the attributes whose values are functions, and // replace them with their evaluation. void evaluate_features(); // TRUE if feature is present, FALSE otherwise */ int f_present(const EST_String &name) const; // Number of items (including this) until no next item. int length() const; //const EST_Val f(const EST_String &name) const; //const EST_Val f(const EST_String &name, const EST_Val &def) const; // View item from another relation EST_Item *as_relation(const char *relname) const; // TRUE if this item is in named relation int in_relation(const EST_String &relname) const; // The relation name of this particular item const EST_String &relation_name() const; // The relation of this particular item EST_Relation *relation(void) const; // True if "li" is the same item ignoring its relation viewpoint int same_item(const EST_Item *li) const; //EST_Item *up() const; // Delete this item and all its occurences in other relations void unref_all(); %extend { EST_Item *prepend_daughter( EST_Item *p ){ return prepend_daughter( self, p ); } EST_Item *append_daughter( EST_Item *p ){ return append_daughter( self, p ); } EST_Item* daughter1(){ return daughter1( self ); } EST_Item* daughtern() { return daughtern( self ); } EST_Item* next_sibling(){ return next_sibling( self ); } EST_Item* prev_sibling(){ return prev_sibling( self ); } EST_Item* parent(){ return parent( self ); } } /////////////////////////////////////////////////////////////////////////////// // warning: entirely obfuscated macro magic and abuse ahead // - turn back now to preserve sanity... EST_Features &features(); // #ifdef HAVEITEMFEATURESFUNCTION // %apply (bool FEATURESOUTEVAL) { (bool b) }; // %extend { // void features( bool b ){ // //dummy function // } // } // %clear ( bool b); // #endif //HAVEITEMFEATURESFUNCTION #ifdef HAVEITEMLEAFLISTOUT %extend { %newobject leafs; void leafs( EST_Item **ITEMLEAFLISTOUT ){ *ITEMLEAFLISTOUT = self; } } #endif //HAVEITEMLEAFLISTOUT #ifdef HAVEITEMDAUGHTERLISTOUT %extend { %newobject daughters; void daughters( EST_Item **ITEMDAUGHTERLISTOUT ){ *ITEMDAUGHTERLISTOUT = self; } } #endif }; //inline EST_Item *as(const EST_Item *n,const char *relname); //as is now keyword in python inline EST_Item *next_item(const EST_Item *node); inline EST_Item *first_leaf(const EST_Item *n); inline EST_Item *last_leaf(const EST_Item *n); inline EST_Item *next_leaf(const EST_Item *n); int num_leaves(const EST_Item *n); void remove_item(EST_Item *l, const char *relname); void copy_node_tree(EST_Item *from, EST_Item *to); void copy_node_tree_contents(EST_Item *from, EST_Item *to); //Rob's function for jumping around HRG structures more easily EST_Item *item_jump(EST_Item *from, const EST_String &to); speech_tools/wrappers/interface/EST_Wave.i0000644000076400007640000001507711352212617017265 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 02 June 2003 */ /* ------------------------------------------------------------------- */ /* EST_Wave Class interface file */ /* */ /*************************************************************************/ %module EST_Wave %{ #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_audio.h" #include "EST_Option.h" %} %include "EST_rw_status.i" %include "EST_typemaps.i" class EST_Wave { protected: EST_SMatrix p_values; int p_sample_rate; void default_vals(int n=0, int c=1); void free_wave(); void copy_data(const EST_Wave &w); void copy_setup(const EST_Wave &w); public: // these are static in the EST_Wave class, but there's some // problem with segmentation fault... const int default_sample_rate; //const int default_num_channels; EST_Wave(); EST_Wave(const EST_Wave &a); EST_Wave(int n, int c, int sr); ~EST_Wave(); short a(int i, int channel = 0) const; short &a_safe(int i, int channel = 0); // set value short set_a(int i, int channel = 0, short val = 0); // return the time position in seconds of the ith sample float t(int i) const; int num_samples() const; int num_channels() const; int sample_rate() const; void set_sample_rate(const int n); int length() const; // return the time position of the last sample. float end(); // Can we look N samples to the left? bool have_left_context(unsigned int n) const; EST_String sample_type() const; void set_sample_type(const EST_String t); EST_String file_type() const; void set_file_type(const EST_String t); EST_String name() const; void set_name(const EST_String n); void resize(int num_samples, int num_channels = EST_ALL, int set=1); void resample(int rate); // multiply all samples by factor "gain". void rescale( float gain,int normalize=0 ); void rescale( const EST_Track &factor_contour ); // clear waveform and set size to 0. void clear(); void copy(const EST_Wave &from); void fill(short v=0, int channel=EST_ALL); void empty(int channel=EST_ALL); EST_read_status load(const EST_String filename, int offset=0, int length = 0, int rate = default_sample_rate); EST_read_status load_file(const EST_String filename, const EST_String filetype, int sample_rate, const EST_String sample_type, int bo, int nc, int offset = 0, int length = 0); EST_write_status save(const EST_String filename, const EST_String EST_filetype = ""); EST_write_status save_file(const EST_String filename, EST_String filetype, EST_String sample_type, int bo); void integrity() const; %extend { void info() { wave_info( *self ); } } %extend { void play() { EST_Option empty; play_wave( *self, empty ); } } }; int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel); void wave_combine_channels(EST_Wave &combined, const EST_Wave &multi); int wave_subwave(EST_Wave &subsig,EST_Wave &sig,int offset,int length); int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab, const EST_String &ext); int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab, const EST_String &file); void add_waves(EST_Wave &s, const EST_Wave &m); EST_Wave difference(EST_Wave &a, EST_Wave &b); float rms_error(EST_Wave &a, EST_Wave &b, int channel); float abs_error(EST_Wave &a, EST_Wave &b, int channel); float correlation(EST_Wave &a, EST_Wave &b, int channel); EST_FVector rms_error(EST_Wave &a, EST_Wave &b); EST_FVector abs_error(EST_Wave &a, EST_Wave &b); EST_FVector correlation(EST_Wave &a, EST_Wave &b); EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax); void absolute(EST_Wave &a); void wave_info(EST_Wave &w); void invert(EST_Wave &sig); void differentiate(EST_Wave &sig); void reverse(EST_Wave &sig); speech_tools/wrappers/interface/EST_Track.i0000644000076400007640000002515011352212617017420 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 02 June 2003 */ /* ------------------------------------------------------------------- */ /* EST_Track script language interface file */ /* */ /*************************************************************************/ %module EST_Track %{ #include "EST_Track.h" #include "EST_track_aux.h" %} %include "typemaps.i" %include "EST_rw_status.i" %import "EST_FVector.i" %include "EST_typemaps.i" class EST_Track { protected: EST_FMatrix p_values; EST_FVector p_times; EST_CVector p_is_val; EST_ValMatrix p_aux; EST_StrVector p_aux_names; float p_t_offset; EST_TrackMap::P p_map; EST_StrVector p_channel_names; bool p_equal_space; bool p_single_break; void default_vals(); void default_channel_names(); void clear_arrays(); void pad_breaks(); int interp_value(float x, float f); float interp_amp(float x, int c, float f); float estimate_shift(float x); void copy(const EST_Track& a); public: // these are static in the EST_Track class, but there's some // problem with segmentation fault... const float default_frame_shift; const int default_sample_rate; EST_Track(); EST_Track(const EST_Track &a); EST_Track(int num_frames, int num_channels); ~EST_Track(); void resize(int num_frames, int num_channels, bool preserve = 1); void set_num_channels(int n, bool preserve = 1); void set_num_frames(int n, bool preserve = 1); void set_channel_name(const EST_String &name, int channel); // set the name of the auxiliary channel. void set_aux_channel_name(const EST_String &name, int channel); // copy everything but data void copy_setup(const EST_Track& a); // name of track EST_String name() const; void set_name(const EST_String &n); // make "fv" a window to frame "n" in the track. void frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL); // make "fv" a window to channel "n" in the track. void channel(EST_FVector &cv, int n, int startf=0, int nf=EST_ALL); // make "fv" a window to the named channel in the track. void channel(EST_FVector &cv, const char * name, int startf=0, int nf=EST_ALL); void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL); void copy_sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const; void copy_sub_track_out( EST_Track &st, const EST_FVector& frame_times ) const; void copy_sub_track_out( EST_Track &st, const EST_IVector& frame_indices ) const; // copy channel "n" into pre-allocated buffer "buf" // void copy_channel_out(int n, float *buf, int offset=0, int nf=EST_ALL) const; // copy channel {\tt n} into EST_FVector void copy_channel_out(int n, EST_FVector &f, int offset=0, int nf=EST_ALL) const; // copy frame "n" into pre-allocated buffer "buf" // void copy_frame_out(int n, float *buf, int offset=0, int nc=EST_ALL) const; // copy frame "n" into EST_FVector "f" void copy_frame_out(int n, EST_FVector &f, int offset=0, int nc=EST_ALL) const; // copy "buf" into pre-allocated channel "n" of track // void copy_channel_in(int n, const float *buf, int offset=0, int nf=EST_ALL); // copy f into pre-allocated channel n of track */ void copy_channel_in(int n, const EST_FVector &f, int offset=0, int num=EST_ALL); // copy channel "buf" into pre-allocated channel "n" of track void copy_channel_in(int c, const EST_Track &from, int from_c, int from_offset=0, int offset=0, int num=EST_ALL); // copy "buf" into frame "n" of track // void copy_frame_in(int n, const float *buf, int offset=0, int nc=EST_ALL); // copy "f" into frame "n" of track void copy_frame_in(int n, const EST_FVector &f, int offset=0, int nf=EST_ALL); // copy from "from" frame into frame "n" of track void copy_frame_in(int i, const EST_Track &from, int from_f, int from_offset=0, int offset=0, int num=EST_ALL); // Return the position of channel "name" if it exists,otherwise return -1. int channel_position(const char *name, int offset=0) const; bool has_channel(const char *name) const; // return amplitude of frame i, channel c. float a(int i, int c=0) const; // return amplitude at frame nearest t, channel c. float a(float t, int c=0) const; // return time position of frame i float t(int i=0) const; // return time of frame i in milli-seconds. float ms_t(int i) const; // set frame times to regular intervals of time "t". //void fill_time(float t, int start =1); // set frame times to regular intervals of time "t", // begining at time "startt" void fill_time(float t, float startt=0.0); // fill times with times of other track void fill_time(EST_Track &t); // fill all amplitudes with value "v" void fill(float v); // resample track at this frame shift, specified in seconds. void sample(float shift); // return an estimation of the frame spacing in seconds. float shift() const; // return time of first value in track float start() const; // return time of last value in track float end() const; // EST_read_status load(const EST_String name, float ishift = 0.0, float startt = 0.0); // EST_write_status save(const EST_String name, const EST_String EST_filetype = ""); EST_read_status load(const char *name, float ishift = 0.0, float startt = 0.0); EST_write_status save(const char *name, const char* EST_filetype = ""); // set frame i to be a break void set_break(int i); // set frame i to be a value void set_value(int i); // return true if frame i is a value int val(int i) const; // return true if frame i is a break int track_break(int i) const { return (p_is_val(i)); } /** starting at frame i, return the frame index of the first value frame before i. If frame i is a value, return i */ int prev_non_break(int i) const; /** starting at frame i, return the frame index of the first value frame after i. If frame i is a value, return i */ int next_non_break(int i) const; int empty() const; // return the frame index nearest time t int index(float t) const; // return the frame index before time t int index_below(float x) const; // return number of frames in track int num_frames() const; // return number of frames in track int length() const; // return number of channels in track int num_channels() const; // return number of auxiliary channels in track int num_aux_channels() const; // return true if track has fixed frame spacing bool equal_space() const; // return true if track has only single breaks between value sections bool single_break() const; void set_equal_space(bool t); void set_single_break(bool t); // EST_Track& operator = (const EST_Track& a); // add track at end EST_Track& operator+=(const EST_Track &a); // add track in parallel EST_Track& operator|=(const EST_Track &a); EST_read_status load_channel_names(const EST_String name); EST_write_status save_channel_names(const EST_String name); const EST_String channel_name(int channel, int strings_override=1) const; const EST_String aux_channel_name(int channel) const; }; float mean( const EST_Track &tr, int channel ); void mean( const EST_Track &tr, EST_FVector &means ); %apply float &OUTPUT { float &m, float &sd }; void meansd( EST_Track &tr, float &m, float &sd, int channel ); %clear float &m, float &sd; void meansd( EST_Track &tr, EST_FVector &m, EST_FVector &sd ); void normalise( EST_Track &tr ); void normalise( EST_Track &tr, float mean, float sd, int channel, float upper, float lower ); void normalise( EST_Track &tr, EST_FVector &mean, EST_FVector &sd, float upper, float lower); speech_tools/wrappers/interface/EST_SignalProc.i0000644000076400007640000001243310055115315020411 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 25 July 2003 */ /* ------------------------------------------------------------------- */ /* EST_Wave and EST_Track signal processing functions */ /* */ /*************************************************************************/ %module EST_SignalProc %{ #include "sigpr/EST_filter.h" #include "sigpr/EST_filter_design.h" %} %include "EST_typemaps.i" %import "EST_Wave.i" void FIRfilter(EST_Wave &in_sig, const EST_FVector &numerator, int delay_correction=0); void FIRfilter(const EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator, int delay_correction=0); void FIR_double_filter(EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator); void FIRlowpass_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); void FIRlowpass_filter(const EST_Wave &in_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); void FIRhighpass_filter(EST_Wave &in_sig, int freq, int order); void FIRhighpass_filter(const EST_Wave &sigin, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); void FIRhighpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); void FIRhighpass_double_filter(const EST_Wave &int_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); void FIRlowpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER); void FIRlowpass_double_filter(const EST_Wave &in_sig, EST_Wave &out_sig, int freq, int order=DEFAULT_FILTER_ORDER); void lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res); void inv_lpc_filter(EST_Wave &sig, EST_FVector &a, EST_Wave &res); void lpc_filter_1(EST_Track &lpc, EST_Wave & res, EST_Wave &sig); void lpc_filter_fast(EST_Track &lpc, EST_Wave & res, EST_Wave &sig); void inv_lpc_filter_ola(EST_Wave &sig, EST_Track &lpc, EST_Wave &res); void pre_emphasis(EST_Wave &sig, float a=DEFAULT_PRE_EMPH_FACTOR); void pre_emphasis(EST_Wave &sig, EST_Wave &out, float a=DEFAULT_PRE_EMPH_FACTOR); void post_emphasis(EST_Wave &sig, float a=DEFAULT_PRE_EMPH_FACTOR); void post_emphasis(EST_Wave &sig, EST_Wave &out, float a=DEFAULT_PRE_EMPH_FACTOR); void simple_mean_smooth(EST_Wave &c, int n); EST_FVector design_FIR_filter(const EST_FVector &freq_response, int filter_order); EST_FVector design_lowpass_FIR_filter(int sample_rate, int freq, int order); EST_FVector design_highpass_FIR_filter(int sample_rate, int freq, int order); speech_tools/wrappers/interface/EST_pitchmark.i0000644000076400007640000000724010055115315020332 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 25 Jan 2004 */ /* ------------------------------------------------------------------- */ /* signal processing functions to do with pitchmarks/f0 */ /* */ /*************************************************************************/ %module EST_pitchmark %{ #include "sigpr/EST_pitchmark.h" %} %include "EST_typemaps.i" %import "EST_Wave.i" %import "EST_Track.i" %import "EST_Features.i" EST_Track pitchmark(EST_Wave &lx, EST_Features &op); EST_Track pitchmark(EST_Wave &lx, int lx_lf, int lx_lo, int lx_hf, int lx_ho, int df_lf, int df_lo, int mo, int debug=0); void neg_zero_cross_pick(EST_Wave &lx, EST_Track &pm); void pm_fill(EST_Track &pm, float new_end, float max, float min, float def); void pm_min_check(EST_Track &pm, float min); void pm_to_f0(EST_Track &pm, EST_Track &f0); void pm_to_f0(EST_Track &pm, EST_Track &fz, float shift); speech_tools/wrappers/interface/EST_TVector.i0000644000076400007640000001141410055115315017734 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 28 August 2003 */ /* ------------------------------------------------------------------- */ /* SWIG interface file for EST_TVector template class */ /* (Primarily meant to be included in other interface files where */ /* instantiation and/or inheritance take place) */ /* */ /*************************************************************************/ %{ #include "EST_TVector.h" %} template class EST_TVector { public: EST_TVector(); EST_TVector(const EST_TVector &v); // "size" constructor - make vector of size n. EST_TVector(int n); // construct from memory supplied by caller EST_TVector(int, T *memory, int offset=0, int free_when_destroyed=0); ~EST_TVector(); void resize(int n, int set=1); // number of items in vector. int num_columns() const; int length() const; int n() const; // access without bounds checking const T &a_no_check(int n); const T &a_no_check_1(int n); // access with bounds checking const T &a_check(int n); const T &a(int n); // assignment operator //EST_TVector &operator=(const EST_TVector &s); // Fill with value v void fill(const T &v); // Fill with default value void empty(); // true if equal size and all elements are equal. int operator == (const EST_TVector &v) const; // true if not equal size or a single elements isn't equal. int operator != (const EST_TVector &v) const; #if defined(SWIGPYTHON) %rename (__setitem__) setitem; %rename (__getitem__) getitem; #endif //SWIGPYTHON %extend { void setitem( int i, const T& val ){ self->a_check(i) = val; } const T& getitem( int i ){ return self->a_check(i); } } // Copy data in and out. Subclassed by SimpleVector for speed. void copy_section(T* dest, int offset=0, int num=-1) const; void set_section(const T* src, int offset=0, int num=-1); }; template extern ostream& operator << (ostream &st, const EST_TVector< T > &a); speech_tools/wrappers/interface/EST_TSimpleVector.i0000644000076400007640000000765310055115315021120 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 28 August 2003 */ /* ------------------------------------------------------------------- */ /* SWIG interface file for EST_TSimpleVector template class */ /* (Primarily meant to be included in other interface files where */ /* instantiation and/or inheritance take place) */ /* */ /*************************************************************************/ %{ #include "EST_TSimpleVector.h" %} %include "EST_TVector.i" template class EST_TSimpleVector : public EST_TVector { public: EST_TSimpleVector() : EST_TVector() {}; EST_TSimpleVector(const EST_TSimpleVector &v); // "size" constructor EST_TSimpleVector(int n): EST_TVector(n) {}; // resize vector void resize(int n, int set=1); // assignment operator //EST_TSimpleVector &operator=(const EST_TSimpleVector &s); void copy_section(T* dest, int offset=0, int num=-1) const; void set_section(const T* src, int offset=0, int num=-1); // Fill entire array with 0 bits. void zero(void); // Fill vector with default value (might be 0) void empty(void); }; speech_tools/wrappers/interface/EST_FVector.i0000644000076400007640000001345211352212617017726 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 28 August 2003 */ /* ------------------------------------------------------------------- */ /* SWIG interface file for EST_FVector class */ /* */ /*************************************************************************/ %module EST_FVector %{ #include "EST_FMatrix.h" %} %include "EST_rw_status.i" %include "EST_typemaps.i" %include "EST_TSimpleVector.i" %template(floatvector) EST_TVector; %template(floatsimplevector) EST_TSimpleVector; class EST_FVector: public EST_TSimpleVector { public: EST_FVector(): EST_TSimpleVector() {} EST_FVector(const EST_FVector &a): EST_TSimpleVector(a) {} // Size constructor. EST_FVector(int n): EST_TSimpleVector(n) {} // elementwise multiply EST_FVector &operator*=(const EST_FVector &s); // elementwise add EST_FVector &operator+=(const EST_FVector &s); // elementwise multiply by scalar EST_FVector &operator*=(float f); // elementwise divide by scalar EST_FVector &operator/=(float f); // save vector to file EST_write_status est_save(const EST_String &filename, const EST_String &type); EST_write_status save(const EST_String &filename, const EST_String &type); // load vector from file EST_read_status load(const EST_String &filename); // Load from file in EST format EST_read_status est_load(const EST_String &filename); %extend { // float max() const { // return vector_max( *self ); // } void randomise( float scale ) { make_random_vector( *self, scale ); } float sum() const { float sum = 0.0; int a_len = self->length(); for( int i=0; ia_no_check(i); return sum; } } }; // elementwise add EST_FVector add(const EST_FVector &a,const EST_FVector &b); // elementwise subtract EST_FVector subtract(const EST_FVector &a,const EST_FVector &b); %newobject sqrt; %inline %{ EST_FVector* sqrt( const EST_FVector &a ){ int a_len = a.length(); EST_FVector *ans = new EST_FVector(a_len); for( int i=0; ia_no_check(i) = sqrt( a.a_no_check(i) ); return ans; } %} %newobject topower; %inline %{ EST_FVector* topower( const EST_FVector &a, float f ){ int a_len = a.length(); EST_FVector *ans = new EST_FVector(a_len); for( int i=0; ia_no_check(i) = pow( a.a_no_check(i), f ); return ans; } %} EST_FVector operator-(const EST_FVector &a, const EST_FVector &b); EST_FVector operator+(const EST_FVector &a, const EST_FVector &b); // vector dot product float operator*(const EST_FVector &v1, const EST_FVector &v2); // least squares fit bool polynomial_fit(EST_FVector &x, EST_FVector &y, EST_FVector &coefs, int order); // weighted least squares fit bool polynomial_fit(EST_FVector &x, EST_FVector &y, EST_FVector &coefs, EST_FVector &weights, int order); float polynomial_value(const EST_FVector &coefs, const float x); speech_tools/wrappers/interface/EST_Ngrammar.i0000644000076400007640000002112011352212617020111 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 20 May 2003 */ /*-----------------------------------------------------------------------*/ /* */ /* SWIG interface file defining interface to speech tools ngram code */ /* */ /*=======================================================================*/ %module EST_Ngrammar %{ #include "EST_Ngrammar.h" #include "EST_DMatrix.h" %} %include "EST_rw_status.i" %import EST_typemaps.i class EST_Ngrammar { public: // 3 representations : sparse, dense and backed off. enum representation_t {sparse, dense, backoff}; enum entry_t {frequencies, log_frequencies}; public: EST_Ngrammar(); EST_Ngrammar(int o, representation_t r, const EST_StrList &wordlist); // When state trans vocab differs from prediction vocab EST_Ngrammar(int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist); ~EST_Ngrammar(); void clear(); bool init(int o, representation_t r, const EST_StrList &wordlist); bool init(int o, representation_t r, const EST_StrList &wordlist, const EST_StrList &predlist); // access int num_states(void) const; double samples(void) const; int order() const; int get_vocab_length(); EST_String get_vocab_word(int i) const; int get_vocab_word(const EST_String &s) const; int get_pred_vocab_length() const; EST_String get_pred_vocab_word(int i) const; int get_pred_vocab_word(const EST_String &s) const; int closed_vocab() const; entry_t entry_type() const; representation_t representation() const; // build bool build(const EST_StrList &filenames, const EST_String &prev = SENTENCE_START_MARKER, const EST_String &prev_prev = SENTENCE_END_MARKER, const EST_String &last = SENTENCE_END_MARKER, const EST_String &input_format = "", const EST_String &oov_mode = "", const int mincount=1, const int maxcount=10); // Accumulate ngrams void accumulate(const EST_StrVector &words, const double count=1); void accumulate(const EST_IVector &words, const double count=1); // I/O functions EST_read_status load(const EST_String &filename); EST_read_status load(const EST_String &filename, const EST_StrList &wordlist); EST_write_status save(const EST_String &filename, EST_String type="cstr_ascii", bool trace=false, double floor=0.0); int wordlist_index(const EST_String &word, bool report=true) const; const EST_String &wordlist_index(int i) const; int predlist_index(const EST_String &word) const; const EST_String &predlist_index(int i) const; // set bool set_entry_type(entry_t new_type); bool set_representation(representation_t new_representation); // probability distributions // ------------------------- // flag 'force' forces computation of probs on-the-fly if necessary double probability(const EST_StrVector &words, bool force=false, bool trace=false) const; double frequency( const EST_StrVector &words, bool force=false, bool trace=false) const; const EST_String &predict(const EST_StrVector &words) const; const EST_String &predict(const EST_StrVector &words, double *prob) const; const EST_String &predict(const EST_StrVector &words, double *prob, int *state) const; const EST_String &predict(const EST_IVector &words) const; const EST_String &predict(const EST_IVector &words, double *prob) const; const EST_String &predict(const EST_IVector &words, double *prob, int *state) const; int find_state_id(const EST_StrVector &words) const; int find_state_id(const EST_IVector &words) const; int find_next_state_id(int state, int word) const; // reverse - probability of words[0..order-2] given word[order-1] double reverse_probability(const EST_StrVector &words, bool force=false) const; double reverse_probability(const EST_IVector &words, bool force=false) const; // predict, where words has 'order' elements and the last one is "" or NULL const EST_DiscreteProbDistribution &prob_dist(const EST_StrVector &words) const; const EST_DiscreteProbDistribution &prob_dist(const EST_IVector &words) const; const EST_DiscreteProbDistribution &prob_dist(int state) const; void fill_window_start(EST_IVector &window, const EST_String &prev, const EST_String &prev_prev) const; void fill_window_start(EST_StrVector &window, const EST_String &prev, const EST_String &prev_prev) const; bool ngram_exists(const EST_StrVector &words) const; bool ngram_exists(const EST_StrVector &words, const double threshold) const; const double get_backoff_weight(const EST_StrVector &words) const; bool set_backoff_weight(const EST_StrVector &words, const double w); void print_freqs(ostream &os,double floor=0.0); // frequencies below mincount get backed off // frequencies above maxcount are not smoothed(discounted) bool compute_backoff_weights(const int mincount=1, const int maxcount=10); bool merge(EST_Ngrammar &n,float weight); }; // Auxiliary functions // smoothing void frequency_of_frequencies(EST_DVector &ff, EST_Ngrammar &n, int this_order=0); void map_frequencies(EST_Ngrammar &n, const EST_DVector &map, int this_order=0); bool Good_Turing_smooth(EST_Ngrammar &n, int maxcount, int mincount=0); void Good_Turing_discount(EST_Ngrammar &ngrammar, int maxcount, double default_discount=0.5); void fs_build_backoff_ngrams(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram); int fs_backoff_smooth(EST_Ngrammar *backoff_ngrams, EST_Ngrammar &ngram, int smooth_thresh); void Ngram_freqsmooth(EST_Ngrammar &ngram, int smooth_thresh1, int smooth_thresh2); bool test_stats(EST_Ngrammar &ngram, const EST_String &filename, double &raw_entropy, double &count, double &entropy, double &perplexity, const EST_String &input_format, const EST_String &prev = SENTENCE_START_MARKER, const EST_String &prev_prev = SENTENCE_END_MARKER, const EST_String &last = SENTENCE_END_MARKER); speech_tools/wrappers/interface/EST_error.i0000644000076400007640000000642110056153702017504 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 07 May 2003 */ /* --------------------------------------------------------------------- */ /* */ /* How to deal with EST errors with script interfaces built with SWIG */ /* */ /*************************************************************************/ %{ #include "EST_error.h" %} %include "exception.i" %define CATCH_EST_ERROR { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } $action END_CATCH_ERRORS(); } %enddef speech_tools/wrappers/interface/EST_rw_status.i0000644000076400007640000001150711350201234020377 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* Author : Korin Richmond */ /* Date : 09 May 2008 */ /* ------------------------------------------------------------------- */ /* EST_rw_status script language interface file to be included */ /* wherever function return these status code enums */ /* */ /*************************************************************************/ %{ #include "EST_rw_status.h" %} /** Possible outcomes of a file reading operation. More stuff*/ enum EST_read_status { /// The file was read in successfully read_ok = make_status_int(rws_ok, rwr_none, 0), /// The file exists but is not in the format specified read_format_error = make_status_int(rws_failed, rwr_format, 0), /// The file does not exist. read_not_found_error = make_status_int(rws_failed, rwr_existance, 0), /// An error occurred while reading read_error = make_status_int(rws_failed, rwr_unknown, 0) }; /** Possible outcomes of a file writing operation */ enum EST_write_status { /// The file was written successfully write_ok = make_status_int(rws_ok, rwr_none, 0), /// The file was not written successfully write_fail = make_status_int(rws_failed, rwr_unknown, 0), /// The file was not written successfully write_error = make_status_int(rws_failed, rwr_unknown, 0), /// A valid file was created, but only some of the requested data is in there write_partial = make_status_int(rws_partial, rwr_unknown, 0) }; /** Possible outcomes of a network connection operation */ enum EST_connect_status { /// Connection made. connect_ok = make_status_int(rws_ok, rwr_none, 0), /// Connection failed. connect_not_found_error = make_status_int(rws_failed, rwr_existance, 0), /// Connection failed. connect_not_allowed_error = make_status_int(rws_failed, rwr_permission, 0), /// System failure of some kind connect_system_error = make_status_int(rws_failed, rwr_system, 0), /// The file was not written successfully connect_error = make_status_int(rws_failed, rwr_unknown, 0) }; speech_tools/wrappers/interface/python/Makefile0000644000076400007640000000530110065575756020464 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile for Wrappers module # #=========================================================================# TOP=../../.. DIRNAME=wrappers/interface/python PYTHON_FILES = EST_Features.i EST_typemaps.i FILES = Makefile $(PYTHON_FILES) include $(TOP)/config/common_make_rules speech_tools/wrappers/interface/python/EST_Features.i0000644000076400007640000001402310056153702021447 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 15 May 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig Python type maps for EST_Features class */ /* (converts to/from Python Dictionary object) */ /* */ /*************************************************************************/ %{ static PyObject* features_to_PyDict( EST_Features *features ){ EST_Features::RwEntries p; PyObject *result = PyDict_New(); for( p.begin(*features); p != 0; ++p ){ const EST_Val &v = p->v; PyObject *py_val; if(v.type() == val_unset) py_val = Py_None; else if( v.type() == val_int ) py_val = PyInt_FromLong( v.Int() ); else if( v.type() == val_float ) py_val = PyFloat_FromDouble( v.Float() ); else if( v.type() == val_type_feats ) py_val = features_to_PyDict( feats(v) ); // else if( v.type() == val_type_featfunc ){ // if( evaluate_ff ){ // EST_Val tempval = ((featfunc)(*v))(##SHOULD BE AN ITEM##); // if( tempval.type() == val_int ) // py_val = PyInt_FromLong( tempval.Int() ); // else if( tempval.type() == val_float ) // py_val = PyFloat_FromDouble( tempval.Float() ); // else // py_val = PyString_FromString( tempval.string() ); // } // else // py_val = PyString_FromString( v.string() ); // } else{ EST_String s( v.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } PyDict_SetItemString( result, (char*)(p->k), py_val ); } return result; } %} %{ static PyObject* item_features_to_PyDict( EST_Item *item, bool evaluate_ff ){ EST_Features::RwEntries p; PyObject *result = PyDict_New(); for( p.begin(item->features()); p != 0; ++p ){ const EST_Val &v = p->v; PyObject *py_val; if(v.type() == val_unset) py_val = Py_None; else if( v.type() == val_int ) py_val = PyInt_FromLong( v.Int() ); else if( v.type() == val_float ) py_val = PyFloat_FromDouble( v.Float() ); else if( v.type() == val_type_feats ) py_val = features_to_PyDict( feats(v) ); else if( (v.type() == val_type_featfunc) && evaluate_ff ){ EST_Val tempval = ((featfunc)(v))(item); if( tempval.type() == val_int ) py_val = PyInt_FromLong( tempval.Int() ); else if( tempval.type() == val_float ) py_val = PyFloat_FromDouble( tempval.Float() ); else{ EST_String s( tempval.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } } else{ EST_String s( v.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } PyDict_SetItemString( result, (char*)(p->k), py_val ); } return result; } %} %typemap(out) EST_Features & "$result = features_to_PyDict( $1 );"; // #ifndef HAVEITEMFEATURESFUNCTION // #define HAVEITEMFEATURESFUNCTION // typedef struct { // EST_Item *it; // bool evaluate_ff; // } FUNCTIONARGS_ITEMFEATURES; // %typemap(out) FUNCTION { // $result = item_features_to_PyDict( arg1, arg2 ); // } // #endif speech_tools/wrappers/interface/python/EST_typemaps.i0000644000076400007640000002064211332265737021551 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 30 Apr 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig Python type maps for some speech tools types */ /* */ /*************************************************************************/ %{ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif %} %typemap(in) EST_String & (EST_String temp) { char *str; Py_ssize_t len; PyString_AsStringAndSize($input, &str, &len); temp = EST_String( str, len, 0, len ); $1 = &temp; } /* new - need typechecking for overloaded function dispatcher */ %typemap(typecheck) EST_String& = char *; %typemap(in) EST_String { char *str; Py_ssize_t len; PyString_AsStringAndSize($input, &str, &len); $1 = EST_String( str, len, 0, len ); } /* new - need typechecking for overloaded function dispatcher */ %typemap(typecheck) EST_String = char *; %typemap(out) EST_String { int len = $1.length(); $result = (len ? PyString_FromStringAndSize($1.str(),len) : Py_BuildValue((char*)"")); } %typemap(out) EST_String&, EST_String* { int len = $1->length(); $result = len ? PyString_FromStringAndSize($1->str(),len) : Py_BuildValue((char*)""); } // for now, just going to convert EST_StrList as a "one off", but // maybe in future, the EST_TList class should be wrapped and // then just the relevant typedefs made? %typemap(in) EST_StrList & (EST_StrList temp) { if (PyList_Check($input)){ int size = PyList_Size( $input ); for(int i=0; ilength()); unsigned int i; EST_Item *it; for( it = (*$1), i=0; it!=0; it=next(it), ++i ) PyList_SetItem( o1, i, SWIG_NewPointerObj((void *) it, $descriptor(EST_Item*), 0) ); if ((!$result) || ($result == Py_None)) { $result = o1; } else { if (!PyTuple_Check($result)) { o2 = $result; $result = PyTuple_New(1); PyTuple_SetItem($result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SetItem( o3, 0, o1 ); o2 = $result; $result = PySequence_Concat( o2, o3 ); Py_DECREF(o2); Py_DECREF(o3); } } #endif #ifndef HAVEITEMLEAFLISTOUT #define HAVEITEMLEAFLISTOUT %typemap(in,numinputs=0) EST_Item **ITEMLEAFLISTOUT = EST_Item **ITEMLISTOUT; %typemap(argout) EST_Item **ITEMLEAFLISTOUT { PyObject *o1, *o2, *o3; EST_Item *first_item = first_leaf(*$1); EST_Item *last_item = last_leaf(*$1); EST_Item *it; unsigned int i, num_leafs; // faster to count leafs first and allocate PyList once (?) for( it=first_item, num_leafs=0; (it!=0) && (it!=last_item); it=next_leaf(it) ) ++num_leafs; if( it != 0 ) ++num_leafs; // for last_item switch (num_leafs) { case 0: o1 = Py_None; //not sure this will ever happen break; // case 1: // o1 = SWIG_NewPointerObj((void *) it, SWIGTYPE_p_EST_Item, 0); // break; default: o1 = PyList_New(num_leafs); for( i=0, it=first_item; iv; if(v.type() == val_unset) value = &PL_sv_undef; else if( v.type() == val_int ) value = newSViv( v.Int() ); else if( v.type() == val_float ) value = newSVnv( v.Float() ); else if( v.type() == val_type_feats ) value = newRV_noinc((SV*) features_to_PerlHash(feats(v)) ); // else if( v.type() == val_type_featfunc ){ // if( evaluate_ff ){ // EST_Val tempval = ((featfunc)(*v))(##SHOULD BE AN ITEM##); // if( tempval.type() == val_int ) // value = newSViv( tempval.Int() ); // // else if( tempval.type() == val_float ) // value = newSVnv( tempval.Float() ); // // else{ // EST_String s( tempval.string() ); // value = newSVpvn( s.str(), s.length() ); // } // } // else{ // EST_String s( v.string() ); // value = newSVpvn( s.str(), s.length() ); // } else{ EST_String s( v.string() ); value = newSVpvn( s.str(), s.length() ); } char *key = (char*)(p->k); // should we check for duplicates before doing the store? hv_store(result, key, strlen(key), value, 0); } return result; } %} // for now at least, we'll just create a reference to a Perl Hash // and populate it with the data from the EST_Features object %typemap(out) EST_Features & "ST(argvi) = sv_newmortal(); sv_setsv( (SV*)ST(argvi++), (SV*)newRV_noinc((SV*)features_to_PerlHash($1)) );"; speech_tools/wrappers/interface/perl5/EST_typemaps.i0000644000076400007640000000742010355750774021262 0ustar awbawb/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* (University of Edinburgh, UK) and */ /* Korin Richmond */ /* Copyright (c) 2003 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Korin Richmond */ /* Date : 14 Apr 2003 */ /* --------------------------------------------------------------------- */ /* */ /* Swig Perl type maps for some speech tools types */ /* */ /*************************************************************************/ %typemap(in) EST_String & (EST_String temp) { STRLEN len; const char* str = SvPV($input, len); temp = EST_String( str, len, 0, len ); $1 = &temp; } /* new - need typechecking for overloaded function dispatcher */ %typemap(typecheck) EST_String& = char *; %typemap(in) EST_String { STRLEN len; const char* str = SvPV($input, len); $1 = EST_String( str, len, 0, len ); } /* new - need typechecking for overloaded function dispatcher */ %typemap(typecheck) EST_String = char *; %typemap(out) EST_String "ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)$1, $1.length());"; %typemap(out) EST_String&, EST_String* "ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)(*$1), $1->length());"; speech_tools/wrappers/python/Makefile0000644000076400007640000001105011332265740016505 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Author : Korin Richmond # # Date : April 2003 # #-------------------------------------------------------------------------# # Makefile for python bindings to speech tools # # # #=========================================================================# TOP=../.. DIRNAME=wrappers/python WRAPPERS = EST_FVector.i \ EST_Wave.i EST_Track.i EST_SignalProc.i\ EST_pitchmark.i \ EST_Utterance.i EST_Relation.i EST_Item.i \ EST_Ngrammar.i #EST_Complex.i WRAPPER_SRCS = $(WRAPPERS:.i=_wrap.cc) WRAPPER_PY = $(WRAPPERS:.i=.py) OBJS = $(WRAPPER_SRCS:.cc=.o) ALL_WRAPPERS = $(WRAPPERS:%.i=_%.so) FILES= Makefile $(WRAPPER_SRCS) $(WRAPPER_PY) ALL = .make_wrappers LOCAL_INCLUDES = $(CONFIG_PYTHON_INCLUDES) # following flag switches off GCC's strict aliasing rules assumption # when performing optimization (hence, that optimisiation is no # longer available). This is necessary because swig generated wrapper # code contains lots of type punning in the course of doing its magic, # which violates the strict aliasing and so can generate duff code CC_OTHER_FLAGS += -fno-strict-aliasing include $(TOP)/config/common_make_rules include $(TOP)/config/rules/bin_process.mak # if the user gives a path to swig in $EST/config/config file, then # test *.i interface files, and use swig to rebuild wrappers, otherwise # use the default pre-swigged versions (and not delete them on make clean!) ifdef CONFIG_SWIG_COMPILER INTERFACE_DIRS = ../interface/ ../interface/python/ ../../include INTERFACE_DIRS_SWG = $(foreach d,$(INTERFACE_DIRS),-I$(d)) vpath %.i $(INTERFACE_DIRS) SWIG_COMMAND = $(CONFIG_SWIG_COMPILER) -c++ -python -shadow -Wall $(WRAPPER_SRCS) : %_wrap.cc : %.i $(SWIG_COMMAND) $(INTERFACE_DIRS_SWG) -o $@ $< LOCAL_CLEAN = $(WRAPPER_SRCS) $(WRAPPERS:.i=.py) $(WRAPPERS:.i=.pyc) $(ALL_WRAPPERS) else LOCAL_CLEAN = $(WRAPPERS:.i=.pyc) $(ALL_WRAPPERS) endif $(ALL_WRAPPERS) : _%.so : %_wrap.o $(subst XXX,$@,$(MAKE_SHARED_LIB)) $(LIBS) $< .make_wrappers : $(ALL_WRAPPERS) speech_tools/wrappers/python/EST_FVector_wrap.cc0000644000076400007640000063505011352212617020501 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_TSimpleVectorT_float_t swig_types[2] #define SWIGTYPE_p_EST_TVectorT_float_t swig_types[3] #define SWIGTYPE_p_T swig_types[4] #define SWIGTYPE_p_char swig_types[5] #define SWIGTYPE_p_float swig_types[6] static swig_type_info *swig_types[8]; static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_FVector.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_FVector #else # define SWIG_init init_EST_FVector #endif #define SWIG_name "_EST_FVector" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "EST_FMatrix.h" #include "EST_rw_status.h" #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include "EST_TSimpleVector.h" #include "EST_TVector.h" #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } #define SWIG_From_double PyFloat_FromDouble SWIGINTERNINLINE PyObject * SWIG_From_float (float value) { return SWIG_From_double (value); } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } SWIGINTERN void EST_TVector_Sl_float_Sg__setitem(EST_TVector< float > *self,int i,float const &val){ self->a_check(i) = val; } SWIGINTERN float const &EST_TVector_Sl_float_Sg__getitem(EST_TVector< float > *self,int i){ return self->a_check(i); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERN void EST_FVector_randomise(EST_FVector *self,float scale){ make_random_vector( *self, scale ); } SWIGINTERN float EST_FVector_sum(EST_FVector const *self){ float sum = 0.0; int a_len = self->length(); for( int i=0; ia_no_check(i); return sum; } EST_FVector* sqrt( const EST_FVector &a ){ int a_len = a.length(); EST_FVector *ans = new EST_FVector(a_len); for( int i=0; ia_no_check(i) = sqrt( a.a_no_check(i) ); return ans; } EST_FVector* topower( const EST_FVector &a, float f ){ int a_len = a.length(); EST_FVector *ans = new EST_FVector(a_len); for( int i=0; ia_no_check(i) = pow( a.a_no_check(i), f ); return ans; } SWIGINTERNINLINE PyObject* SWIG_From_bool (bool value) { return PyBool_FromLong(value ? 1 : 0); } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_floatvector")) SWIG_fail; result = (EST_TVector< float > *)new EST_TVector< float >(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_floatvector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_floatvector" "', argument " "1"" of type '" "EST_TVector< float > const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_floatvector" "', argument " "1"" of type '" "EST_TVector< float > const &""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); result = (EST_TVector< float > *)new EST_TVector< float >((EST_TVector< float > const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_floatvector",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_floatvector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); result = (EST_TVector< float > *)new EST_TVector< float >(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; float *arg2 = (float *) 0 ; int arg3 ; int arg4 ; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:new_floatvector",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_floatvector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_floatvector" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_floatvector" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_floatvector" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); result = (EST_TVector< float > *)new EST_TVector< float >(arg1,arg2,arg3,arg4); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; float *arg2 = (float *) 0 ; int arg3 ; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:new_floatvector",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_floatvector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_floatvector" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_floatvector" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (EST_TVector< float > *)new EST_TVector< float >(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; float *arg2 = (float *) 0 ; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_TVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:new_floatvector",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_floatvector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_floatvector" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); result = (EST_TVector< float > *)new EST_TVector< float >(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatvector(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_floatvector__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_floatvector__SWIG_1(self, args); } } if (argc == 1) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_floatvector__SWIG_2(self, args); } } if (argc == 2) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_floatvector__SWIG_5(self, args); } } } if (argc == 3) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_floatvector__SWIG_4(self, args); } } } } if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_floatvector__SWIG_3(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_floatvector'.\n" " Possible C/C++ prototypes are:\n" " EST_TVector< float >()\n" " EST_TVector< float >(EST_TVector< float > const &)\n" " EST_TVector< float >(int)\n" " EST_TVector< float >(int,float *,int,int)\n" " EST_TVector< float >(int,float *,int)\n" " EST_TVector< float >(int,float *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_floatvector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_floatvector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_floatvector" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatvector_resize",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_resize" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->resize(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_resize",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_resize" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->resize(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_resize(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_resize__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_resize__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatvector_resize'.\n" " Possible C/C++ prototypes are:\n" " resize(EST_TVector< float > *,int,int)\n" " resize(EST_TVector< float > *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatvector_num_columns(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:floatvector_num_columns",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_num_columns" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); result = (int)((EST_TVector< float > const *)arg1)->num_columns(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:floatvector_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_length" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); result = (int)((EST_TVector< float > const *)arg1)->length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_n(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:floatvector_n",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_n" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); result = (int)((EST_TVector< float > const *)arg1)->n(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_a_no_check(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_a_no_check",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_a_no_check" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_a_no_check" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float *) &(arg1)->a_no_check(arg2); resultobj = SWIG_From_float(static_cast< float >(*result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_a_no_check_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_a_no_check_1",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_a_no_check_1" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_a_no_check_1" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float *) &(arg1)->a_no_check_1(arg2); resultobj = SWIG_From_float(static_cast< float >(*result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_a_check(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_a_check",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_a_check" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_a_check" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float *) &(arg1)->a_check(arg2); resultobj = SWIG_From_float(static_cast< float >(*result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_a(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_a",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_a" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float *) &(arg1)->a(arg2); resultobj = SWIG_From_float(static_cast< float >(*result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_fill(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; float temp2 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_fill",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_fill" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector_fill" "', argument " "2"" of type '" "float""'"); } temp2 = static_cast< float >(val2); arg2 = &temp2; (arg1)->fill((float const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:floatvector_empty",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_empty" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); (arg1)->empty(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; EST_TVector< float > *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector___eq__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector___eq__" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector___eq__" "', argument " "2"" of type '" "EST_TVector< float > const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "floatvector___eq__" "', argument " "2"" of type '" "EST_TVector< float > const &""'"); } arg2 = reinterpret_cast< EST_TVector< float > * >(argp2); result = (int)((EST_TVector< float > const *)arg1)->operator ==((EST_TVector< float > const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; EST_TVector< float > *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector___ne__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector___ne__" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector___ne__" "', argument " "2"" of type '" "EST_TVector< float > const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "floatvector___ne__" "', argument " "2"" of type '" "EST_TVector< float > const &""'"); } arg2 = reinterpret_cast< EST_TVector< float > * >(argp2); result = (int)((EST_TVector< float > const *)arg1)->operator !=((EST_TVector< float > const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; float *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; float temp3 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatvector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector___setitem__" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector___setitem__" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector___setitem__" "', argument " "3"" of type '" "float""'"); } temp3 = static_cast< float >(val3); arg3 = &temp3; EST_TVector_Sl_float_Sg__setitem(arg1,arg2,(float const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector___getitem__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector___getitem__" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatvector___getitem__" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float *) &EST_TVector_Sl_float_Sg__getitem(arg1,arg2); resultobj = SWIG_From_float(static_cast< float >(*result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_copy_section__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:floatvector_copy_section",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_copy_section" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector_copy_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "floatvector_copy_section" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ((EST_TVector< float > const *)arg1)->copy_section(arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_copy_section__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatvector_copy_section",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_copy_section" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector_copy_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ((EST_TVector< float > const *)arg1)->copy_section(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_copy_section__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_copy_section",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_copy_section" "', argument " "1"" of type '" "EST_TVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ((EST_TVector< float > const *)arg1)->copy_section(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_copy_section(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_floatvector_copy_section__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_copy_section__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_copy_section__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatvector_copy_section'.\n" " Possible C/C++ prototypes are:\n" " copy_section(EST_TVector< float > const *,float *,int,int)\n" " copy_section(EST_TVector< float > const *,float *,int)\n" " copy_section(EST_TVector< float > const *,float *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatvector_set_section__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:floatvector_set_section",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_set_section" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector_set_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "floatvector_set_section" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->set_section((float const *)arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_set_section__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatvector_set_section",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_set_section" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatvector_set_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->set_section((float const *)arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_set_section__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TVector< float > *arg1 = (EST_TVector< float > *) 0 ; float *arg2 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatvector_set_section",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatvector_set_section" "', argument " "1"" of type '" "EST_TVector< float > *""'"); } arg1 = reinterpret_cast< EST_TVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatvector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); (arg1)->set_section((float const *)arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatvector_set_section(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_floatvector_set_section__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_set_section__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatvector_set_section__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatvector_set_section'.\n" " Possible C/C++ prototypes are:\n" " set_section(EST_TVector< float > *,float const *,int,int)\n" " set_section(EST_TVector< float > *,float const *,int)\n" " set_section(EST_TVector< float > *,float const *)\n"); return NULL; } SWIGINTERN PyObject *floatvector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_TVectorT_float_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_floatsimplevector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_floatsimplevector")) SWIG_fail; result = (EST_TSimpleVector< float > *)new EST_TSimpleVector< float >(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TSimpleVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatsimplevector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_TSimpleVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_floatsimplevector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_floatsimplevector" "', argument " "1"" of type '" "EST_TSimpleVector< float > const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_floatsimplevector" "', argument " "1"" of type '" "EST_TSimpleVector< float > const &""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); result = (EST_TSimpleVector< float > *)new EST_TSimpleVector< float >((EST_TSimpleVector< float > const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TSimpleVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatsimplevector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; EST_TSimpleVector< float > *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_floatsimplevector",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_floatsimplevector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); result = (EST_TSimpleVector< float > *)new EST_TSimpleVector< float >(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_TSimpleVectorT_float_t, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_floatsimplevector(PyObject *self, PyObject *args) { int argc; PyObject *argv[2]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 1); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_floatsimplevector__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_floatsimplevector__SWIG_1(self, args); } } if (argc == 1) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_floatsimplevector__SWIG_2(self, args); } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_floatsimplevector'.\n" " Possible C/C++ prototypes are:\n" " EST_TSimpleVector< float >()\n" " EST_TSimpleVector< float >(EST_TSimpleVector< float > const &)\n" " EST_TSimpleVector< float >(int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatsimplevector_resize",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_resize" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatsimplevector_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatsimplevector_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->resize(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatsimplevector_resize",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_resize" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "floatsimplevector_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->resize(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_resize(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_resize__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_resize__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatsimplevector_resize'.\n" " Possible C/C++ prototypes are:\n" " resize(EST_TSimpleVector< float > *,int,int)\n" " resize(EST_TSimpleVector< float > *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_copy_section__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:floatsimplevector_copy_section",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_copy_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatsimplevector_copy_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "floatsimplevector_copy_section" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ((EST_TSimpleVector< float > const *)arg1)->copy_section(arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_copy_section__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatsimplevector_copy_section",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_copy_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatsimplevector_copy_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ((EST_TSimpleVector< float > const *)arg1)->copy_section(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_copy_section__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatsimplevector_copy_section",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_copy_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > const *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_copy_section" "', argument " "2"" of type '" "float *""'"); } arg2 = reinterpret_cast< float * >(argp2); ((EST_TSimpleVector< float > const *)arg1)->copy_section(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_copy_section(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_floatsimplevector_copy_section__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_copy_section__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_copy_section__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatsimplevector_copy_section'.\n" " Possible C/C++ prototypes are:\n" " copy_section(EST_TSimpleVector< float > const *,float *,int,int)\n" " copy_section(EST_TSimpleVector< float > const *,float *,int)\n" " copy_section(EST_TSimpleVector< float > const *,float *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_set_section__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:floatsimplevector_set_section",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_set_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatsimplevector_set_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "floatsimplevector_set_section" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->set_section((float const *)arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_set_section__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:floatsimplevector_set_section",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_set_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "floatsimplevector_set_section" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->set_section((float const *)arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_set_section__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; float *arg2 = (float *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:floatsimplevector_set_section",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_set_section" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "floatsimplevector_set_section" "', argument " "2"" of type '" "float const *""'"); } arg2 = reinterpret_cast< float * >(argp2); (arg1)->set_section((float const *)arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_set_section(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_floatsimplevector_set_section__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_set_section__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_floatsimplevector_set_section__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'floatsimplevector_set_section'.\n" " Possible C/C++ prototypes are:\n" " set_section(EST_TSimpleVector< float > *,float const *,int,int)\n" " set_section(EST_TSimpleVector< float > *,float const *,int)\n" " set_section(EST_TSimpleVector< float > *,float const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_zero(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:floatsimplevector_zero",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_zero" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); (arg1)->zero(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_floatsimplevector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:floatsimplevector_empty",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "floatsimplevector_empty" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); (arg1)->empty(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_floatsimplevector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_TSimpleVector< float > *arg1 = (EST_TSimpleVector< float > *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_floatsimplevector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_TSimpleVectorT_float_t, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_floatsimplevector" "', argument " "1"" of type '" "EST_TSimpleVector< float > *""'"); } arg1 = reinterpret_cast< EST_TSimpleVector< float > * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *floatsimplevector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_TSimpleVectorT_float_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_new_EST_FVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_FVector")) SWIG_fail; result = (EST_FVector *)new EST_FVector(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_FVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_FVector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_FVector" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_FVector" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); result = (EST_FVector *)new EST_FVector((EST_FVector const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_FVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_FVector",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_EST_FVector" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); result = (EST_FVector *)new EST_FVector(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_FVector(PyObject *self, PyObject *args) { int argc; PyObject *argv[2]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 1); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_FVector__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_FVector__SWIG_1(self, args); } } if (argc == 1) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_EST_FVector__SWIG_2(self, args); } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_FVector'.\n" " Possible C/C++ prototypes are:\n" " EST_FVector()\n" " EST_FVector(EST_FVector const &)\n" " EST_FVector(int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector___imul____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector___imul__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector___imul__" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_FVector___imul__" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_FVector___imul__" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); result = (EST_FVector *) &(arg1)->operator *=((EST_FVector const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector___iadd__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector___iadd__" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_FVector___iadd__" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_FVector___iadd__" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); result = (EST_FVector *) &(arg1)->operator +=((EST_FVector const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector___imul____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector___imul__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector___imul__" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_FVector___imul__" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (EST_FVector *) &(arg1)->operator *=(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector___imul__(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_FVector___imul____SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_FVector___imul____SWIG_1(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_FVector___imul__'.\n" " Possible C/C++ prototypes are:\n" " operator *=(EST_FVector *,EST_FVector const &)\n" " operator *=(EST_FVector *,float)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector___idiv__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector___idiv__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector___idiv__" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_FVector___idiv__" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (EST_FVector *) &(arg1)->operator /=(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_est_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_FVector_est_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_est_save" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = (EST_write_status)(arg1)->est_save((EST_String const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_FVector_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_save" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = (EST_write_status)(arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_load" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_read_status)(arg1)->load((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_est_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector_est_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_est_load" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_read_status)(arg1)->est_load((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_randomise(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_FVector_randomise",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_randomise" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_FVector_randomise" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); EST_FVector_randomise(arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_FVector_sum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_FVector_sum",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_FVector_sum" "', argument " "1"" of type '" "EST_FVector const *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); result = (float)EST_FVector_sum((EST_FVector const *)arg1); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_FVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = (EST_FVector *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_FVector",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_FVector, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_FVector" "', argument " "1"" of type '" "EST_FVector *""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_FVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_FVector, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:add",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "add" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "add" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "add" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "add" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); result = add((EST_FVector const &)*arg1,(EST_FVector const &)*arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_subtract(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:subtract",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "subtract" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "subtract" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "subtract" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "subtract" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); result = subtract((EST_FVector const &)*arg1,(EST_FVector const &)*arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_sqrt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:sqrt",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sqrt" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sqrt" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); result = (EST_FVector *)sqrt((EST_FVector const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_topower(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:topower",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "topower" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "topower" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "topower" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (EST_FVector *)topower((EST_FVector const &)*arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_polynomial_fit__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOO:polynomial_fit",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "polynomial_fit" "', argument " "1"" of type '" "EST_FVector &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "1"" of type '" "EST_FVector &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "polynomial_fit" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "polynomial_fit" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "polynomial_fit" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); result = (bool)polynomial_fit(*arg1,*arg2,*arg3,arg4); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_polynomial_fit__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; EST_FVector *arg4 = 0 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:polynomial_fit",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "polynomial_fit" "', argument " "1"" of type '" "EST_FVector &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "1"" of type '" "EST_FVector &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "polynomial_fit" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "polynomial_fit" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "polynomial_fit" "', argument " "4"" of type '" "EST_FVector &""'"); } if (!argp4) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_fit" "', argument " "4"" of type '" "EST_FVector &""'"); } arg4 = reinterpret_cast< EST_FVector * >(argp4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "polynomial_fit" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); result = (bool)polynomial_fit(*arg1,*arg2,*arg3,*arg4,arg5); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_polynomial_fit(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_polynomial_fit__SWIG_0(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_polynomial_fit__SWIG_1(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'polynomial_fit'.\n" " Possible C/C++ prototypes are:\n" " polynomial_fit(EST_FVector &,EST_FVector &,EST_FVector &,int)\n" " polynomial_fit(EST_FVector &,EST_FVector &,EST_FVector &,EST_FVector &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_polynomial_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:polynomial_value",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "polynomial_value" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "polynomial_value" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "polynomial_value" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (float)polynomial_value((EST_FVector const &)*arg1,arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_floatvector", _wrap_new_floatvector, METH_VARARGS, NULL}, { (char *)"delete_floatvector", _wrap_delete_floatvector, METH_VARARGS, NULL}, { (char *)"floatvector_resize", _wrap_floatvector_resize, METH_VARARGS, NULL}, { (char *)"floatvector_num_columns", _wrap_floatvector_num_columns, METH_VARARGS, NULL}, { (char *)"floatvector_length", _wrap_floatvector_length, METH_VARARGS, NULL}, { (char *)"floatvector_n", _wrap_floatvector_n, METH_VARARGS, NULL}, { (char *)"floatvector_a_no_check", _wrap_floatvector_a_no_check, METH_VARARGS, NULL}, { (char *)"floatvector_a_no_check_1", _wrap_floatvector_a_no_check_1, METH_VARARGS, NULL}, { (char *)"floatvector_a_check", _wrap_floatvector_a_check, METH_VARARGS, NULL}, { (char *)"floatvector_a", _wrap_floatvector_a, METH_VARARGS, NULL}, { (char *)"floatvector_fill", _wrap_floatvector_fill, METH_VARARGS, NULL}, { (char *)"floatvector_empty", _wrap_floatvector_empty, METH_VARARGS, NULL}, { (char *)"floatvector___eq__", _wrap_floatvector___eq__, METH_VARARGS, NULL}, { (char *)"floatvector___ne__", _wrap_floatvector___ne__, METH_VARARGS, NULL}, { (char *)"floatvector___setitem__", _wrap_floatvector___setitem__, METH_VARARGS, NULL}, { (char *)"floatvector___getitem__", _wrap_floatvector___getitem__, METH_VARARGS, NULL}, { (char *)"floatvector_copy_section", _wrap_floatvector_copy_section, METH_VARARGS, NULL}, { (char *)"floatvector_set_section", _wrap_floatvector_set_section, METH_VARARGS, NULL}, { (char *)"floatvector_swigregister", floatvector_swigregister, METH_VARARGS, NULL}, { (char *)"new_floatsimplevector", _wrap_new_floatsimplevector, METH_VARARGS, NULL}, { (char *)"floatsimplevector_resize", _wrap_floatsimplevector_resize, METH_VARARGS, NULL}, { (char *)"floatsimplevector_copy_section", _wrap_floatsimplevector_copy_section, METH_VARARGS, NULL}, { (char *)"floatsimplevector_set_section", _wrap_floatsimplevector_set_section, METH_VARARGS, NULL}, { (char *)"floatsimplevector_zero", _wrap_floatsimplevector_zero, METH_VARARGS, NULL}, { (char *)"floatsimplevector_empty", _wrap_floatsimplevector_empty, METH_VARARGS, NULL}, { (char *)"delete_floatsimplevector", _wrap_delete_floatsimplevector, METH_VARARGS, NULL}, { (char *)"floatsimplevector_swigregister", floatsimplevector_swigregister, METH_VARARGS, NULL}, { (char *)"new_EST_FVector", _wrap_new_EST_FVector, METH_VARARGS, NULL}, { (char *)"EST_FVector___iadd__", _wrap_EST_FVector___iadd__, METH_VARARGS, NULL}, { (char *)"EST_FVector___imul__", _wrap_EST_FVector___imul__, METH_VARARGS, NULL}, { (char *)"EST_FVector___idiv__", _wrap_EST_FVector___idiv__, METH_VARARGS, NULL}, { (char *)"EST_FVector_est_save", _wrap_EST_FVector_est_save, METH_VARARGS, NULL}, { (char *)"EST_FVector_save", _wrap_EST_FVector_save, METH_VARARGS, NULL}, { (char *)"EST_FVector_load", _wrap_EST_FVector_load, METH_VARARGS, NULL}, { (char *)"EST_FVector_est_load", _wrap_EST_FVector_est_load, METH_VARARGS, NULL}, { (char *)"EST_FVector_randomise", _wrap_EST_FVector_randomise, METH_VARARGS, NULL}, { (char *)"EST_FVector_sum", _wrap_EST_FVector_sum, METH_VARARGS, NULL}, { (char *)"delete_EST_FVector", _wrap_delete_EST_FVector, METH_VARARGS, NULL}, { (char *)"EST_FVector_swigregister", EST_FVector_swigregister, METH_VARARGS, NULL}, { (char *)"add", _wrap_add, METH_VARARGS, NULL}, { (char *)"subtract", _wrap_subtract, METH_VARARGS, NULL}, { (char *)"sqrt", _wrap_sqrt, METH_VARARGS, NULL}, { (char *)"topower", _wrap_topower, METH_VARARGS, NULL}, { (char *)"polynomial_fit", _wrap_polynomial_fit, METH_VARARGS, NULL}, { (char *)"polynomial_value", _wrap_polynomial_value, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static void *_p_EST_FVectorTo_p_EST_TVectorT_float_t(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((EST_TVector< float > *) (EST_TSimpleVector< float > *) ((EST_FVector *) x)); } static void *_p_EST_TSimpleVectorT_float_tTo_p_EST_TVectorT_float_t(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((EST_TVector< float > *) ((EST_TSimpleVector< float > *) x)); } static void *_p_EST_FVectorTo_p_EST_TSimpleVectorT_float_t(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((EST_TSimpleVector< float > *) ((EST_FVector *) x)); } static swig_type_info _swigt__p_EST_FVector = {"_p_EST_FVector", "EST_FVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_TSimpleVectorT_float_t = {"_p_EST_TSimpleVectorT_float_t", "EST_TSimpleVector< float > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_TVectorT_float_t = {"_p_EST_TVectorT_float_t", "EST_TVector< float > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_T = {"_p_T", "T *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_Item, &_swigt__p_EST_TSimpleVectorT_float_t, &_swigt__p_EST_TVectorT_float_t, &_swigt__p_T, &_swigt__p_char, &_swigt__p_float, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_TSimpleVectorT_float_t[] = { {&_swigt__p_EST_FVector, _p_EST_FVectorTo_p_EST_TSimpleVectorT_float_t, 0, 0}, {&_swigt__p_EST_TSimpleVectorT_float_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_TVectorT_float_t[] = { {&_swigt__p_EST_FVector, _p_EST_FVectorTo_p_EST_TVectorT_float_t, 0, 0}, {&_swigt__p_EST_TVectorT_float_t, 0, 0, 0}, {&_swigt__p_EST_TSimpleVectorT_float_t, _p_EST_TSimpleVectorT_float_tTo_p_EST_TVectorT_float_t, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_T[] = { {&_swigt__p_T, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_Item, _swigc__p_EST_TSimpleVectorT_float_t, _swigc__p_EST_TVectorT_float_t, _swigc__p_T, _swigc__p_char, _swigc__p_float, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "read_ok",SWIG_From_int(static_cast< int >(read_ok))); SWIG_Python_SetConstant(d, "read_format_error",SWIG_From_int(static_cast< int >(read_format_error))); SWIG_Python_SetConstant(d, "read_not_found_error",SWIG_From_int(static_cast< int >(read_not_found_error))); SWIG_Python_SetConstant(d, "read_error",SWIG_From_int(static_cast< int >(read_error))); SWIG_Python_SetConstant(d, "write_ok",SWIG_From_int(static_cast< int >(write_ok))); SWIG_Python_SetConstant(d, "write_fail",SWIG_From_int(static_cast< int >(write_fail))); SWIG_Python_SetConstant(d, "write_error",SWIG_From_int(static_cast< int >(write_error))); SWIG_Python_SetConstant(d, "write_partial",SWIG_From_int(static_cast< int >(write_partial))); SWIG_Python_SetConstant(d, "connect_ok",SWIG_From_int(static_cast< int >(connect_ok))); SWIG_Python_SetConstant(d, "connect_not_found_error",SWIG_From_int(static_cast< int >(connect_not_found_error))); SWIG_Python_SetConstant(d, "connect_not_allowed_error",SWIG_From_int(static_cast< int >(connect_not_allowed_error))); SWIG_Python_SetConstant(d, "connect_system_error",SWIG_From_int(static_cast< int >(connect_system_error))); SWIG_Python_SetConstant(d, "connect_error",SWIG_From_int(static_cast< int >(connect_error))); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Wave_wrap.cc0000644000076400007640000067362611352212620020040 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_Relation swig_types[2] #define SWIGTYPE_p_EST_Track swig_types[3] #define SWIGTYPE_p_EST_Wave swig_types[4] #define SWIGTYPE_p_EST_WaveList swig_types[5] #define SWIGTYPE_p_char swig_types[6] #define SWIGTYPE_p_short swig_types[7] static swig_type_info *swig_types[9]; static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Wave.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Wave #else # define SWIG_init init_EST_Wave #endif #define SWIG_name "_EST_Wave" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_audio.h" #include "EST_Option.h" #include "EST_rw_status.h" #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERNINLINE PyObject * SWIG_From_short (short value) { return SWIG_From_long (value); } SWIGINTERN int SWIG_AsVal_short (PyObject * obj, short *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < SHRT_MIN || v > SHRT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< short >(v); } } return res; } #define SWIG_From_double PyFloat_FromDouble SWIGINTERNINLINE PyObject * SWIG_From_float (float value) { return SWIG_From_double (value); } SWIGINTERN int SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) { if (PyInt_Check(obj)) { long v = PyInt_AsLong(obj); if (v >= 0) { if (val) *val = v; return SWIG_OK; } else { return SWIG_OverflowError; } } else if (PyLong_Check(obj)) { unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { if (val) *val = (unsigned long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { if ((v > UINT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< unsigned int >(v); } } return res; } SWIGINTERNINLINE PyObject* SWIG_From_bool (bool value) { return PyBool_FromLong(value ? 1 : 0); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } SWIGINTERN void EST_Wave_info(EST_Wave *self){ wave_info( *self ); } SWIGINTERN void EST_Wave_play(EST_Wave *self){ EST_Option empty; play_wave( *self, empty ); } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_EST_Wave_default_sample_rate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_default_sample_rate_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_default_sample_rate_get" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (int)(int) ((arg1)->default_sample_rate); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Wave__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Wave")) SWIG_fail; result = (EST_Wave *)new EST_Wave(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Wave, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Wave__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Wave *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Wave",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Wave" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Wave" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (EST_Wave *)new EST_Wave((EST_Wave const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Wave, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Wave__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; int arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_Wave *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:new_EST_Wave",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_EST_Wave" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_EST_Wave" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_EST_Wave" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (EST_Wave *)new EST_Wave(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Wave, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Wave(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_Wave__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Wave__SWIG_1(self, args); } } if (argc == 3) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_EST_Wave__SWIG_2(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_Wave'.\n" " Possible C/C++ prototypes are:\n" " EST_Wave()\n" " EST_Wave(EST_Wave const &)\n" " EST_Wave(int,int,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_Wave(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_Wave",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Wave" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_a",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_a" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_a" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (short)((EST_Wave const *)arg1)->a(arg2,arg3); resultobj = SWIG_From_short(static_cast< short >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_a",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_a" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (short)((EST_Wave const *)arg1)->a(arg2); resultobj = SWIG_From_short(static_cast< short >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_a__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_a__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_a'.\n" " Possible C/C++ prototypes are:\n" " a(EST_Wave const *,int,int)\n" " a(EST_Wave const *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a_safe__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; short *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_a_safe",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_a_safe" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_a_safe" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_a_safe" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (short *) &(arg1)->a_safe(arg2,arg3); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_short, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a_safe__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; short *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_a_safe",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_a_safe" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_a_safe" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (short *) &(arg1)->a_safe(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_short, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_a_safe(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_a_safe__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_a_safe__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_a_safe'.\n" " Possible C/C++ prototypes are:\n" " a_safe(EST_Wave *,int,int)\n" " a_safe(EST_Wave *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_a__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; short arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; short val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Wave_set_a",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_a" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_set_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_set_a" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_short(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_set_a" "', argument " "4"" of type '" "short""'"); } arg4 = static_cast< short >(val4); result = (short)(arg1)->set_a(arg2,arg3,arg4); resultobj = SWIG_From_short(static_cast< short >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_a__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_set_a",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_a" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_set_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_set_a" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (short)(arg1)->set_a(arg2,arg3); resultobj = SWIG_From_short(static_cast< short >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_a__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; short result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_set_a",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_a" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_set_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (short)(arg1)->set_a(arg2); resultobj = SWIG_From_short(static_cast< short >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_a(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_set_a__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_set_a__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_short(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_set_a__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_set_a'.\n" " Possible C/C++ prototypes are:\n" " set_a(EST_Wave *,int,int,short)\n" " set_a(EST_Wave *,int,int)\n" " set_a(EST_Wave *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_t",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_t" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_t" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float)((EST_Wave const *)arg1)->t(arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_num_samples(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_num_samples",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_num_samples" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (int)((EST_Wave const *)arg1)->num_samples(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_num_channels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_num_channels",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_num_channels" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (int)((EST_Wave const *)arg1)->num_channels(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_sample_rate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_sample_rate",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_sample_rate" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (int)((EST_Wave const *)arg1)->sample_rate(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_sample_rate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_set_sample_rate",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_sample_rate" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_set_sample_rate" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_sample_rate(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_length" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (int)((EST_Wave const *)arg1)->length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_end",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_end" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = (float)(arg1)->end(); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_have_left_context(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; unsigned int arg2 ; void *argp1 = 0 ; int res1 = 0 ; unsigned int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_have_left_context",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_have_left_context" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_have_left_context" "', argument " "2"" of type '" "unsigned int""'"); } arg2 = static_cast< unsigned int >(val2); result = (bool)((EST_Wave const *)arg1)->have_left_context(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_sample_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_sample_type",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_sample_type" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = ((EST_Wave const *)arg1)->sample_type(); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_sample_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_set_sample_type",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_sample_type" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_sample_type(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_file_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_file_type",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_file_type" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = ((EST_Wave const *)arg1)->file_type(); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_file_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_set_file_type",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_file_type" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_file_type(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_name",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_name" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); result = ((EST_Wave const *)arg1)->name(); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_set_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_set_name",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_set_name" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_name(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Wave_resize",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_resize" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_resize" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->resize(arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_resize",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_resize" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->resize(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_resize__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_resize",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_resize" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->resize(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_resize(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_resize__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_resize__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_resize__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_resize'.\n" " Possible C/C++ prototypes are:\n" " resize(EST_Wave *,int,int,int)\n" " resize(EST_Wave *,int,int)\n" " resize(EST_Wave *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_resample(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_resample",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_resample" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_resample" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->resample(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_rescale__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; float arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_rescale",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_rescale" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_rescale" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_rescale" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->rescale(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_rescale__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_rescale",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_rescale" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_rescale" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); (arg1)->rescale(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_rescale__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_rescale",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_rescale" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Wave_rescale" "', argument " "2"" of type '" "EST_Track const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Wave_rescale" "', argument " "2"" of type '" "EST_Track const &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); (arg1)->rescale((EST_Track const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_rescale(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_rescale__SWIG_2(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_rescale__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_rescale__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_rescale'.\n" " Possible C/C++ prototypes are:\n" " rescale(EST_Wave *,float,int)\n" " rescale(EST_Wave *,float)\n" " rescale(EST_Wave *,EST_Track const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_clear",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_clear" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); (arg1)->clear(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_copy",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_copy" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Wave_copy" "', argument " "2"" of type '" "EST_Wave const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Wave_copy" "', argument " "2"" of type '" "EST_Wave const &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); (arg1)->copy((EST_Wave const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_fill__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; short arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; short val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_fill",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_fill" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_short(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_fill" "', argument " "2"" of type '" "short""'"); } arg2 = static_cast< short >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_fill" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->fill(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_fill__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; short arg2 ; void *argp1 = 0 ; int res1 = 0 ; short val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_fill",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_fill" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_short(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_fill" "', argument " "2"" of type '" "short""'"); } arg2 = static_cast< short >(val2); (arg1)->fill(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_fill__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_fill",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_fill" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); (arg1)->fill(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_fill(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_fill__SWIG_2(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_short(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_fill__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_short(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_fill__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_fill'.\n" " Possible C/C++ prototypes are:\n" " fill(EST_Wave *,short,int)\n" " fill(EST_Wave *,short)\n" " fill(EST_Wave *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_empty__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_empty",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_empty" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Wave_empty" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->empty(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_empty__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_empty",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_empty" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); (arg1)->empty(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_empty(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_empty__SWIG_1(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_empty__SWIG_0(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_empty'.\n" " Possible C/C++ prototypes are:\n" " empty(EST_Wave *,int)\n" " empty(EST_Wave *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Wave_load",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_load" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_load" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Wave_load" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); result = (EST_read_status)(arg1)->load(arg2,arg3,arg4,arg5); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Wave_load",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_load" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_load" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); result = (EST_read_status)(arg1)->load(arg2,arg3,arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_load",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Wave_load" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (EST_read_status)(arg1)->load(arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } result = (EST_read_status)(arg1)->load(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_load__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load__SWIG_1(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load__SWIG_0(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_load'.\n" " Possible C/C++ prototypes are:\n" " load(EST_Wave *,EST_String const,int,int,int)\n" " load(EST_Wave *,EST_String const,int,int)\n" " load(EST_Wave *,EST_String const,int)\n" " load(EST_Wave *,EST_String const)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load_file__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; int arg8 ; int arg9 ; void *argp1 = 0 ; int res1 = 0 ; int val4 ; int ecode4 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; int val8 ; int ecode8 = 0 ; int val9 ; int ecode9 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:EST_Wave_load_file",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load_file" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_load_file" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj4, &str, &len); arg5 = EST_String( str, len, 0, len ); } ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Wave_load_file" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EST_Wave_load_file" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); ecode8 = SWIG_AsVal_int(obj7, &val8); if (!SWIG_IsOK(ecode8)) { SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "EST_Wave_load_file" "', argument " "8"" of type '" "int""'"); } arg8 = static_cast< int >(val8); ecode9 = SWIG_AsVal_int(obj8, &val9); if (!SWIG_IsOK(ecode9)) { SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "EST_Wave_load_file" "', argument " "9"" of type '" "int""'"); } arg9 = static_cast< int >(val9); result = (EST_read_status)(arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load_file__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; int arg8 ; void *argp1 = 0 ; int res1 = 0 ; int val4 ; int ecode4 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; int val8 ; int ecode8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:EST_Wave_load_file",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load_file" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_load_file" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj4, &str, &len); arg5 = EST_String( str, len, 0, len ); } ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Wave_load_file" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EST_Wave_load_file" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); ecode8 = SWIG_AsVal_int(obj7, &val8); if (!SWIG_IsOK(ecode8)) { SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "EST_Wave_load_file" "', argument " "8"" of type '" "int""'"); } arg8 = static_cast< int >(val8); result = (EST_read_status)(arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7,arg8); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load_file__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; void *argp1 = 0 ; int res1 = 0 ; int val4 ; int ecode4 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:EST_Wave_load_file",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_load_file" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Wave_load_file" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj4, &str, &len); arg5 = EST_String( str, len, 0, len ); } ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Wave_load_file" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EST_Wave_load_file" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); result = (EST_read_status)(arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_load_file(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 9); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 7) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load_file__SWIG_2(self, args); } } } } } } } } if (argc == 8) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load_file__SWIG_1(self, args); } } } } } } } } } if (argc == 9) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[8], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Wave_load_file__SWIG_0(self, args); } } } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_load_file'.\n" " Possible C/C++ prototypes are:\n" " load_file(EST_Wave *,EST_String const,EST_String const,int,EST_String const,int,int,int,int)\n" " load_file(EST_Wave *,EST_String const,EST_String const,int,EST_String const,int,int,int)\n" " load_file(EST_Wave *,EST_String const,EST_String const,int,EST_String const,int,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Wave_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_save" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } result = (EST_write_status)(arg1)->save(arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Wave_save",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_save" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } result = (EST_write_status)(arg1)->save(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_save(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_save__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Wave_save__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Wave_save'.\n" " Possible C/C++ prototypes are:\n" " save(EST_Wave *,EST_String const,EST_String const)\n" " save(EST_Wave *,EST_String const)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_save_file(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; EST_String arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Wave_save_file",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_save_file" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj3, &str, &len); arg4 = EST_String( str, len, 0, len ); } ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Wave_save_file" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); result = (EST_write_status)(arg1)->save_file(arg2,arg3,arg4,arg5); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_integrity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_integrity",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_integrity" "', argument " "1"" of type '" "EST_Wave const *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ((EST_Wave const *)arg1)->integrity(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_info(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_info",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_info" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); EST_Wave_info(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Wave_play(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = (EST_Wave *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Wave_play",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Wave, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Wave_play" "', argument " "1"" of type '" "EST_Wave *""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); EST_Wave_play(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_Wave_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_Wave, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_wave_extract_channel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:wave_extract_channel",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_extract_channel" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_extract_channel" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "wave_extract_channel" "', argument " "2"" of type '" "EST_Wave const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_extract_channel" "', argument " "2"" of type '" "EST_Wave const &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "wave_extract_channel" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (int)wave_extract_channel(*arg1,(EST_Wave const &)*arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_wave_combine_channels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:wave_combine_channels",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_combine_channels" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_combine_channels" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "wave_combine_channels" "', argument " "2"" of type '" "EST_Wave const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_combine_channels" "', argument " "2"" of type '" "EST_Wave const &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); wave_combine_channels(*arg1,(EST_Wave const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_wave_subwave(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOOO:wave_subwave",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_subwave" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_subwave" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "wave_subwave" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_subwave" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "wave_subwave" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "wave_subwave" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); result = (int)wave_subwave(*arg1,*arg2,arg3,arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_wave_divide(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_WaveList *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Relation *arg3 = 0 ; EST_String *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; EST_String temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOOO:wave_divide",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_WaveList, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_divide" "', argument " "1"" of type '" "EST_WaveList &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_divide" "', argument " "1"" of type '" "EST_WaveList &""'"); } arg1 = reinterpret_cast< EST_WaveList * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "wave_divide" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_divide" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Relation, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wave_divide" "', argument " "3"" of type '" "EST_Relation &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_divide" "', argument " "3"" of type '" "EST_Relation &""'"); } arg3 = reinterpret_cast< EST_Relation * >(argp3); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj3, &str, &len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } result = (int)wave_divide(*arg1,*arg2,*arg3,(EST_String const &)*arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_wave_extract(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Relation *arg3 = 0 ; EST_String *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; EST_String temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOOO:wave_extract",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_extract" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_extract" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "wave_extract" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_extract" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Relation, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wave_extract" "', argument " "3"" of type '" "EST_Relation &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_extract" "', argument " "3"" of type '" "EST_Relation &""'"); } arg3 = reinterpret_cast< EST_Relation * >(argp3); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj3, &str, &len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } result = (int)wave_extract(*arg1,*arg2,*arg3,(EST_String const &)*arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_add_waves(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:add_waves",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "add_waves" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "add_waves" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "add_waves" "', argument " "2"" of type '" "EST_Wave const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "add_waves" "', argument " "2"" of type '" "EST_Wave const &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); add_waves(*arg1,(EST_Wave const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_difference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Wave result; if (!PyArg_ParseTuple(args,(char *)"OO:difference",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "difference" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "difference" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "difference" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "difference" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); result = difference(*arg1,*arg2); resultobj = SWIG_NewPointerObj((new EST_Wave(static_cast< const EST_Wave& >(result))), SWIGTYPE_p_EST_Wave, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_rms_error__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OOO:rms_error",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rms_error" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "rms_error" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rms_error" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "rms_error" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rms_error" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (float)rms_error(*arg1,*arg2,arg3); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_abs_error__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OOO:abs_error",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "abs_error" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "abs_error" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "abs_error" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "abs_error" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "abs_error" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (float)abs_error(*arg1,*arg2,arg3); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_correlation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OOO:correlation",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "correlation" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "correlation" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "correlation" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "correlation" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "correlation" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (float)correlation(*arg1,*arg2,arg3); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_rms_error__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:rms_error",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rms_error" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "rms_error" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rms_error" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "rms_error" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); result = rms_error(*arg1,*arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_rms_error(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_rms_error__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_rms_error__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'rms_error'.\n" " Possible C/C++ prototypes are:\n" " rms_error(EST_Wave &,EST_Wave &,int)\n" " rms_error(EST_Wave &,EST_Wave &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_abs_error__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:abs_error",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "abs_error" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "abs_error" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "abs_error" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "abs_error" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); result = abs_error(*arg1,*arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_abs_error(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_abs_error__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_abs_error__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'abs_error'.\n" " Possible C/C++ prototypes are:\n" " abs_error(EST_Wave &,EST_Wave &,int)\n" " abs_error(EST_Wave &,EST_Wave &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_correlation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:correlation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "correlation" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "correlation" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "correlation" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "correlation" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); result = correlation(*arg1,*arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_correlation(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_correlation__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_correlation__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'correlation'.\n" " Possible C/C++ prototypes are:\n" " correlation(EST_Wave &,EST_Wave &,int)\n" " correlation(EST_Wave &,EST_Wave &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_Wave result; if (!PyArg_ParseTuple(args,(char *)"OOO:error",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "error" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "error" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "error" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "error" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "error" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = error(*arg1,*arg2,arg3); resultobj = SWIG_NewPointerObj((new EST_Wave(static_cast< const EST_Wave& >(result))), SWIGTYPE_p_EST_Wave, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_absolute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:absolute",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "absolute" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "absolute" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); absolute(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_wave_info(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:wave_info",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wave_info" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "wave_info" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); wave_info(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_invert(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:invert",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "invert" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "invert" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); invert(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_differentiate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:differentiate",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "differentiate" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "differentiate" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); differentiate(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_reverse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:reverse",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "reverse" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "reverse" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); reverse(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"EST_Wave_default_sample_rate_get", _wrap_EST_Wave_default_sample_rate_get, METH_VARARGS, NULL}, { (char *)"new_EST_Wave", _wrap_new_EST_Wave, METH_VARARGS, NULL}, { (char *)"delete_EST_Wave", _wrap_delete_EST_Wave, METH_VARARGS, NULL}, { (char *)"EST_Wave_a", _wrap_EST_Wave_a, METH_VARARGS, NULL}, { (char *)"EST_Wave_a_safe", _wrap_EST_Wave_a_safe, METH_VARARGS, NULL}, { (char *)"EST_Wave_set_a", _wrap_EST_Wave_set_a, METH_VARARGS, NULL}, { (char *)"EST_Wave_t", _wrap_EST_Wave_t, METH_VARARGS, NULL}, { (char *)"EST_Wave_num_samples", _wrap_EST_Wave_num_samples, METH_VARARGS, NULL}, { (char *)"EST_Wave_num_channels", _wrap_EST_Wave_num_channels, METH_VARARGS, NULL}, { (char *)"EST_Wave_sample_rate", _wrap_EST_Wave_sample_rate, METH_VARARGS, NULL}, { (char *)"EST_Wave_set_sample_rate", _wrap_EST_Wave_set_sample_rate, METH_VARARGS, NULL}, { (char *)"EST_Wave_length", _wrap_EST_Wave_length, METH_VARARGS, NULL}, { (char *)"EST_Wave_end", _wrap_EST_Wave_end, METH_VARARGS, NULL}, { (char *)"EST_Wave_have_left_context", _wrap_EST_Wave_have_left_context, METH_VARARGS, NULL}, { (char *)"EST_Wave_sample_type", _wrap_EST_Wave_sample_type, METH_VARARGS, NULL}, { (char *)"EST_Wave_set_sample_type", _wrap_EST_Wave_set_sample_type, METH_VARARGS, NULL}, { (char *)"EST_Wave_file_type", _wrap_EST_Wave_file_type, METH_VARARGS, NULL}, { (char *)"EST_Wave_set_file_type", _wrap_EST_Wave_set_file_type, METH_VARARGS, NULL}, { (char *)"EST_Wave_name", _wrap_EST_Wave_name, METH_VARARGS, NULL}, { (char *)"EST_Wave_set_name", _wrap_EST_Wave_set_name, METH_VARARGS, NULL}, { (char *)"EST_Wave_resize", _wrap_EST_Wave_resize, METH_VARARGS, NULL}, { (char *)"EST_Wave_resample", _wrap_EST_Wave_resample, METH_VARARGS, NULL}, { (char *)"EST_Wave_rescale", _wrap_EST_Wave_rescale, METH_VARARGS, NULL}, { (char *)"EST_Wave_clear", _wrap_EST_Wave_clear, METH_VARARGS, NULL}, { (char *)"EST_Wave_copy", _wrap_EST_Wave_copy, METH_VARARGS, NULL}, { (char *)"EST_Wave_fill", _wrap_EST_Wave_fill, METH_VARARGS, NULL}, { (char *)"EST_Wave_empty", _wrap_EST_Wave_empty, METH_VARARGS, NULL}, { (char *)"EST_Wave_load", _wrap_EST_Wave_load, METH_VARARGS, NULL}, { (char *)"EST_Wave_load_file", _wrap_EST_Wave_load_file, METH_VARARGS, NULL}, { (char *)"EST_Wave_save", _wrap_EST_Wave_save, METH_VARARGS, NULL}, { (char *)"EST_Wave_save_file", _wrap_EST_Wave_save_file, METH_VARARGS, NULL}, { (char *)"EST_Wave_integrity", _wrap_EST_Wave_integrity, METH_VARARGS, NULL}, { (char *)"EST_Wave_info", _wrap_EST_Wave_info, METH_VARARGS, NULL}, { (char *)"EST_Wave_play", _wrap_EST_Wave_play, METH_VARARGS, NULL}, { (char *)"EST_Wave_swigregister", EST_Wave_swigregister, METH_VARARGS, NULL}, { (char *)"wave_extract_channel", _wrap_wave_extract_channel, METH_VARARGS, NULL}, { (char *)"wave_combine_channels", _wrap_wave_combine_channels, METH_VARARGS, NULL}, { (char *)"wave_subwave", _wrap_wave_subwave, METH_VARARGS, NULL}, { (char *)"wave_divide", _wrap_wave_divide, METH_VARARGS, NULL}, { (char *)"wave_extract", _wrap_wave_extract, METH_VARARGS, NULL}, { (char *)"add_waves", _wrap_add_waves, METH_VARARGS, NULL}, { (char *)"difference", _wrap_difference, METH_VARARGS, NULL}, { (char *)"rms_error", _wrap_rms_error, METH_VARARGS, NULL}, { (char *)"abs_error", _wrap_abs_error, METH_VARARGS, NULL}, { (char *)"correlation", _wrap_correlation, METH_VARARGS, NULL}, { (char *)"error", _wrap_error, METH_VARARGS, NULL}, { (char *)"absolute", _wrap_absolute, METH_VARARGS, NULL}, { (char *)"wave_info", _wrap_wave_info, METH_VARARGS, NULL}, { (char *)"invert", _wrap_invert, METH_VARARGS, NULL}, { (char *)"differentiate", _wrap_differentiate, METH_VARARGS, NULL}, { (char *)"reverse", _wrap_reverse, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_FVector = {"_p_EST_FVector", "EST_FVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Track = {"_p_EST_Track", "EST_Track *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Wave = {"_p_EST_Wave", "EST_Wave *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_WaveList = {"_p_EST_WaveList", "EST_WaveList *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_EST_Track, &_swigt__p_EST_Wave, &_swigt__p_EST_WaveList, &_swigt__p_char, &_swigt__p_short, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Wave[] = { {&_swigt__p_EST_Wave, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_WaveList[] = { {&_swigt__p_EST_WaveList, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_EST_Track, _swigc__p_EST_Wave, _swigc__p_EST_WaveList, _swigc__p_char, _swigc__p_short, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "read_ok",SWIG_From_int(static_cast< int >(read_ok))); SWIG_Python_SetConstant(d, "read_format_error",SWIG_From_int(static_cast< int >(read_format_error))); SWIG_Python_SetConstant(d, "read_not_found_error",SWIG_From_int(static_cast< int >(read_not_found_error))); SWIG_Python_SetConstant(d, "read_error",SWIG_From_int(static_cast< int >(read_error))); SWIG_Python_SetConstant(d, "write_ok",SWIG_From_int(static_cast< int >(write_ok))); SWIG_Python_SetConstant(d, "write_fail",SWIG_From_int(static_cast< int >(write_fail))); SWIG_Python_SetConstant(d, "write_error",SWIG_From_int(static_cast< int >(write_error))); SWIG_Python_SetConstant(d, "write_partial",SWIG_From_int(static_cast< int >(write_partial))); SWIG_Python_SetConstant(d, "connect_ok",SWIG_From_int(static_cast< int >(connect_ok))); SWIG_Python_SetConstant(d, "connect_not_found_error",SWIG_From_int(static_cast< int >(connect_not_found_error))); SWIG_Python_SetConstant(d, "connect_not_allowed_error",SWIG_From_int(static_cast< int >(connect_not_allowed_error))); SWIG_Python_SetConstant(d, "connect_system_error",SWIG_From_int(static_cast< int >(connect_system_error))); SWIG_Python_SetConstant(d, "connect_error",SWIG_From_int(static_cast< int >(connect_error))); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Track_wrap.cc0000644000076400007640000122327011352212620020165 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_IVector swig_types[1] #define SWIGTYPE_p_EST_Item swig_types[2] #define SWIGTYPE_p_EST_Track swig_types[3] #define SWIGTYPE_p_char swig_types[4] #define SWIGTYPE_p_float swig_types[5] static swig_type_info *swig_types[7]; static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Track.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Track #else # define SWIG_init init_EST_Track #endif #define SWIG_name "_EST_Track" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "EST_Track.h" #include "EST_track_aux.h" #include "EST_rw_status.h" #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #define SWIG_From_double PyFloat_FromDouble SWIGINTERNINLINE PyObject * SWIG_From_float (float value) { return SWIG_From_double (value); } #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERN int SWIG_AsVal_bool (PyObject *obj, bool *val) { int r = PyObject_IsTrue(obj); if (r == -1) return SWIG_ERROR; if (val) *val = r ? true : false; return SWIG_OK; } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERNINLINE PyObject* SWIG_From_bool (bool value) { return PyBool_FromLong(value ? 1 : 0); } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_EST_Track_default_frame_shift_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_default_frame_shift_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_default_frame_shift_get" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (float)(float) ((arg1)->default_frame_shift); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_default_sample_rate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_default_sample_rate_get",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_default_sample_rate_get" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)(int) ((arg1)->default_sample_rate); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Track__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Track")) SWIG_fail; result = (EST_Track *)new EST_Track(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Track, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Track__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Track *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Track",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Track" "', argument " "1"" of type '" "EST_Track const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Track" "', argument " "1"" of type '" "EST_Track const &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (EST_Track *)new EST_Track((EST_Track const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Track, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Track__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Track *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:new_EST_Track",&obj0,&obj1)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_EST_Track" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_EST_Track" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (EST_Track *)new EST_Track(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Track, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Track(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_Track__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Track__SWIG_1(self, args); } } if (argc == 2) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_new_EST_Track__SWIG_2(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_Track'.\n" " Possible C/C++ prototypes are:\n" " EST_Track()\n" " EST_Track(EST_Track const &)\n" " EST_Track(int,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_Track(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_Track",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; bool arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; bool val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_resize",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_resize" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_resize" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); (arg1)->resize(arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_resize",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_resize" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_resize" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_resize" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->resize(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_resize(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_resize__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_resize__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_resize'.\n" " Possible C/C++ prototypes are:\n" " resize(EST_Track *,int,int,bool)\n" " resize(EST_Track *,int,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_channels__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_set_num_channels",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_num_channels" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_num_channels" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_set_num_channels" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); (arg1)->set_num_channels(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_channels__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_num_channels",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_num_channels" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_num_channels" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_num_channels(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_channels(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_set_num_channels__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_set_num_channels__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_set_num_channels'.\n" " Possible C/C++ prototypes are:\n" " set_num_channels(EST_Track *,int,bool)\n" " set_num_channels(EST_Track *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_frames__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_set_num_frames",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_num_frames" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_num_frames" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_set_num_frames" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); (arg1)->set_num_frames(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_frames__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_num_frames",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_num_frames" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_num_frames" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_num_frames(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_num_frames(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_set_num_frames__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_set_num_frames__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_set_num_frames'.\n" " Possible C/C++ prototypes are:\n" " set_num_frames(EST_Track *,int,bool)\n" " set_num_frames(EST_Track *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_channel_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_set_channel_name",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_channel_name" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_set_channel_name" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->set_channel_name((EST_String const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_aux_channel_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_set_aux_channel_name",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_aux_channel_name" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_set_aux_channel_name" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->set_aux_channel_name((EST_String const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_copy_setup",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_setup" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_setup" "', argument " "2"" of type '" "EST_Track const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_setup" "', argument " "2"" of type '" "EST_Track const &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); (arg1)->copy_setup((EST_Track const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_name",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_name" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = ((EST_Track const *)arg1)->name(); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_name",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_name" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->set_name((EST_String const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_frame__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_frame",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_frame" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_frame" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_frame" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_frame" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->frame(*arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_frame__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_frame",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_frame" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_frame" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_frame" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->frame(*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_frame__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_frame",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_frame" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_frame" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_frame" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->frame(*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_frame(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_frame__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_frame__SWIG_1(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_frame__SWIG_0(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_frame'.\n" " Possible C/C++ prototypes are:\n" " frame(EST_Track *,EST_FVector &,int,int,int)\n" " frame(EST_Track *,EST_FVector &,int,int)\n" " frame(EST_Track *,EST_FVector &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_channel",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_channel" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_channel" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->channel(*arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_channel",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_channel" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->channel(*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_channel",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->channel(*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_channel",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "char const *""'"); } arg3 = reinterpret_cast< char * >(buf3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_channel" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_channel" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->channel(*arg2,(char const *)arg3,arg4,arg5); resultobj = SWIG_Py_Void(); if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_channel",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "char const *""'"); } arg3 = reinterpret_cast< char * >(buf3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_channel" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->channel(*arg2,(char const *)arg3,arg4); resultobj = SWIG_Py_Void(); if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_channel",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_channel" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_channel" "', argument " "3"" of type '" "char const *""'"); } arg3 = reinterpret_cast< char * >(buf3); (arg1)->channel(*arg2,(char const *)arg3); resultobj = SWIG_Py_Void(); if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return resultobj; fail: if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel__SWIG_2(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_channel__SWIG_5(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel__SWIG_1(self, args); } } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel__SWIG_4(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel__SWIG_0(self, args); } } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel__SWIG_3(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_channel'.\n" " Possible C/C++ prototypes are:\n" " channel(EST_Track *,EST_FVector &,int,int,int)\n" " channel(EST_Track *,EST_FVector &,int,int)\n" " channel(EST_Track *,EST_FVector &,int)\n" " channel(EST_Track *,EST_FVector &,char const *,int,int)\n" " channel(EST_Track *,EST_FVector &,char const *,int)\n" " channel(EST_Track *,EST_FVector &,char const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:EST_Track_sub_track",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sub_track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_sub_track" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_sub_track" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); (arg1)->sub_track(*arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_sub_track",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sub_track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_sub_track" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->sub_track(*arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_sub_track",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sub_track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->sub_track(*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_sub_track",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sub_track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); (arg1)->sub_track(*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_sub_track",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sub_track" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); (arg1)->sub_track(*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sub_track(PyObject *self, PyObject *args) { int argc; PyObject *argv[7]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 6); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_sub_track__SWIG_4(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_sub_track__SWIG_3(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_sub_track__SWIG_2(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_sub_track__SWIG_1(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_sub_track__SWIG_0(self, args); } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_sub_track'.\n" " Possible C/C++ prototypes are:\n" " sub_track(EST_Track *,EST_Track &,int,int,int,int)\n" " sub_track(EST_Track *,EST_Track &,int,int,int)\n" " sub_track(EST_Track *,EST_Track &,int,int)\n" " sub_track(EST_Track *,EST_Track &,int)\n" " sub_track(EST_Track *,EST_Track &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:EST_Track_copy_sub_track",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_copy_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_sub_track" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_copy_sub_track" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_sub_track",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_copy_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_sub_track" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_sub_track",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_copy_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_sub_track" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_sub_track",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_copy_sub_track" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_copy_sub_track",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ((EST_Track const *)arg1)->copy_sub_track(*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track(PyObject *self, PyObject *args) { int argc; PyObject *argv[7]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 6); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_sub_track__SWIG_4(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_sub_track__SWIG_3(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_sub_track__SWIG_2(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_sub_track__SWIG_1(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_sub_track__SWIG_0(self, args); } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_sub_track'.\n" " Possible C/C++ prototypes are:\n" " copy_sub_track(EST_Track const *,EST_Track &,int,int,int,int)\n" " copy_sub_track(EST_Track const *,EST_Track &,int,int,int)\n" " copy_sub_track(EST_Track const *,EST_Track &,int,int)\n" " copy_sub_track(EST_Track const *,EST_Track &,int)\n" " copy_sub_track(EST_Track const *,EST_Track &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track_out__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_sub_track_out",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track_out" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track_out" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_sub_track_out" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track_out" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ((EST_Track const *)arg1)->copy_sub_track_out(*arg2,(EST_FVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track_out__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; EST_IVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_sub_track_out",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_sub_track_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_copy_sub_track_out" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track_out" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_sub_track_out" "', argument " "3"" of type '" "EST_IVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_sub_track_out" "', argument " "3"" of type '" "EST_IVector const &""'"); } arg3 = reinterpret_cast< EST_IVector * >(argp3); ((EST_Track const *)arg1)->copy_sub_track_out(*arg2,(EST_IVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_sub_track_out(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_sub_track_out__SWIG_0(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_sub_track_out__SWIG_1(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_sub_track_out'.\n" " Possible C/C++ prototypes are:\n" " copy_sub_track_out(EST_Track const *,EST_Track &,EST_FVector const &)\n" " copy_sub_track_out(EST_Track const *,EST_Track &,EST_IVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_out__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_channel_out",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_out" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_channel_out" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_out__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_channel_out",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_out" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_out__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_channel_out",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_out(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_channel_out__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_out__SWIG_1(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_out__SWIG_0(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_channel_out'.\n" " Possible C/C++ prototypes are:\n" " copy_channel_out(EST_Track const *,int,EST_FVector &,int,int)\n" " copy_channel_out(EST_Track const *,int,EST_FVector &,int)\n" " copy_channel_out(EST_Track const *,int,EST_FVector &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_out__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_frame_out",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_out" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_frame_out" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_out__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_frame_out",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_out" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_out__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_frame_out",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_out" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_out" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_out" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_out(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_frame_out__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_out__SWIG_1(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_out__SWIG_0(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_frame_out'.\n" " Possible C/C++ prototypes are:\n" " copy_frame_out(EST_Track const *,int,EST_FVector &,int,int)\n" " copy_frame_out(EST_Track const *,int,EST_FVector &,int)\n" " copy_frame_out(EST_Track const *,int,EST_FVector &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_channel_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_channel_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_copy_channel_in" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EST_Track_copy_channel_in" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_channel_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_copy_channel_in" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_channel_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_channel_in",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_channel_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_channel_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_channel_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_channel_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_channel_in(PyObject *self, PyObject *args) { int argc; PyObject *argv[8]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 7); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_1(self, args); } } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_6(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_5(self, args); } } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_0(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_4(self, args); } } } } } } } if (argc == 7) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_channel_in__SWIG_3(self, args); } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_channel_in'.\n" " Possible C/C++ prototypes are:\n" " copy_channel_in(EST_Track *,int,EST_FVector const &,int,int)\n" " copy_channel_in(EST_Track *,int,EST_FVector const &,int)\n" " copy_channel_in(EST_Track *,int,EST_FVector const &)\n" " copy_channel_in(EST_Track *,int,EST_Track const &,int,int,int,int)\n" " copy_channel_in(EST_Track *,int,EST_Track const &,int,int,int)\n" " copy_channel_in(EST_Track *,int,EST_Track const &,int,int)\n" " copy_channel_in(EST_Track *,int,EST_Track const &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_frame_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_frame_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_copy_frame_in" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EST_Track_copy_frame_in" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_frame_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "EST_Track_copy_frame_in" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Track_copy_frame_in" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_copy_frame_in",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_copy_frame_in" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_copy_frame_in" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_copy_frame_in" "', argument " "3"" of type '" "EST_Track const &""'"); } arg3 = reinterpret_cast< EST_Track * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_copy_frame_in" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_copy_frame_in(PyObject *self, PyObject *args) { int argc; PyObject *argv[8]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 7); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_1(self, args); } } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_6(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_5(self, args); } } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_0(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_4(self, args); } } } } } } } if (argc == 7) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_copy_frame_in__SWIG_3(self, args); } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_copy_frame_in'.\n" " Possible C/C++ prototypes are:\n" " copy_frame_in(EST_Track *,int,EST_FVector const &,int,int)\n" " copy_frame_in(EST_Track *,int,EST_FVector const &,int)\n" " copy_frame_in(EST_Track *,int,EST_FVector const &)\n" " copy_frame_in(EST_Track *,int,EST_Track const &,int,int,int,int)\n" " copy_frame_in(EST_Track *,int,EST_Track const &,int,int,int)\n" " copy_frame_in(EST_Track *,int,EST_Track const &,int,int)\n" " copy_frame_in(EST_Track *,int,EST_Track const &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_position__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_channel_position",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel_position" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel_position" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_channel_position" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (int)((EST_Track const *)arg1)->channel_position((char const *)arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_position__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_channel_position",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel_position" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_channel_position" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); result = (int)((EST_Track const *)arg1)->channel_position((char const *)arg2); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_position(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_channel_position__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel_position__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_channel_position'.\n" " Possible C/C++ prototypes are:\n" " channel_position(EST_Track const *,char const *,int)\n" " channel_position(EST_Track const *,char const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_has_channel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_has_channel",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_has_channel" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_has_channel" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); result = (bool)((EST_Track const *)arg1)->has_channel((char const *)arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_a__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_a",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_a" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_a" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (float)((EST_Track const *)arg1)->a(arg2,arg3); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_a__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_a",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_a" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_a" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float)((EST_Track const *)arg1)->a(arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_a__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_a",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_a" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_a" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_a" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (float)((EST_Track const *)arg1)->a(arg2,arg3); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_a__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_a",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_a" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_a" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (float)((EST_Track const *)arg1)->a(arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_a(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_a__SWIG_1(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_a__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_a__SWIG_0(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_a__SWIG_2(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_a'.\n" " Possible C/C++ prototypes are:\n" " a(EST_Track const *,int,int)\n" " a(EST_Track const *,int)\n" " a(EST_Track const *,float,int)\n" " a(EST_Track const *,float)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_t__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_t",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_t" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_t" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float)((EST_Track const *)arg1)->t(arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_t__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_t",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_t" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (float)((EST_Track const *)arg1)->t(); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_t(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_t__SWIG_1(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_t__SWIG_0(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_t'.\n" " Possible C/C++ prototypes are:\n" " t(EST_Track const *,int)\n" " t(EST_Track const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_ms_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_ms_t",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_ms_t" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_ms_t" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float)((EST_Track const *)arg1)->ms_t(arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_fill_time__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_fill_time",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_fill_time" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_fill_time" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_fill_time" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); (arg1)->fill_time(arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_fill_time__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_fill_time",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_fill_time" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_fill_time" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); (arg1)->fill_time(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_fill_time__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_fill_time",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_fill_time" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_fill_time" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track_fill_time" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); (arg1)->fill_time(*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_fill_time(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_fill_time__SWIG_2(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_fill_time__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_fill_time__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_fill_time'.\n" " Possible C/C++ prototypes are:\n" " fill_time(EST_Track *,float,float)\n" " fill_time(EST_Track *,float)\n" " fill_time(EST_Track *,EST_Track &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_fill(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_fill",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_fill" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_fill" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); (arg1)->fill(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_sample",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_sample" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_sample" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); (arg1)->sample(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_shift(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_shift",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_shift" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (float)((EST_Track const *)arg1)->shift(); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_start",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_start" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (float)((EST_Track const *)arg1)->start(); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_end",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_end" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (float)((EST_Track const *)arg1)->end(); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; float arg3 ; float arg4 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; float val3 ; int ecode3 = 0 ; float val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Track_load",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_load" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_load" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_load" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); ecode4 = SWIG_AsVal_float(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Track_load" "', argument " "4"" of type '" "float""'"); } arg4 = static_cast< float >(val4); result = (EST_read_status)(arg1)->load((char const *)arg2,arg3,arg4); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_load",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_load" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_load" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_load" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); result = (EST_read_status)(arg1)->load((char const *)arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_load__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_load" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_load" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); result = (EST_read_status)(arg1)->load((char const *)arg2); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_load(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_load__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_load__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_load__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_load'.\n" " Possible C/C++ prototypes are:\n" " load(EST_Track *,char const *,float,float)\n" " load(EST_Track *,char const *,float)\n" " load(EST_Track *,char const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_save" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_save" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Track_save" "', argument " "3"" of type '" "char const *""'"); } arg3 = reinterpret_cast< char * >(buf3); result = (EST_write_status)(arg1)->save((char const *)arg2,(char const *)arg3); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_save",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_save" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track_save" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); result = (EST_write_status)(arg1)->save((char const *)arg2); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_save(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_save__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Track_save__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_save'.\n" " Possible C/C++ prototypes are:\n" " save(EST_Track *,char const *,char const *)\n" " save(EST_Track *,char const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_break",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_break" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_break" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_break(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_value",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_value" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_value" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_value(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_val(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_val",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_val" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_val" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (int)((EST_Track const *)arg1)->val(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_track_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_track_break",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_track_break" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_track_break" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (int)((EST_Track const *)arg1)->track_break(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_prev_non_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_prev_non_break",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_prev_non_break" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_prev_non_break" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (int)((EST_Track const *)arg1)->prev_non_break(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_next_non_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_next_non_break",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_next_non_break" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_next_non_break" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (int)((EST_Track const *)arg1)->next_non_break(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_empty",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_empty" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)((EST_Track const *)arg1)->empty(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_index",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_index" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_index" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (int)((EST_Track const *)arg1)->index(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_index_below(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_index_below",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_index_below" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_index_below" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); result = (int)((EST_Track const *)arg1)->index_below(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_num_frames(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_num_frames",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_num_frames" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)((EST_Track const *)arg1)->num_frames(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_length" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)((EST_Track const *)arg1)->length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_num_channels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_num_channels",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_num_channels" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)((EST_Track const *)arg1)->num_channels(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_num_aux_channels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_num_aux_channels",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_num_aux_channels" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (int)((EST_Track const *)arg1)->num_aux_channels(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_equal_space(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_equal_space",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_equal_space" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (bool)((EST_Track const *)arg1)->equal_space(); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_single_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Track_single_break",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_single_break" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); result = (bool)((EST_Track const *)arg1)->single_break(); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_equal_space(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; bool arg2 ; void *argp1 = 0 ; int res1 = 0 ; bool val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_equal_space",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_equal_space" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_bool(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_equal_space" "', argument " "2"" of type '" "bool""'"); } arg2 = static_cast< bool >(val2); (arg1)->set_equal_space(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_set_single_break(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; bool arg2 ; void *argp1 = 0 ; int res1 = 0 ; bool val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_set_single_break",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_set_single_break" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_bool(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_set_single_break" "', argument " "2"" of type '" "bool""'"); } arg2 = static_cast< bool >(val2); (arg1)->set_single_break(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Track *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track___iadd__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track___iadd__" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track___iadd__" "', argument " "2"" of type '" "EST_Track const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track___iadd__" "', argument " "2"" of type '" "EST_Track const &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); result = (EST_Track *) &(arg1)->operator +=((EST_Track const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Track, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track___ior__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Track *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track___ior__",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track___ior__" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Track___ior__" "', argument " "2"" of type '" "EST_Track const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Track___ior__" "', argument " "2"" of type '" "EST_Track const &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); result = (EST_Track *) &(arg1)->operator |=((EST_Track const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Track, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_load_channel_names(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_load_channel_names",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_load_channel_names" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } result = (EST_read_status)(arg1)->load_channel_names(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_save_channel_names(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_save_channel_names",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_save_channel_names" "', argument " "1"" of type '" "EST_Track *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } result = (EST_write_status)(arg1)->save_channel_names(arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_name__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Track_channel_name",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel_name" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_channel_name" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Track_channel_name" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = ((EST_Track const *)arg1)->channel_name(arg2,arg3); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_name__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_channel_name",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_channel_name" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_channel_name" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = ((EST_Track const *)arg1)->channel_name(arg2); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_channel_name(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel_name__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Track_channel_name__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Track_channel_name'.\n" " Possible C/C++ prototypes are:\n" " channel_name(EST_Track const *,int,int)\n" " channel_name(EST_Track const *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Track_aux_channel_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Track_aux_channel_name",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Track, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Track_aux_channel_name" "', argument " "1"" of type '" "EST_Track const *""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Track_aux_channel_name" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = ((EST_Track const *)arg1)->aux_channel_name(arg2); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_Track_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_Track, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_mean__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:mean",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "mean" "', argument " "1"" of type '" "EST_Track const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "mean" "', argument " "1"" of type '" "EST_Track const &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mean" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (float)mean((EST_Track const &)*arg1,arg2); resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_mean__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:mean",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "mean" "', argument " "1"" of type '" "EST_Track const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "mean" "', argument " "1"" of type '" "EST_Track const &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "mean" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "mean" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); mean((EST_Track const &)*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_mean(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_mean__SWIG_1(self, args); } } } if (argc == 2) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_mean__SWIG_0(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'mean'.\n" " Possible C/C++ prototypes are:\n" " mean(EST_Track const &,int)\n" " mean(EST_Track const &,EST_FVector &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_meansd__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; float *arg2 = 0 ; float *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; float temp2 ; int res2 = SWIG_TMPOBJ ; float temp3 ; int res3 = SWIG_TMPOBJ ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; arg2 = &temp2; arg3 = &temp3; if (!PyArg_ParseTuple(args,(char *)"OO:meansd",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "meansd" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "meansd" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode4 = SWIG_AsVal_int(obj1, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "meansd" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); meansd(*arg1,*arg2,*arg3,arg4); resultobj = SWIG_Py_Void(); if (SWIG_IsTmpObj(res2)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_float((*arg2))); } else { int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_float, new_flags)); } if (SWIG_IsTmpObj(res3)) { resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_float((*arg3))); } else { int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_float, new_flags)); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_meansd__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:meansd",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "meansd" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "meansd" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "meansd" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "meansd" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "meansd" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "meansd" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); meansd(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_meansd(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_meansd__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_meansd__SWIG_1(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'meansd'.\n" " Possible C/C++ prototypes are:\n" " meansd(EST_Track &,float &,float &,int)\n" " meansd(EST_Track &,EST_FVector &,EST_FVector &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_normalise__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:normalise",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); normalise(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_normalise__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; float arg2 ; float arg3 ; int arg4 ; float arg5 ; float arg6 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; float val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; float val5 ; int ecode5 = 0 ; float val6 ; int ecode6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:normalise",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "normalise" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "normalise" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "normalise" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_float(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "normalise" "', argument " "5"" of type '" "float""'"); } arg5 = static_cast< float >(val5); ecode6 = SWIG_AsVal_float(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "normalise" "', argument " "6"" of type '" "float""'"); } arg6 = static_cast< float >(val6); normalise(*arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_normalise__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; float arg4 ; float arg5 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; float val4 ; int ecode4 = 0 ; float val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:normalise",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "normalise" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "normalise" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "normalise" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "normalise" "', argument " "3"" of type '" "EST_FVector &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "normalise" "', argument " "3"" of type '" "EST_FVector &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_float(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "normalise" "', argument " "4"" of type '" "float""'"); } arg4 = static_cast< float >(val4); ecode5 = SWIG_AsVal_float(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "normalise" "', argument " "5"" of type '" "float""'"); } arg5 = static_cast< float >(val5); normalise(*arg1,*arg2,*arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_normalise(PyObject *self, PyObject *args) { int argc; PyObject *argv[7]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 6); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_normalise__SWIG_0(self, args); } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_normalise__SWIG_2(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_float(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_normalise__SWIG_1(self, args); } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'normalise'.\n" " Possible C/C++ prototypes are:\n" " normalise(EST_Track &)\n" " normalise(EST_Track &,float,float,int,float,float)\n" " normalise(EST_Track &,EST_FVector &,EST_FVector &,float,float)\n"); return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"EST_Track_default_frame_shift_get", _wrap_EST_Track_default_frame_shift_get, METH_VARARGS, NULL}, { (char *)"EST_Track_default_sample_rate_get", _wrap_EST_Track_default_sample_rate_get, METH_VARARGS, NULL}, { (char *)"new_EST_Track", _wrap_new_EST_Track, METH_VARARGS, NULL}, { (char *)"delete_EST_Track", _wrap_delete_EST_Track, METH_VARARGS, NULL}, { (char *)"EST_Track_resize", _wrap_EST_Track_resize, METH_VARARGS, NULL}, { (char *)"EST_Track_set_num_channels", _wrap_EST_Track_set_num_channels, METH_VARARGS, NULL}, { (char *)"EST_Track_set_num_frames", _wrap_EST_Track_set_num_frames, METH_VARARGS, NULL}, { (char *)"EST_Track_set_channel_name", _wrap_EST_Track_set_channel_name, METH_VARARGS, NULL}, { (char *)"EST_Track_set_aux_channel_name", _wrap_EST_Track_set_aux_channel_name, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_setup", _wrap_EST_Track_copy_setup, METH_VARARGS, NULL}, { (char *)"EST_Track_name", _wrap_EST_Track_name, METH_VARARGS, NULL}, { (char *)"EST_Track_set_name", _wrap_EST_Track_set_name, METH_VARARGS, NULL}, { (char *)"EST_Track_frame", _wrap_EST_Track_frame, METH_VARARGS, NULL}, { (char *)"EST_Track_channel", _wrap_EST_Track_channel, METH_VARARGS, NULL}, { (char *)"EST_Track_sub_track", _wrap_EST_Track_sub_track, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_sub_track", _wrap_EST_Track_copy_sub_track, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_sub_track_out", _wrap_EST_Track_copy_sub_track_out, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_channel_out", _wrap_EST_Track_copy_channel_out, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_frame_out", _wrap_EST_Track_copy_frame_out, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_channel_in", _wrap_EST_Track_copy_channel_in, METH_VARARGS, NULL}, { (char *)"EST_Track_copy_frame_in", _wrap_EST_Track_copy_frame_in, METH_VARARGS, NULL}, { (char *)"EST_Track_channel_position", _wrap_EST_Track_channel_position, METH_VARARGS, NULL}, { (char *)"EST_Track_has_channel", _wrap_EST_Track_has_channel, METH_VARARGS, NULL}, { (char *)"EST_Track_a", _wrap_EST_Track_a, METH_VARARGS, NULL}, { (char *)"EST_Track_t", _wrap_EST_Track_t, METH_VARARGS, NULL}, { (char *)"EST_Track_ms_t", _wrap_EST_Track_ms_t, METH_VARARGS, NULL}, { (char *)"EST_Track_fill_time", _wrap_EST_Track_fill_time, METH_VARARGS, NULL}, { (char *)"EST_Track_fill", _wrap_EST_Track_fill, METH_VARARGS, NULL}, { (char *)"EST_Track_sample", _wrap_EST_Track_sample, METH_VARARGS, NULL}, { (char *)"EST_Track_shift", _wrap_EST_Track_shift, METH_VARARGS, NULL}, { (char *)"EST_Track_start", _wrap_EST_Track_start, METH_VARARGS, NULL}, { (char *)"EST_Track_end", _wrap_EST_Track_end, METH_VARARGS, NULL}, { (char *)"EST_Track_load", _wrap_EST_Track_load, METH_VARARGS, NULL}, { (char *)"EST_Track_save", _wrap_EST_Track_save, METH_VARARGS, NULL}, { (char *)"EST_Track_set_break", _wrap_EST_Track_set_break, METH_VARARGS, NULL}, { (char *)"EST_Track_set_value", _wrap_EST_Track_set_value, METH_VARARGS, NULL}, { (char *)"EST_Track_val", _wrap_EST_Track_val, METH_VARARGS, NULL}, { (char *)"EST_Track_track_break", _wrap_EST_Track_track_break, METH_VARARGS, NULL}, { (char *)"EST_Track_prev_non_break", _wrap_EST_Track_prev_non_break, METH_VARARGS, NULL}, { (char *)"EST_Track_next_non_break", _wrap_EST_Track_next_non_break, METH_VARARGS, NULL}, { (char *)"EST_Track_empty", _wrap_EST_Track_empty, METH_VARARGS, NULL}, { (char *)"EST_Track_index", _wrap_EST_Track_index, METH_VARARGS, NULL}, { (char *)"EST_Track_index_below", _wrap_EST_Track_index_below, METH_VARARGS, NULL}, { (char *)"EST_Track_num_frames", _wrap_EST_Track_num_frames, METH_VARARGS, NULL}, { (char *)"EST_Track_length", _wrap_EST_Track_length, METH_VARARGS, NULL}, { (char *)"EST_Track_num_channels", _wrap_EST_Track_num_channels, METH_VARARGS, NULL}, { (char *)"EST_Track_num_aux_channels", _wrap_EST_Track_num_aux_channels, METH_VARARGS, NULL}, { (char *)"EST_Track_equal_space", _wrap_EST_Track_equal_space, METH_VARARGS, NULL}, { (char *)"EST_Track_single_break", _wrap_EST_Track_single_break, METH_VARARGS, NULL}, { (char *)"EST_Track_set_equal_space", _wrap_EST_Track_set_equal_space, METH_VARARGS, NULL}, { (char *)"EST_Track_set_single_break", _wrap_EST_Track_set_single_break, METH_VARARGS, NULL}, { (char *)"EST_Track___iadd__", _wrap_EST_Track___iadd__, METH_VARARGS, NULL}, { (char *)"EST_Track___ior__", _wrap_EST_Track___ior__, METH_VARARGS, NULL}, { (char *)"EST_Track_load_channel_names", _wrap_EST_Track_load_channel_names, METH_VARARGS, NULL}, { (char *)"EST_Track_save_channel_names", _wrap_EST_Track_save_channel_names, METH_VARARGS, NULL}, { (char *)"EST_Track_channel_name", _wrap_EST_Track_channel_name, METH_VARARGS, NULL}, { (char *)"EST_Track_aux_channel_name", _wrap_EST_Track_aux_channel_name, METH_VARARGS, NULL}, { (char *)"EST_Track_swigregister", EST_Track_swigregister, METH_VARARGS, NULL}, { (char *)"mean", _wrap_mean, METH_VARARGS, NULL}, { (char *)"meansd", _wrap_meansd, METH_VARARGS, NULL}, { (char *)"normalise", _wrap_normalise, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_FVector = {"_p_EST_FVector", "EST_FVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_IVector = {"_p_EST_IVector", "EST_IVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Track = {"_p_EST_Track", "EST_Track *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_IVector, &_swigt__p_EST_Item, &_swigt__p_EST_Track, &_swigt__p_char, &_swigt__p_float, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_IVector[] = { {&_swigt__p_EST_IVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_IVector, _swigc__p_EST_Item, _swigc__p_EST_Track, _swigc__p_char, _swigc__p_float, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "read_ok",SWIG_From_int(static_cast< int >(read_ok))); SWIG_Python_SetConstant(d, "read_format_error",SWIG_From_int(static_cast< int >(read_format_error))); SWIG_Python_SetConstant(d, "read_not_found_error",SWIG_From_int(static_cast< int >(read_not_found_error))); SWIG_Python_SetConstant(d, "read_error",SWIG_From_int(static_cast< int >(read_error))); SWIG_Python_SetConstant(d, "write_ok",SWIG_From_int(static_cast< int >(write_ok))); SWIG_Python_SetConstant(d, "write_fail",SWIG_From_int(static_cast< int >(write_fail))); SWIG_Python_SetConstant(d, "write_error",SWIG_From_int(static_cast< int >(write_error))); SWIG_Python_SetConstant(d, "write_partial",SWIG_From_int(static_cast< int >(write_partial))); SWIG_Python_SetConstant(d, "connect_ok",SWIG_From_int(static_cast< int >(connect_ok))); SWIG_Python_SetConstant(d, "connect_not_found_error",SWIG_From_int(static_cast< int >(connect_not_found_error))); SWIG_Python_SetConstant(d, "connect_not_allowed_error",SWIG_From_int(static_cast< int >(connect_not_allowed_error))); SWIG_Python_SetConstant(d, "connect_system_error",SWIG_From_int(static_cast< int >(connect_system_error))); SWIG_Python_SetConstant(d, "connect_error",SWIG_From_int(static_cast< int >(connect_error))); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_SignalProc_wrap.cc0000644000076400007640000054136511352212620021171 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_Track swig_types[2] #define SWIGTYPE_p_EST_Wave swig_types[3] #define SWIGTYPE_p_char swig_types[4] static swig_type_info *swig_types[6]; static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_SignalProc.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_SignalProc #else # define SWIG_init init_EST_SignalProc #endif #define SWIG_name "_EST_SignalProc" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "sigpr/EST_filter.h" #include "sigpr/EST_filter_design.h" #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_FIRfilter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_FVector *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRfilter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRfilter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRfilter(*arg1,(EST_FVector const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRfilter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_FVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:FIRfilter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_FVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_FVector const &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); FIRfilter(*arg1,(EST_FVector const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRfilter__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector *arg3 = 0 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:FIRfilter",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FIRfilter" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FIRfilter" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); FIRfilter((EST_Wave const &)*arg1,*arg2,(EST_FVector const &)*arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRfilter__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRfilter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FIRfilter" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRfilter" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); FIRfilter((EST_Wave const &)*arg1,*arg2,(EST_FVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRfilter(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_FIRfilter__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRfilter__SWIG_0(self, args); } } } } if (argc == 3) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_FIRfilter__SWIG_3(self, args); } } } } if (argc == 4) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_FVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRfilter__SWIG_2(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'FIRfilter'.\n" " Possible C/C++ prototypes are:\n" " FIRfilter(EST_Wave &,EST_FVector const &,int)\n" " FIRfilter(EST_Wave &,EST_FVector const &)\n" " FIRfilter(EST_Wave const &,EST_Wave &,EST_FVector const &,int)\n" " FIRfilter(EST_Wave const &,EST_Wave &,EST_FVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_FIR_double_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIR_double_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIR_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIR_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIR_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIR_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FIR_double_filter" "', argument " "3"" of type '" "EST_FVector const &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIR_double_filter" "', argument " "3"" of type '" "EST_FVector const &""'"); } arg3 = reinterpret_cast< EST_FVector * >(argp3); FIR_double_filter(*arg1,*arg2,(EST_FVector const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_filter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRlowpass_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRlowpass_filter(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_filter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:FIRlowpass_filter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); FIRlowpass_filter(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_filter__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:FIRlowpass_filter",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FIRlowpass_filter" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); FIRlowpass_filter((EST_Wave const &)*arg1,*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_filter__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRlowpass_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRlowpass_filter((EST_Wave const &)*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_filter(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_filter__SWIG_1(self, args); } } } if (argc == 3) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_filter__SWIG_3(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_filter__SWIG_0(self, args); } } } } if (argc == 4) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_filter__SWIG_2(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'FIRlowpass_filter'.\n" " Possible C/C++ prototypes are:\n" " FIRlowpass_filter(EST_Wave &,int,int)\n" " FIRlowpass_filter(EST_Wave &,int)\n" " FIRlowpass_filter(EST_Wave const &,EST_Wave &,int,int)\n" " FIRlowpass_filter(EST_Wave const &,EST_Wave &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_filter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRhighpass_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRhighpass_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRhighpass_filter(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_filter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:FIRhighpass_filter",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRhighpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FIRhighpass_filter" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); FIRhighpass_filter((EST_Wave const &)*arg1,*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_filter__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRhighpass_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRhighpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRhighpass_filter((EST_Wave const &)*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_filter(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_filter__SWIG_2(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_filter__SWIG_0(self, args); } } } } if (argc == 4) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_filter__SWIG_1(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'FIRhighpass_filter'.\n" " Possible C/C++ prototypes are:\n" " FIRhighpass_filter(EST_Wave &,int,int)\n" " FIRhighpass_filter(EST_Wave const &,EST_Wave &,int,int)\n" " FIRhighpass_filter(EST_Wave const &,EST_Wave &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_double_filter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRhighpass_double_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRhighpass_double_filter(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_double_filter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:FIRhighpass_double_filter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); FIRhighpass_double_filter(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_double_filter__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:FIRhighpass_double_filter",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FIRhighpass_double_filter" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); FIRhighpass_double_filter((EST_Wave const &)*arg1,*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_double_filter__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRhighpass_double_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRhighpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRhighpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRhighpass_double_filter((EST_Wave const &)*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRhighpass_double_filter(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_double_filter__SWIG_1(self, args); } } } if (argc == 3) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_double_filter__SWIG_3(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_double_filter__SWIG_0(self, args); } } } } if (argc == 4) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRhighpass_double_filter__SWIG_2(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'FIRhighpass_double_filter'.\n" " Possible C/C++ prototypes are:\n" " FIRhighpass_double_filter(EST_Wave &,int,int)\n" " FIRhighpass_double_filter(EST_Wave &,int)\n" " FIRhighpass_double_filter(EST_Wave const &,EST_Wave &,int,int)\n" " FIRhighpass_double_filter(EST_Wave const &,EST_Wave &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_double_filter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRlowpass_double_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRlowpass_double_filter(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_double_filter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:FIRlowpass_double_filter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); FIRlowpass_double_filter(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_double_filter__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:FIRlowpass_double_filter",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FIRlowpass_double_filter" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); FIRlowpass_double_filter((EST_Wave const &)*arg1,*arg2,arg3,arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_double_filter__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:FIRlowpass_double_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "1"" of type '" "EST_Wave const &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FIRlowpass_double_filter" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FIRlowpass_double_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); FIRlowpass_double_filter((EST_Wave const &)*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_FIRlowpass_double_filter(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_double_filter__SWIG_1(self, args); } } } if (argc == 3) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_double_filter__SWIG_3(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_double_filter__SWIG_0(self, args); } } } } if (argc == 4) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_FIRlowpass_double_filter__SWIG_2(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'FIRlowpass_double_filter'.\n" " Possible C/C++ prototypes are:\n" " FIRlowpass_double_filter(EST_Wave &,int,int)\n" " FIRlowpass_double_filter(EST_Wave &,int)\n" " FIRlowpass_double_filter(EST_Wave const &,EST_Wave &,int,int)\n" " FIRlowpass_double_filter(EST_Wave const &,EST_Wave &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_lpc_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_Wave *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:lpc_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lpc_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lpc_filter" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "lpc_filter" "', argument " "3"" of type '" "EST_Wave &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter" "', argument " "3"" of type '" "EST_Wave &""'"); } arg3 = reinterpret_cast< EST_Wave * >(argp3); lpc_filter(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_inv_lpc_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_Wave *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:inv_lpc_filter",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "inv_lpc_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_FVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "inv_lpc_filter" "', argument " "2"" of type '" "EST_FVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter" "', argument " "2"" of type '" "EST_FVector &""'"); } arg2 = reinterpret_cast< EST_FVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "inv_lpc_filter" "', argument " "3"" of type '" "EST_Wave &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter" "', argument " "3"" of type '" "EST_Wave &""'"); } arg3 = reinterpret_cast< EST_Wave * >(argp3); inv_lpc_filter(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_lpc_filter_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Wave *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:lpc_filter_1",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lpc_filter_1" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_1" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lpc_filter_1" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_1" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "lpc_filter_1" "', argument " "3"" of type '" "EST_Wave &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_1" "', argument " "3"" of type '" "EST_Wave &""'"); } arg3 = reinterpret_cast< EST_Wave * >(argp3); lpc_filter_1(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_lpc_filter_fast(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Wave *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:lpc_filter_fast",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lpc_filter_fast" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_fast" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lpc_filter_fast" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_fast" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "lpc_filter_fast" "', argument " "3"" of type '" "EST_Wave &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "lpc_filter_fast" "', argument " "3"" of type '" "EST_Wave &""'"); } arg3 = reinterpret_cast< EST_Wave * >(argp3); lpc_filter_fast(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_inv_lpc_filter_ola(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Track *arg2 = 0 ; EST_Wave *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:inv_lpc_filter_ola",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "inv_lpc_filter_ola" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter_ola" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "inv_lpc_filter_ola" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter_ola" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "inv_lpc_filter_ola" "', argument " "3"" of type '" "EST_Wave &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "inv_lpc_filter_ola" "', argument " "3"" of type '" "EST_Wave &""'"); } arg3 = reinterpret_cast< EST_Wave * >(argp3); inv_lpc_filter_ola(*arg1,*arg2,*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pre_emphasis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:pre_emphasis",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pre_emphasis" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); pre_emphasis(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pre_emphasis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:pre_emphasis",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); pre_emphasis(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pre_emphasis__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:pre_emphasis",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pre_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pre_emphasis" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); pre_emphasis(*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pre_emphasis__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:pre_emphasis",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pre_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pre_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); pre_emphasis(*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pre_emphasis(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_pre_emphasis__SWIG_1(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_pre_emphasis__SWIG_3(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_pre_emphasis__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_pre_emphasis__SWIG_2(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'pre_emphasis'.\n" " Possible C/C++ prototypes are:\n" " pre_emphasis(EST_Wave &,float)\n" " pre_emphasis(EST_Wave &)\n" " pre_emphasis(EST_Wave &,EST_Wave &,float)\n" " pre_emphasis(EST_Wave &,EST_Wave &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_post_emphasis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:post_emphasis",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "post_emphasis" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); post_emphasis(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_post_emphasis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:post_emphasis",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); post_emphasis(*arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_post_emphasis__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:post_emphasis",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "post_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "post_emphasis" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); post_emphasis(*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_post_emphasis__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:post_emphasis",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "post_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "post_emphasis" "', argument " "2"" of type '" "EST_Wave &""'"); } arg2 = reinterpret_cast< EST_Wave * >(argp2); post_emphasis(*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_post_emphasis(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_post_emphasis__SWIG_1(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_post_emphasis__SWIG_3(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_post_emphasis__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_post_emphasis__SWIG_2(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'post_emphasis'.\n" " Possible C/C++ prototypes are:\n" " post_emphasis(EST_Wave &,float)\n" " post_emphasis(EST_Wave &)\n" " post_emphasis(EST_Wave &,EST_Wave &,float)\n" " post_emphasis(EST_Wave &,EST_Wave &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_simple_mean_smooth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:simple_mean_smooth",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "simple_mean_smooth" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "simple_mean_smooth" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "simple_mean_smooth" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); simple_mean_smooth(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_design_FIR_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_FVector *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OO:design_FIR_filter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_FVector, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "design_FIR_filter" "', argument " "1"" of type '" "EST_FVector const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "design_FIR_filter" "', argument " "1"" of type '" "EST_FVector const &""'"); } arg1 = reinterpret_cast< EST_FVector * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "design_FIR_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = design_FIR_filter((EST_FVector const &)*arg1,arg2); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_design_lowpass_FIR_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; int arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OOO:design_lowpass_FIR_filter",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "design_lowpass_FIR_filter" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "design_lowpass_FIR_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "design_lowpass_FIR_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = design_lowpass_FIR_filter(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_design_highpass_FIR_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; int arg3 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_FVector result; if (!PyArg_ParseTuple(args,(char *)"OOO:design_highpass_FIR_filter",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "design_highpass_FIR_filter" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "design_highpass_FIR_filter" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "design_highpass_FIR_filter" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = design_highpass_FIR_filter(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj((new EST_FVector(static_cast< const EST_FVector& >(result))), SWIGTYPE_p_EST_FVector, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"FIRfilter", _wrap_FIRfilter, METH_VARARGS, NULL}, { (char *)"FIR_double_filter", _wrap_FIR_double_filter, METH_VARARGS, NULL}, { (char *)"FIRlowpass_filter", _wrap_FIRlowpass_filter, METH_VARARGS, NULL}, { (char *)"FIRhighpass_filter", _wrap_FIRhighpass_filter, METH_VARARGS, NULL}, { (char *)"FIRhighpass_double_filter", _wrap_FIRhighpass_double_filter, METH_VARARGS, NULL}, { (char *)"FIRlowpass_double_filter", _wrap_FIRlowpass_double_filter, METH_VARARGS, NULL}, { (char *)"lpc_filter", _wrap_lpc_filter, METH_VARARGS, NULL}, { (char *)"inv_lpc_filter", _wrap_inv_lpc_filter, METH_VARARGS, NULL}, { (char *)"lpc_filter_1", _wrap_lpc_filter_1, METH_VARARGS, NULL}, { (char *)"lpc_filter_fast", _wrap_lpc_filter_fast, METH_VARARGS, NULL}, { (char *)"inv_lpc_filter_ola", _wrap_inv_lpc_filter_ola, METH_VARARGS, NULL}, { (char *)"pre_emphasis", _wrap_pre_emphasis, METH_VARARGS, NULL}, { (char *)"post_emphasis", _wrap_post_emphasis, METH_VARARGS, NULL}, { (char *)"simple_mean_smooth", _wrap_simple_mean_smooth, METH_VARARGS, NULL}, { (char *)"design_FIR_filter", _wrap_design_FIR_filter, METH_VARARGS, NULL}, { (char *)"design_lowpass_FIR_filter", _wrap_design_lowpass_FIR_filter, METH_VARARGS, NULL}, { (char *)"design_highpass_FIR_filter", _wrap_design_highpass_FIR_filter, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_FVector = {"_p_EST_FVector", "EST_FVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Track = {"_p_EST_Track", "EST_Track *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Wave = {"_p_EST_Wave", "EST_Wave *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_Item, &_swigt__p_EST_Track, &_swigt__p_EST_Wave, &_swigt__p_char, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Wave[] = { {&_swigt__p_EST_Wave, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_Item, _swigc__p_EST_Track, _swigc__p_EST_Wave, _swigc__p_char, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_pitchmark_wrap.cc0000644000076400007640000036254211352212620021110 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Features swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_Track swig_types[2] #define SWIGTYPE_p_EST_Wave swig_types[3] #define SWIGTYPE_p_char swig_types[4] static swig_type_info *swig_types[6]; static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_pitchmark.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_pitchmark #else # define SWIG_init init_EST_pitchmark #endif #define SWIG_name "_EST_pitchmark" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "sigpr/EST_pitchmark.h" #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_pitchmark__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Features *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Track result; if (!PyArg_ParseTuple(args,(char *)"OO:pitchmark",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Features, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pitchmark" "', argument " "2"" of type '" "EST_Features &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pitchmark" "', argument " "2"" of type '" "EST_Features &""'"); } arg2 = reinterpret_cast< EST_Features * >(argp2); result = pitchmark(*arg1,*arg2); resultobj = SWIG_NewPointerObj((new EST_Track(static_cast< const EST_Track& >(result))), SWIGTYPE_p_EST_Track, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pitchmark__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; int arg8 ; int arg9 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; int val8 ; int ecode8 = 0 ; int val9 ; int ecode9 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; EST_Track result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:pitchmark",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pitchmark" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pitchmark" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pitchmark" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pitchmark" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "pitchmark" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "pitchmark" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); ecode8 = SWIG_AsVal_int(obj7, &val8); if (!SWIG_IsOK(ecode8)) { SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "pitchmark" "', argument " "8"" of type '" "int""'"); } arg8 = static_cast< int >(val8); ecode9 = SWIG_AsVal_int(obj8, &val9); if (!SWIG_IsOK(ecode9)) { SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "pitchmark" "', argument " "9"" of type '" "int""'"); } arg9 = static_cast< int >(val9); result = pitchmark(*arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); resultobj = SWIG_NewPointerObj((new EST_Track(static_cast< const EST_Track& >(result))), SWIGTYPE_p_EST_Track, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pitchmark__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; int arg2 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; int arg8 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; int val4 ; int ecode4 = 0 ; int val5 ; int ecode5 = 0 ; int val6 ; int ecode6 = 0 ; int val7 ; int ecode7 = 0 ; int val8 ; int ecode8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; EST_Track result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:pitchmark",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pitchmark" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pitchmark" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pitchmark" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pitchmark" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); ecode5 = SWIG_AsVal_int(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pitchmark" "', argument " "5"" of type '" "int""'"); } arg5 = static_cast< int >(val5); ecode6 = SWIG_AsVal_int(obj5, &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "pitchmark" "', argument " "6"" of type '" "int""'"); } arg6 = static_cast< int >(val6); ecode7 = SWIG_AsVal_int(obj6, &val7); if (!SWIG_IsOK(ecode7)) { SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "pitchmark" "', argument " "7"" of type '" "int""'"); } arg7 = static_cast< int >(val7); ecode8 = SWIG_AsVal_int(obj7, &val8); if (!SWIG_IsOK(ecode8)) { SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "pitchmark" "', argument " "8"" of type '" "int""'"); } arg8 = static_cast< int >(val8); result = pitchmark(*arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); resultobj = SWIG_NewPointerObj((new EST_Track(static_cast< const EST_Track& >(result))), SWIGTYPE_p_EST_Track, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pitchmark(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 9); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Features, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_pitchmark__SWIG_0(self, args); } } } if (argc == 8) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_pitchmark__SWIG_2(self, args); } } } } } } } } } if (argc == 9) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Wave, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[5], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[6], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[8], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_pitchmark__SWIG_1(self, args); } } } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'pitchmark'.\n" " Possible C/C++ prototypes are:\n" " pitchmark(EST_Wave &,EST_Features &)\n" " pitchmark(EST_Wave &,int,int,int,int,int,int,int,int)\n" " pitchmark(EST_Wave &,int,int,int,int,int,int,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_neg_zero_cross_pick(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Wave *arg1 = 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:neg_zero_cross_pick",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Wave, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "neg_zero_cross_pick" "', argument " "1"" of type '" "EST_Wave &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "neg_zero_cross_pick" "', argument " "1"" of type '" "EST_Wave &""'"); } arg1 = reinterpret_cast< EST_Wave * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "neg_zero_cross_pick" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "neg_zero_cross_pick" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); neg_zero_cross_pick(*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pm_fill(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; float arg2 ; float arg3 ; float arg4 ; float arg5 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; float val3 ; int ecode3 = 0 ; float val4 ; int ecode4 = 0 ; float val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOOO:pm_fill",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm_fill" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_fill" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pm_fill" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pm_fill" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); ecode4 = SWIG_AsVal_float(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pm_fill" "', argument " "4"" of type '" "float""'"); } arg4 = static_cast< float >(val4); ecode5 = SWIG_AsVal_float(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pm_fill" "', argument " "5"" of type '" "float""'"); } arg5 = static_cast< float >(val5); pm_fill(*arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pm_min_check(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:pm_min_check",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm_min_check" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_min_check" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); ecode2 = SWIG_AsVal_float(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pm_min_check" "', argument " "2"" of type '" "float""'"); } arg2 = static_cast< float >(val2); pm_min_check(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pm_to_f0__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_Track *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:pm_to_f0",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm_to_f0" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_to_f0" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pm_to_f0" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_to_f0" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); pm_to_f0(*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pm_to_f0__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Track *arg1 = 0 ; EST_Track *arg2 = 0 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:pm_to_f0",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm_to_f0" "', argument " "1"" of type '" "EST_Track &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_to_f0" "', argument " "1"" of type '" "EST_Track &""'"); } arg1 = reinterpret_cast< EST_Track * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Track, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pm_to_f0" "', argument " "2"" of type '" "EST_Track &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pm_to_f0" "', argument " "2"" of type '" "EST_Track &""'"); } arg2 = reinterpret_cast< EST_Track * >(argp2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pm_to_f0" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); pm_to_f0(*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_pm_to_f0(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_pm_to_f0__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Track, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_float(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_pm_to_f0__SWIG_1(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'pm_to_f0'.\n" " Possible C/C++ prototypes are:\n" " pm_to_f0(EST_Track &,EST_Track &)\n" " pm_to_f0(EST_Track &,EST_Track &,float)\n"); return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"pitchmark", _wrap_pitchmark, METH_VARARGS, NULL}, { (char *)"neg_zero_cross_pick", _wrap_neg_zero_cross_pick, METH_VARARGS, NULL}, { (char *)"pm_fill", _wrap_pm_fill, METH_VARARGS, NULL}, { (char *)"pm_min_check", _wrap_pm_min_check, METH_VARARGS, NULL}, { (char *)"pm_to_f0", _wrap_pm_to_f0, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Features = {"_p_EST_Features", "EST_Features *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Track = {"_p_EST_Track", "EST_Track *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Wave = {"_p_EST_Wave", "EST_Wave *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Features, &_swigt__p_EST_Item, &_swigt__p_EST_Track, &_swigt__p_EST_Wave, &_swigt__p_char, }; static swig_cast_info _swigc__p_EST_Features[] = { {&_swigt__p_EST_Features, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Wave[] = { {&_swigt__p_EST_Wave, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Features, _swigc__p_EST_Item, _swigc__p_EST_Track, _swigc__p_EST_Wave, _swigc__p_char, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Utterance_wrap.cc0000644000076400007640000041724411352212620021060 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Item swig_types[0] #define SWIGTYPE_p_EST_Relation swig_types[1] #define SWIGTYPE_p_EST_Utterance swig_types[2] #define SWIGTYPE_p_char swig_types[3] static swig_type_info *swig_types[5]; static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Utterance.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Utterance #else # define SWIG_init init_EST_Utterance #endif #define SWIG_name "_EST_Utterance" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "ling_class/EST_Utterance.h" #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include "EST_error.h" #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERNINLINE PyObject* SWIG_From_bool (bool value) { return PyBool_FromLong(value ? 1 : 0); } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_EST_Utterance__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Utterance")) SWIG_fail; result = (EST_Utterance *)new EST_Utterance(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Utterance__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Utterance *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Utterance",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Utterance, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance const &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (EST_Utterance *)new EST_Utterance((EST_Utterance const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Utterance(PyObject *self, PyObject *args) { int argc; PyObject *argv[2]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 1); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_Utterance__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Utterance__SWIG_1(self, args); } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_Utterance'.\n" " Possible C/C++ prototypes are:\n" " EST_Utterance()\n" " EST_Utterance(EST_Utterance const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_Utterance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_Utterance",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_init(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_init",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_init" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->init(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_clear",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_clear" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->clear(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_clear_relations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_clear_relations",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_clear_relations" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->clear_relations(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_set_highest_id(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_set_highest_id",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_set_highest_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Utterance_set_highest_id" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_highest_id(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_next_id(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_next_id",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_next_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (int)(arg1)->next_id(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_load" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->load((EST_String const &)*arg2); END_CATCH_ERRORS(); } resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Utterance_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_save" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } ((EST_Utterance const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_save",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_save" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } ((EST_Utterance const *)arg1)->save((EST_String const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_save(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Utterance_save__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Utterance_save__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Utterance_save'.\n" " Possible C/C++ prototypes are:\n" " save(EST_Utterance const *,EST_String const &,EST_String const &)\n" " save(EST_Utterance const *,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_evaluate_all_features(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_evaluate_all_features",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_evaluate_all_features" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->evaluate_all_features(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_num_relations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Utterance_num_relations",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_num_relations" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (int)((EST_Utterance const *)arg1)->num_relations(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_relation_present(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_relation_present",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation_present" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); arg2 = EST_String( str, len, 0, len ); } result = (bool)((EST_Utterance const *)arg1)->relation_present(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_relation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Utterance_relation",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_relation" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Utterance_relation" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Relation *)(arg1)->relation((char const *)arg2,arg3); END_CATCH_ERRORS(); } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_relation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_relation" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Relation *)(arg1)->relation((char const *)arg2); END_CATCH_ERRORS(); } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_relation(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Utterance_relation__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Utterance_relation__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Utterance_relation'.\n" " Possible C/C++ prototypes are:\n" " relation(EST_Utterance *,char const *,int)\n" " relation(EST_Utterance *,char const *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_id(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_id",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Item *)(arg1)->id((EST_String const &)*arg2); END_CATCH_ERRORS(); } resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_create_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_create_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_create_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_Relation *)(arg1)->create_relation((EST_String const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_remove_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_remove_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_remove_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->remove_relation((EST_String const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Utterance_sub_utterance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Utterance_sub_utterance",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_sub_utterance" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_sub_utterance" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); (arg1)->sub_utterance(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_Utterance_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_Utterance, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_utterance_merge__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = 0 ; EST_Utterance *arg2 = 0 ; EST_Item *arg3 = (EST_Item *) 0 ; EST_Item *arg4 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOOO:utterance_merge",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } arg2 = reinterpret_cast< EST_Utterance * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "utterance_merge" "', argument " "3"" of type '" "EST_Item *""'"); } arg3 = reinterpret_cast< EST_Item * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "utterance_merge" "', argument " "4"" of type '" "EST_Item *""'"); } arg4 = reinterpret_cast< EST_Item * >(argp4); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)utterance_merge(*arg1,*arg2,arg3,arg4); END_CATCH_ERRORS(); } resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_utterance_merge__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = 0 ; EST_Utterance *arg2 = 0 ; EST_String arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:utterance_merge",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } arg2 = reinterpret_cast< EST_Utterance * >(argp2); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)utterance_merge(*arg1,*arg2,arg3); END_CATCH_ERRORS(); } resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_utterance_merge(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_utterance_merge__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_utterance_merge__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'utterance_merge'.\n" " Possible C/C++ prototypes are:\n" " utterance_merge(EST_Utterance &,EST_Utterance &,EST_Item *,EST_Item *)\n" " utterance_merge(EST_Utterance &,EST_Utterance &,EST_String)\n"); return NULL; } SWIGINTERN PyObject *_wrap_sub_utterance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Utterance *arg1 = 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:sub_utterance",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sub_utterance" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sub_utterance" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sub_utterance" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); sub_utterance(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_get_utt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Utterance *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:get_utt",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_utt" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Utterance *)get_utt(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, 0 | 0 ); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_EST_Utterance", _wrap_new_EST_Utterance, METH_VARARGS, NULL}, { (char *)"delete_EST_Utterance", _wrap_delete_EST_Utterance, METH_VARARGS, NULL}, { (char *)"EST_Utterance_init", _wrap_EST_Utterance_init, METH_VARARGS, NULL}, { (char *)"EST_Utterance_clear", _wrap_EST_Utterance_clear, METH_VARARGS, NULL}, { (char *)"EST_Utterance_clear_relations", _wrap_EST_Utterance_clear_relations, METH_VARARGS, NULL}, { (char *)"EST_Utterance_set_highest_id", _wrap_EST_Utterance_set_highest_id, METH_VARARGS, NULL}, { (char *)"EST_Utterance_next_id", _wrap_EST_Utterance_next_id, METH_VARARGS, NULL}, { (char *)"EST_Utterance_load", _wrap_EST_Utterance_load, METH_VARARGS, NULL}, { (char *)"EST_Utterance_save", _wrap_EST_Utterance_save, METH_VARARGS, NULL}, { (char *)"EST_Utterance_evaluate_all_features", _wrap_EST_Utterance_evaluate_all_features, METH_VARARGS, NULL}, { (char *)"EST_Utterance_num_relations", _wrap_EST_Utterance_num_relations, METH_VARARGS, NULL}, { (char *)"EST_Utterance_relation_present", _wrap_EST_Utterance_relation_present, METH_VARARGS, NULL}, { (char *)"EST_Utterance_relation", _wrap_EST_Utterance_relation, METH_VARARGS, NULL}, { (char *)"EST_Utterance_id", _wrap_EST_Utterance_id, METH_VARARGS, NULL}, { (char *)"EST_Utterance_create_relation", _wrap_EST_Utterance_create_relation, METH_VARARGS, NULL}, { (char *)"EST_Utterance_remove_relation", _wrap_EST_Utterance_remove_relation, METH_VARARGS, NULL}, { (char *)"EST_Utterance_sub_utterance", _wrap_EST_Utterance_sub_utterance, METH_VARARGS, NULL}, { (char *)"EST_Utterance_swigregister", EST_Utterance_swigregister, METH_VARARGS, NULL}, { (char *)"utterance_merge", _wrap_utterance_merge, METH_VARARGS, NULL}, { (char *)"sub_utterance", _wrap_sub_utterance, METH_VARARGS, NULL}, { (char *)"get_utt", _wrap_get_utt, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Utterance = {"_p_EST_Utterance", "EST_Utterance *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_EST_Utterance, &_swigt__p_char, }; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Utterance[] = { {&_swigt__p_EST_Utterance, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_EST_Utterance, _swigc__p_char, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Relation_wrap.cc0000644000076400007640000042204211465017156020707 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Item swig_types[0] #define SWIGTYPE_p_EST_Relation swig_types[1] #define SWIGTYPE_p_EST_Utterance swig_types[2] #define SWIGTYPE_p_char swig_types[3] #define SWIGTYPE_p_p_EST_Item swig_types[4] static swig_type_info *swig_types[6]; static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Relation.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Relation #else # define SWIG_init init_EST_Relation #endif #define SWIG_name "_EST_Relation" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" #include "EST_rw_status.h" #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_bool (PyObject *obj, bool *val) { int r = PyObject_IsTrue(obj); if (r == -1) return SWIG_ERROR; if (val) *val = r ? true : false; return SWIG_OK; } SWIGINTERN void EST_Relation_items(EST_Relation *self,EST_Item **ITEMLISTOUT){ *ITEMLISTOUT = self->first(); } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_EST_Relation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Relation")) SWIG_fail; result = (EST_Relation *)new EST_Relation(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Relation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; PyObject * obj0 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Relation",&obj0)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Relation" "', argument " "1"" of type '" "char const *""'"); } arg1 = reinterpret_cast< char * >(buf1); result = (EST_Relation *)new EST_Relation((char const *)arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, SWIG_POINTER_NEW | 0 ); if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return resultobj; fail: if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Relation__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Relation",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Relation, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Relation" "', argument " "1"" of type '" "EST_Relation const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Relation" "', argument " "1"" of type '" "EST_Relation const &""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Relation *)new EST_Relation((EST_Relation const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Relation(PyObject *self, PyObject *args) { int argc; PyObject *argv[2]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 1); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_Relation__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Relation__SWIG_2(self, args); } } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Relation__SWIG_1(self, args); } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_Relation'.\n" " Possible C/C++ prototypes are:\n" " EST_Relation()\n" " EST_Relation(char const *)\n" " EST_Relation(EST_Relation const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_Relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_Relation",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Relation" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Relation_load",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_load" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = (EST_read_status)(arg1)->load((EST_String const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_load" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_read_status)(arg1)->load((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_load(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Relation_load__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Relation_load__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Relation_load'.\n" " Possible C/C++ prototypes are:\n" " load(EST_Relation *,EST_String const &,EST_String const &)\n" " load(EST_Relation *,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; bool arg4 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; bool val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Relation_save",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_save" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Relation_save" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); result = (EST_write_status)((EST_Relation const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3,arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Relation_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_save" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = (EST_write_status)((EST_Relation const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_save(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Relation_save__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Relation_save__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Relation_save'.\n" " Possible C/C++ prototypes are:\n" " save(EST_Relation const *,EST_String const &,EST_String const &,bool)\n" " save(EST_Relation const *,EST_String const &,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_evaluate_item_features(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_evaluate_item_features",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_evaluate_item_features" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); (arg1)->evaluate_item_features(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_clear",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_clear" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); (arg1)->clear(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_utt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Utterance *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_utt",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_utt" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Utterance *)(arg1)->utt(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_set_utt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Utterance *arg2 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_set_utt",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_set_utt" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Relation_set_utt" "', argument " "2"" of type '" "EST_Utterance *""'"); } arg2 = reinterpret_cast< EST_Utterance * >(argp2); (arg1)->set_utt(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_name",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_name" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_String *) &((EST_Relation const *)arg1)->name(); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_head(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_head",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_head" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->head(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_root(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_root",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_root" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->root(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_tail(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_tail",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_tail" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->tail(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_first(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_first",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_first" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->first(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_first_leaf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_first_leaf",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_first_leaf" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->first_leaf(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_last(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_last",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_last" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->last(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_last_leaf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_last_leaf",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_last_leaf" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)((EST_Relation const *)arg1)->last_leaf(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_append",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_append" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Relation_append" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (EST_Item *)(arg1)->append(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_prepend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_prepend",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_prepend" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Relation_prepend" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (EST_Item *)(arg1)->prepend(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_length" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (int)((EST_Relation const *)arg1)->length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_empty",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_empty" "', argument " "1"" of type '" "EST_Relation const *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (int)((EST_Relation const *)arg1)->empty(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_remove_item(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_remove_item",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_remove_item" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Relation_remove_item" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); (arg1)->remove_item(arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_remove_item_feature(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Relation_remove_item_feature",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_remove_item_feature" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->remove_item_feature((EST_String const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Relation_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item **arg2 = (EST_Item **) 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_Item *temp2 ; PyObject * obj0 = 0 ; arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:EST_Relation_items",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Relation_items" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); EST_Relation_items(arg1,arg2); resultobj = SWIG_Py_Void(); { PyObject *o1, *o2, *o3; o1 = PyList_New((*arg2)->length()); unsigned int i; EST_Item *it; for( it = (*arg2), i=0; it!=0; it=it->next(), ++i ) PyList_SetItem( o1, i, SWIG_NewPointerObj((void *) it, SWIGTYPE_p_EST_Item, 0) ); if ((!resultobj) || (resultobj == Py_None)) { resultobj = o1; } else { if (!PyTuple_Check(resultobj)) { o2 = resultobj; resultobj = PyTuple_New(1); PyTuple_SetItem(resultobj, 0, o2); } o3 = PyTuple_New(1); PyTuple_SetItem( o3, 0, o1 ); o2 = resultobj; resultobj = PySequence_Concat( o2, o3 ); Py_DECREF(o2); Py_DECREF(o3); } } return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_Relation_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_Relation, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_copy_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = 0 ; EST_Relation *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:copy_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Relation, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "copy_relation" "', argument " "1"" of type '" "EST_Relation const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "copy_relation" "', argument " "1"" of type '" "EST_Relation const &""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Relation, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "copy_relation" "', argument " "2"" of type '" "EST_Relation &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "copy_relation" "', argument " "2"" of type '" "EST_Relation &""'"); } arg2 = reinterpret_cast< EST_Relation * >(argp2); copy_relation((EST_Relation const &)*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_EST_Relation", _wrap_new_EST_Relation, METH_VARARGS, NULL}, { (char *)"delete_EST_Relation", _wrap_delete_EST_Relation, METH_VARARGS, NULL}, { (char *)"EST_Relation_load", _wrap_EST_Relation_load, METH_VARARGS, NULL}, { (char *)"EST_Relation_save", _wrap_EST_Relation_save, METH_VARARGS, NULL}, { (char *)"EST_Relation_evaluate_item_features", _wrap_EST_Relation_evaluate_item_features, METH_VARARGS, NULL}, { (char *)"EST_Relation_clear", _wrap_EST_Relation_clear, METH_VARARGS, NULL}, { (char *)"EST_Relation_utt", _wrap_EST_Relation_utt, METH_VARARGS, NULL}, { (char *)"EST_Relation_set_utt", _wrap_EST_Relation_set_utt, METH_VARARGS, NULL}, { (char *)"EST_Relation_name", _wrap_EST_Relation_name, METH_VARARGS, NULL}, { (char *)"EST_Relation_head", _wrap_EST_Relation_head, METH_VARARGS, NULL}, { (char *)"EST_Relation_root", _wrap_EST_Relation_root, METH_VARARGS, NULL}, { (char *)"EST_Relation_tail", _wrap_EST_Relation_tail, METH_VARARGS, NULL}, { (char *)"EST_Relation_first", _wrap_EST_Relation_first, METH_VARARGS, NULL}, { (char *)"EST_Relation_first_leaf", _wrap_EST_Relation_first_leaf, METH_VARARGS, NULL}, { (char *)"EST_Relation_last", _wrap_EST_Relation_last, METH_VARARGS, NULL}, { (char *)"EST_Relation_last_leaf", _wrap_EST_Relation_last_leaf, METH_VARARGS, NULL}, { (char *)"EST_Relation_append", _wrap_EST_Relation_append, METH_VARARGS, NULL}, { (char *)"EST_Relation_prepend", _wrap_EST_Relation_prepend, METH_VARARGS, NULL}, { (char *)"EST_Relation_length", _wrap_EST_Relation_length, METH_VARARGS, NULL}, { (char *)"EST_Relation_empty", _wrap_EST_Relation_empty, METH_VARARGS, NULL}, { (char *)"EST_Relation_remove_item", _wrap_EST_Relation_remove_item, METH_VARARGS, NULL}, { (char *)"EST_Relation_remove_item_feature", _wrap_EST_Relation_remove_item_feature, METH_VARARGS, NULL}, { (char *)"EST_Relation_items", _wrap_EST_Relation_items, METH_VARARGS, NULL}, { (char *)"EST_Relation_swigregister", EST_Relation_swigregister, METH_VARARGS, NULL}, { (char *)"copy_relation", _wrap_copy_relation, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Utterance = {"_p_EST_Utterance", "EST_Utterance *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_EST_Item = {"_p_p_EST_Item", "EST_Item **", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_EST_Utterance, &_swigt__p_char, &_swigt__p_p_EST_Item, }; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Utterance[] = { {&_swigt__p_EST_Utterance, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_EST_Item[] = { {&_swigt__p_p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_EST_Utterance, _swigc__p_char, _swigc__p_p_EST_Item, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "read_ok",SWIG_From_int(static_cast< int >(read_ok))); SWIG_Python_SetConstant(d, "read_format_error",SWIG_From_int(static_cast< int >(read_format_error))); SWIG_Python_SetConstant(d, "read_not_found_error",SWIG_From_int(static_cast< int >(read_not_found_error))); SWIG_Python_SetConstant(d, "read_error",SWIG_From_int(static_cast< int >(read_error))); SWIG_Python_SetConstant(d, "write_ok",SWIG_From_int(static_cast< int >(write_ok))); SWIG_Python_SetConstant(d, "write_fail",SWIG_From_int(static_cast< int >(write_fail))); SWIG_Python_SetConstant(d, "write_error",SWIG_From_int(static_cast< int >(write_error))); SWIG_Python_SetConstant(d, "write_partial",SWIG_From_int(static_cast< int >(write_partial))); SWIG_Python_SetConstant(d, "connect_ok",SWIG_From_int(static_cast< int >(connect_ok))); SWIG_Python_SetConstant(d, "connect_not_found_error",SWIG_From_int(static_cast< int >(connect_not_found_error))); SWIG_Python_SetConstant(d, "connect_not_allowed_error",SWIG_From_int(static_cast< int >(connect_not_allowed_error))); SWIG_Python_SetConstant(d, "connect_system_error",SWIG_From_int(static_cast< int >(connect_system_error))); SWIG_Python_SetConstant(d, "connect_error",SWIG_From_int(static_cast< int >(connect_error))); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Item_wrap.cc0000644000076400007640000047603711352212617020037 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Features swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_Relation swig_types[2] #define SWIGTYPE_p_char swig_types[3] #define SWIGTYPE_p_p_EST_Item swig_types[4] static swig_type_info *swig_types[6]; static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Item.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Item #else # define SWIG_init init_EST_Item #endif #define SWIG_name "_EST_Item" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "ling_class/EST_Item.h" #include "ling_class/EST_item_aux.h" static PyObject* features_to_PyDict( EST_Features *features ){ EST_Features::RwEntries p; PyObject *result = PyDict_New(); for( p.begin(*features); p != 0; ++p ){ const EST_Val &v = p->v; PyObject *py_val; if(v.type() == val_unset) py_val = Py_None; else if( v.type() == val_int ) py_val = PyInt_FromLong( v.Int() ); else if( v.type() == val_float ) py_val = PyFloat_FromDouble( v.Float() ); else if( v.type() == val_type_feats ) py_val = features_to_PyDict( feats(v) ); // else if( v.type() == val_type_featfunc ){ // if( evaluate_ff ){ // EST_Val tempval = ((featfunc)(*v))(##SHOULD BE AN ITEM##); // if( tempval.type() == val_int ) // py_val = PyInt_FromLong( tempval.Int() ); // else if( tempval.type() == val_float ) // py_val = PyFloat_FromDouble( tempval.Float() ); // else // py_val = PyString_FromString( tempval.string() ); // } // else // py_val = PyString_FromString( v.string() ); // } else{ EST_String s( v.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } PyDict_SetItemString( result, (char*)(p->k), py_val ); } return result; } static PyObject* item_features_to_PyDict( EST_Item *item, bool evaluate_ff ){ EST_Features::RwEntries p; PyObject *result = PyDict_New(); for( p.begin(item->features()); p != 0; ++p ){ const EST_Val &v = p->v; PyObject *py_val; if(v.type() == val_unset) py_val = Py_None; else if( v.type() == val_int ) py_val = PyInt_FromLong( v.Int() ); else if( v.type() == val_float ) py_val = PyFloat_FromDouble( v.Float() ); else if( v.type() == val_type_feats ) py_val = features_to_PyDict( feats(v) ); else if( (v.type() == val_type_featfunc) && evaluate_ff ){ EST_Val tempval = ((featfunc)(v))(item); if( tempval.type() == val_int ) py_val = PyInt_FromLong( tempval.Int() ); else if( tempval.type() == val_float ) py_val = PyFloat_FromDouble( tempval.Float() ); else{ EST_String s( tempval.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } } else{ EST_String s( v.string() ); if ( s.length() == 0 ) py_val = Py_BuildValue((char*)""); else py_val = PyString_FromStringAndSize( s.str(), s.length() ); } PyDict_SetItemString( result, (char*)(p->k), py_val ); } return result; } #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #include "EST_error.h" SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } #define SWIG_From_double PyFloat_FromDouble SWIGINTERNINLINE PyObject * SWIG_From_float (float value) { return SWIG_From_double (value); } #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERN EST_Item *EST_Item_prepend_daughter(EST_Item *self,EST_Item *p){ return prepend_daughter( self, p ); } SWIGINTERN EST_Item *EST_Item_append_daughter(EST_Item *self,EST_Item *p){ return append_daughter( self, p ); } SWIGINTERN EST_Item *EST_Item_daughter1(EST_Item *self){ return daughter1( self ); } SWIGINTERN EST_Item *EST_Item_daughtern(EST_Item *self){ return daughtern( self ); } SWIGINTERN EST_Item *EST_Item_next_sibling(EST_Item *self){ return next_sibling( self ); } SWIGINTERN EST_Item *EST_Item_prev_sibling(EST_Item *self){ return prev_sibling( self ); } SWIGINTERN EST_Item *EST_Item_parent(EST_Item *self){ return parent( self ); } SWIGINTERN void EST_Item_leafs(EST_Item *self,EST_Item **ITEMLEAFLISTOUT){ *ITEMLEAFLISTOUT = self; } SWIGINTERN void EST_Item_daughters(EST_Item *self,EST_Item **ITEMDAUGHTERLISTOUT){ *ITEMDAUGHTERLISTOUT = self; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_EST_Item__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Item")) SWIG_fail; result = (EST_Item *)new EST_Item(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Item__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Item",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Item, 0 | 0); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Item" "', argument " "1"" of type '" "EST_Item const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Item" "', argument " "1"" of type '" "EST_Item const &""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)new EST_Item((EST_Item const &)*arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Item__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:new_EST_Item",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Item" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); result = (EST_Item *)new EST_Item(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Item__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:new_EST_Item",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Relation, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Item" "', argument " "1"" of type '" "EST_Relation *""'"); } arg1 = reinterpret_cast< EST_Relation * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_EST_Item" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (EST_Item *)new EST_Item(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Item(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 0) { return _wrap_new_EST_Item__SWIG_0(self, args); } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Item__SWIG_1(self, args); } } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Item__SWIG_2(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Relation, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_EST_Item__SWIG_3(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EST_Item'.\n" " Possible C/C++ prototypes are:\n" " EST_Item()\n" " EST_Item(EST_Item const &)\n" " EST_Item(EST_Relation *)\n" " EST_Item(EST_Relation *,EST_Item *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_delete_EST_Item(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:delete_EST_Item",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Item" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_F(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; float result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_F",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_F" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (float)((EST_Item const *)arg1)->F((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_From_float(static_cast< float >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_S(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_S",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_S" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = ((EST_Item const *)arg1)->S((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@SWIG@*/ } { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_I(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_I",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_I" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)((EST_Item const *)arg1)->I((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_A(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Features *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_A",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_A" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Features *) &((EST_Item const *)arg1)->A((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = features_to_PyDict( result ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Item_set",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_set" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_set" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Item_set" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,arg3); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Item_set",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_set" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_set" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Item_set" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,arg3); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Item_set",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_set" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_set" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Item_set" "', argument " "3"" of type '" "char const *""'"); } arg3 = reinterpret_cast< char * >(buf3); { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,(char const *)arg3); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; EST_Features *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Item_set",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_set" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_set" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_EST_Features, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Item_set" "', argument " "3"" of type '" "EST_Features &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Item_set" "', argument " "3"" of type '" "EST_Features &""'"); } arg3 = reinterpret_cast< EST_Features * >(argp3); { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,*arg3); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EST_Features, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Item_set__SWIG_3(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Item_set__SWIG_0(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Item_set__SWIG_1(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Item_set__SWIG_2(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Item_set'.\n" " Possible C/C++ prototypes are:\n" " set(EST_Item *,char const *,int)\n" " set(EST_Item *,char const *,double)\n" " set(EST_Item *,char const *,char const *)\n" " set(EST_Item *,char const *,EST_Features &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_set_function(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Item_set_function",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_set_function" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set_function(*arg2,*arg3); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_f_remove(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_f_remove",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_f_remove" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@SWIG:../interface/EST_error.i,49,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->f_remove((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@SWIG@*/ } resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_evaluate_features(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_evaluate_features",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_evaluate_features" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); (arg1)->evaluate_features(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_f_present(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_f_present",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_f_present" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Item const *)arg1)->f_present((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_length" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (int)((EST_Item const *)arg1)->length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_as_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_as_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_as_relation" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_as_relation" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); result = (EST_Item *)((EST_Item const *)arg1)->as_relation((char const *)arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_in_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_in_relation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_in_relation" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Item const *)arg1)->in_relation((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_relation_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_relation_name",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_relation_name" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_String *) &((EST_Item const *)arg1)->relation_name(); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_relation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Relation *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_relation",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_relation" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Relation *)((EST_Item const *)arg1)->relation(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_same_item(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_same_item",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_same_item" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_same_item" "', argument " "2"" of type '" "EST_Item const *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (int)((EST_Item const *)arg1)->same_item((EST_Item const *)arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_unref_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_unref_all",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_unref_all" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); (arg1)->unref_all(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_prepend_daughter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_prepend_daughter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_prepend_daughter" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_prepend_daughter" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (EST_Item *)EST_Item_prepend_daughter(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_append_daughter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Item_append_daughter",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_append_daughter" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Item_append_daughter" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); result = (EST_Item *)EST_Item_append_daughter(arg1,arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_daughter1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_daughter1",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_daughter1" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)EST_Item_daughter1(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_daughtern(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_daughtern",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_daughtern" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)EST_Item_daughtern(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_next_sibling(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_next_sibling",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_next_sibling" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)EST_Item_next_sibling(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_prev_sibling(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_prev_sibling",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_prev_sibling" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)EST_Item_prev_sibling(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_parent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_parent",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_parent" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)EST_Item_parent(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_features(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Features *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_features",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_features" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Features *) &(arg1)->features(); resultobj = features_to_PyDict( result ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Item_leafs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item **arg2 = (EST_Item **) 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_Item *temp2 ; PyObject * obj0 = 0 ; arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:EST_Item_leafs",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Item_leafs" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); EST_Item_leafs(arg1,arg2); resultobj = SWIG_Py_Void(); { PyObject *o1, *o2, *o3; EST_Item *first_item = first_leaf(*arg2); EST_Item *last_item = last_leaf(*arg2); EST_Item *it; unsigned int i, num_leafs; // faster to count leafs first and allocate PyList once (?) for( it=first_item, num_leafs=0; (it!=0) && (it!=last_item); it=next_leaf(it) ) ++num_leafs; if( it != 0 ) ++num_leafs; // for last_item switch (num_leafs) { case 0: o1 = Py_None; //not sure this will ever happen break; // case 1: // o1 = SWIG_NewPointerObj((void *) it, SWIGTYPE_p_EST_Item, 0); // break; default: o1 = PyList_New(num_leafs); for( i=0, it=first_item; i(argp1); EST_Item_daughters(arg1,arg2); resultobj = SWIG_Py_Void(); { PyObject *o1, *o2, *o3; EST_Item *first_item = daughter1(*arg2); EST_Item *last_item = daughtern(*arg2); //could eliminate this call(does same traverse as below) EST_Item *it; unsigned int i, num_daughters; // faster to count daughters first and allocate PyList once (?) for( it=first_item, num_daughters=0; (it!=0) && (it!=last_item); it=next_sibling(it) ) ++num_daughters; if( it != 0 ) ++num_daughters; // for last_item switch (num_daughters) { case 0: o1 = Py_None; break; // case 1: // o1 = SWIG_NewPointerObj((void *) it, SWIGTYPE_p_EST_Item, 0); // break; default: o1 = PyList_New(num_daughters); for( i=0, it=first_item; i(argp1); result = (EST_Item *)next_item((EST_Item const *)arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_first_leaf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:first_leaf",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "first_leaf" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)first_leaf((EST_Item const *)arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_last_leaf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:last_leaf",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "last_leaf" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)last_leaf((EST_Item const *)arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_next_leaf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:next_leaf",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "next_leaf" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Item *)next_leaf((EST_Item const *)arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_num_leaves(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:num_leaves",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "num_leaves" "', argument " "1"" of type '" "EST_Item const *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (int)num_leaves((EST_Item const *)arg1); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_remove_item(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:remove_item",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "remove_item" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "remove_item" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); remove_item(arg1,(char const *)arg2); resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return NULL; } SWIGINTERN PyObject *_wrap_copy_node_tree(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:copy_node_tree",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "copy_node_tree" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "copy_node_tree" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); copy_node_tree(arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_copy_node_tree_contents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:copy_node_tree_contents",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "copy_node_tree_contents" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "copy_node_tree_contents" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); copy_node_tree_contents(arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_item_jump(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_Item *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:item_jump",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "item_jump" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_Item *)item_jump(arg1,(EST_String const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | 0 ); return resultobj; fail: return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_EST_Item", _wrap_new_EST_Item, METH_VARARGS, NULL}, { (char *)"delete_EST_Item", _wrap_delete_EST_Item, METH_VARARGS, NULL}, { (char *)"EST_Item_F", _wrap_EST_Item_F, METH_VARARGS, NULL}, { (char *)"EST_Item_S", _wrap_EST_Item_S, METH_VARARGS, NULL}, { (char *)"EST_Item_I", _wrap_EST_Item_I, METH_VARARGS, NULL}, { (char *)"EST_Item_A", _wrap_EST_Item_A, METH_VARARGS, NULL}, { (char *)"EST_Item_set", _wrap_EST_Item_set, METH_VARARGS, NULL}, { (char *)"EST_Item_set_function", _wrap_EST_Item_set_function, METH_VARARGS, NULL}, { (char *)"EST_Item_f_remove", _wrap_EST_Item_f_remove, METH_VARARGS, NULL}, { (char *)"EST_Item_evaluate_features", _wrap_EST_Item_evaluate_features, METH_VARARGS, NULL}, { (char *)"EST_Item_f_present", _wrap_EST_Item_f_present, METH_VARARGS, NULL}, { (char *)"EST_Item_length", _wrap_EST_Item_length, METH_VARARGS, NULL}, { (char *)"EST_Item_as_relation", _wrap_EST_Item_as_relation, METH_VARARGS, NULL}, { (char *)"EST_Item_in_relation", _wrap_EST_Item_in_relation, METH_VARARGS, NULL}, { (char *)"EST_Item_relation_name", _wrap_EST_Item_relation_name, METH_VARARGS, NULL}, { (char *)"EST_Item_relation", _wrap_EST_Item_relation, METH_VARARGS, NULL}, { (char *)"EST_Item_same_item", _wrap_EST_Item_same_item, METH_VARARGS, NULL}, { (char *)"EST_Item_unref_all", _wrap_EST_Item_unref_all, METH_VARARGS, NULL}, { (char *)"EST_Item_prepend_daughter", _wrap_EST_Item_prepend_daughter, METH_VARARGS, NULL}, { (char *)"EST_Item_append_daughter", _wrap_EST_Item_append_daughter, METH_VARARGS, NULL}, { (char *)"EST_Item_daughter1", _wrap_EST_Item_daughter1, METH_VARARGS, NULL}, { (char *)"EST_Item_daughtern", _wrap_EST_Item_daughtern, METH_VARARGS, NULL}, { (char *)"EST_Item_next_sibling", _wrap_EST_Item_next_sibling, METH_VARARGS, NULL}, { (char *)"EST_Item_prev_sibling", _wrap_EST_Item_prev_sibling, METH_VARARGS, NULL}, { (char *)"EST_Item_parent", _wrap_EST_Item_parent, METH_VARARGS, NULL}, { (char *)"EST_Item_features", _wrap_EST_Item_features, METH_VARARGS, NULL}, { (char *)"EST_Item_leafs", _wrap_EST_Item_leafs, METH_VARARGS, NULL}, { (char *)"EST_Item_daughters", _wrap_EST_Item_daughters, METH_VARARGS, NULL}, { (char *)"EST_Item_swigregister", EST_Item_swigregister, METH_VARARGS, NULL}, { (char *)"next_item", _wrap_next_item, METH_VARARGS, NULL}, { (char *)"first_leaf", _wrap_first_leaf, METH_VARARGS, NULL}, { (char *)"last_leaf", _wrap_last_leaf, METH_VARARGS, NULL}, { (char *)"next_leaf", _wrap_next_leaf, METH_VARARGS, NULL}, { (char *)"num_leaves", _wrap_num_leaves, METH_VARARGS, NULL}, { (char *)"remove_item", _wrap_remove_item, METH_VARARGS, NULL}, { (char *)"copy_node_tree", _wrap_copy_node_tree, METH_VARARGS, NULL}, { (char *)"copy_node_tree_contents", _wrap_copy_node_tree_contents, METH_VARARGS, NULL}, { (char *)"item_jump", _wrap_item_jump, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Features = {"_p_EST_Features", "EST_Features *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_EST_Item = {"_p_p_EST_Item", "EST_Item **", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Features, &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_char, &_swigt__p_p_EST_Item, }; static swig_cast_info _swigc__p_EST_Features[] = { {&_swigt__p_EST_Features, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_EST_Item[] = { {&_swigt__p_p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Features, _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_char, _swigc__p_p_EST_Item, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_Ngrammar_wrap.cc0000644000076400007640000116767511352212620020705 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* Python.h has to appear first */ #include /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #endif #ifndef Py_TYPE # define Py_TYPE(op) ((op)->ob_type) #endif /* SWIG APIs for compatibility of both Python 2 & 3 */ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat #else # define SWIG_Python_str_FromFormat PyString_FromFormat #endif /* Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03000000 char *cstr; char *newstr; Py_ssize_t len; str = PyUnicode_AsUTF8String(str); PyBytes_AsStringAndSize(str, &cstr, &len); newstr = (char *) malloc(len+1); memcpy(newstr, cstr, len+1); Py_XDECREF(str); return newstr; #else return PyString_AsString(str); #endif } #if PY_VERSION_HEX >= 0x03000000 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) #else # define SWIG_Python_str_DelForPy3(x) #endif SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif } /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) # define PyOS_snprintf _snprintf # else # define PyOS_snprintf snprintf # endif #endif /* A crude PyString_FromFormat implementation for old Pythons */ #if PY_VERSION_HEX < 0x02020000 #ifndef SWIG_PYBUFFER_SIZE # define SWIG_PYBUFFER_SIZE 1024 #endif static PyObject * PyString_FromFormat(const char *fmt, ...) { va_list ap; char buf[SWIG_PYBUFFER_SIZE * 2]; int res; va_start(ap, fmt); res = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); } #endif /* Add PyObject_Del for old Pythons */ #if PY_VERSION_HEX < 0x01060000 # define PyObject_Del(op) PyMem_DEL((op)) #endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif /* A crude PyExc_StopIteration exception for old Pythons */ #if PY_VERSION_HEX < 0x02020000 # ifndef PyExc_StopIteration # define PyExc_StopIteration PyExc_RuntimeError # endif # ifndef PyObject_GenericGetAttr # define PyObject_GenericGetAttr 0 # endif #endif /* Py_NotImplemented is defined in 2.1 and up. */ #if PY_VERSION_HEX < 0x02010000 # ifndef Py_NotImplemented # define Py_NotImplemented PyExc_RuntimeError # endif #endif /* A crude PyString_AsStringAndSize implementation for old Pythons */ #if PY_VERSION_HEX < 0x02010000 # ifndef PyString_AsStringAndSize # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} # endif #endif /* PySequence_Size for old Pythons */ #if PY_VERSION_HEX < 0x02000000 # ifndef PySequence_Size # define PySequence_Size PySequence_Length # endif #endif /* PyBool_FromLong for old Pythons */ #if PY_VERSION_HEX < 0x02030000 static PyObject *PyBool_FromLong(long ok) { PyObject *result = ok ? Py_True : Py_False; Py_INCREF(result); return result; } #endif /* Py_ssize_t for old Pythons */ /* This code is as recommended by: */ /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; # define PY_SSIZE_T_MAX INT_MAX # define PY_SSIZE_T_MIN INT_MIN #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_Python_ErrorType(int code) { PyObject* type = 0; switch(code) { case SWIG_MemoryError: type = PyExc_MemoryError; break; case SWIG_IOError: type = PyExc_IOError; break; case SWIG_RuntimeError: type = PyExc_RuntimeError; break; case SWIG_IndexError: type = PyExc_IndexError; break; case SWIG_TypeError: type = PyExc_TypeError; break; case SWIG_DivisionByZero: type = PyExc_ZeroDivisionError; break; case SWIG_OverflowError: type = PyExc_OverflowError; break; case SWIG_SyntaxError: type = PyExc_SyntaxError; break; case SWIG_ValueError: type = PyExc_ValueError; break; case SWIG_SystemError: type = PyExc_SystemError; break; case SWIG_AttributeError: type = PyExc_AttributeError; break; default: type = PyExc_RuntimeError; } return type; } SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char* mesg) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } #if defined(SWIG_PYTHON_NO_THREADS) # if defined(SWIG_PYTHON_THREADS) # undef SWIG_PYTHON_THREADS # endif #endif #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ # define SWIG_PYTHON_USE_GIL # endif # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { bool status; PyGILState_STATE state; public: void end() { if (status) { PyGILState_Release(state); status = false;} } SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} ~SWIG_Python_Thread_Block() { end(); } }; class SWIG_Python_Thread_Allow { bool status; PyThreadState *save; public: void end() { if (status) { PyEval_RestoreThread(save); status = false; }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() # else /* C code */ # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) # endif # else /* Old thread way, not implemented, user must provide it */ # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) # define SWIG_PYTHON_INITIALIZE_THREADS # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) # define SWIG_PYTHON_THREAD_END_BLOCK # endif # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # endif # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) # define SWIG_PYTHON_THREAD_END_ALLOW # endif # endif #else /* No thread support */ # define SWIG_PYTHON_INITIALIZE_THREADS # define SWIG_PYTHON_THREAD_BEGIN_BLOCK # define SWIG_PYTHON_THREAD_END_BLOCK # define SWIG_PYTHON_THREAD_BEGIN_ALLOW # define SWIG_PYTHON_THREAD_END_ALLOW #endif /* ----------------------------------------------------------------------------- * Python API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* ----------------------------------------------------------------------------- * Constant declarations * ----------------------------------------------------------------------------- */ /* Constant Types */ #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 /* Constant information structure */ typedef struct swig_const_info { int type; char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_const_info; /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) { #if PY_VERSION_HEX >= 0x03000000 return PyInstanceMethod_New(func); #else return NULL; #endif } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif /* ----------------------------------------------------------------------------- * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pyrun.swg * * This file contains the runtime support for Python modules * and includes code for managing global variables and pointer * type checking. * * ----------------------------------------------------------------------------- */ /* Common SWIG API */ /* for raw pointers */ #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, (char *) msg); SWIG_PYTHON_THREAD_END_BLOCK; } #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) /* Set a constant value */ SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, (char*) name, obj); Py_DECREF(obj); } /* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); PyList_SetItem(result, 0, o2); } PyList_Append(result,obj); Py_DECREF(obj); } return result; #else PyObject* o2; PyObject* o3; if (!result) { result = obj; } else if (result == Py_None) { Py_DECREF(result); result = obj; } else { if (!PyTuple_Check(result)) { o2 = result; result = PyTuple_New(1); PyTuple_SET_ITEM(result, 0, o2); } o3 = PyTuple_New(1); PyTuple_SET_ITEM(o3, 0, obj); o2 = result; result = PySequence_Concat(o2, o3); Py_DECREF(o2); Py_DECREF(o3); } return result; #endif } /* Unpack the argument tuple */ SWIGINTERN int SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { if (!min && !max) { return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } } if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } for (; l < max; ++l) { objs[l] = 0; } return i + 1; } } } /* A functor is a function object with one single object argument */ #if PY_VERSION_HEX >= 0x02020000 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #else #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif /* Helper for static pointer initialization for both C and C++ code, for example static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); */ #ifdef __cplusplus #define SWIG_STATIC_POINTER(var) var #else #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ /* Flags for new pointer objects */ #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #ifdef __cplusplus extern "C" { #if 0 } /* cc-mode */ #endif #endif /* How to access Py_None */ #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # ifndef SWIG_PYTHON_NO_BUILD_NONE # ifndef SWIG_PYTHON_BUILD_NONE # define SWIG_PYTHON_BUILD_NONE # endif # endif #endif #ifdef SWIG_PYTHON_BUILD_NONE # ifdef Py_None # undef Py_None # define Py_None SWIG_Py_None() # endif SWIGRUNTIMEINLINE PyObject * _SWIG_Py_None(void) { PyObject *none = Py_BuildValue((char*)""); Py_DECREF(none); return none; } SWIGRUNTIME PyObject * SWIG_Py_None(void) { static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); return none; } #endif /* The python void return value */ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; Py_INCREF(none); return none; } /* SwigPyClientData */ typedef struct { PyObject *klass; PyObject *newraw; PyObject *newargs; PyObject *destroy; int delargs; int implicitconv; } SwigPyClientData; SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; return data ? data->implicitconv : 0; } SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc) { SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; PyObject *klass = data ? data->klass : 0; return (klass ? klass : PyExc_RuntimeError); } SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { return 0; } else { SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; data->newargs = obj; Py_INCREF(obj); } else { #if (PY_VERSION_HEX < 0x02020000) data->newraw = 0; #else data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); #endif if (data->newraw) { Py_INCREF(data->newraw); data->newargs = PyTuple_New(1); PyTuple_SetItem(data->newargs, 0, obj); } else { data->newargs = obj; } Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); if (PyErr_Occurred()) { PyErr_Clear(); data->destroy = 0; } if (data->destroy) { int flags; Py_INCREF(data->destroy); flags = PyCFunction_GET_FLAGS(data->destroy); #ifdef METH_O data->delargs = !(flags & (METH_O)); #else data->delargs = 0; #endif } else { data->delargs = 0; } data->implicitconv = 0; return data; } } SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData* data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); } /* =============== SwigPyObject =====================*/ typedef struct { PyObject_HEAD void *ptr; swig_type_info *ty; int own; PyObject *next; } SwigPyObject; SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { return PyLong_FromVoidPtr(v->ptr); } SWIGRUNTIME PyObject * SwigPyObject_format(const char* fmt, SwigPyObject *v) { PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 res = PyUnicode_Format(ofmt,args); #else res = PyString_Format(ofmt,args); #endif Py_DECREF(ofmt); } Py_DECREF(args); } } return res; } SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v) { return SwigPyObject_format("%o",v); } SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v) { return SwigPyObject_format("%x",v); } SWIGRUNTIME PyObject * #ifdef METH_NOARGS SwigPyObject_repr(SwigPyObject *v) #else SwigPyObject_repr(SwigPyObject *v, PyObject *args) #endif { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", name, v); if (v->next) { #ifdef METH_NOARGS PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); #else PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); #endif #if PY_VERSION_HEX >= 0x03000000 PyObject *joined = PyUnicode_Concat(repr, nrep); Py_DecRef(repr); Py_DecRef(nrep); repr = joined; #else PyString_ConcatAndDel(&repr,nrep); #endif } return repr; } SWIGRUNTIME int SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *str; #ifdef METH_NOARGS PyObject *repr = SwigPyObject_repr(v); #else PyObject *repr = SwigPyObject_repr(v, NULL); #endif if (repr) { str = SWIG_Python_str_AsChar(repr); fputs(str, fp); SWIG_Python_str_DelForPy3(str); Py_DECREF(repr); return 0; } else { return 1; } } SWIGRUNTIME PyObject * SwigPyObject_str(SwigPyObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) { void *i = v->ptr; void *j = w->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { PyObject* res; if( op != Py_EQ && op != Py_NE ) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) res = Py_True; else res = Py_False; Py_INCREF(res); return res; } SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* SwigPyObject_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); return type; } SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { return (Py_TYPE(op) == SwigPyObject_type()) || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { SwigPyObject *sobj = (SwigPyObject *) v; PyObject *next = sobj->next; if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); res = SWIG_Python_CallFunctor(destroy, tmp); Py_DECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); res = ((*meth)(mself, v)); } Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif } Py_XDECREF(next); PyObject_DEL(v); } SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; #ifndef METH_O PyObject *tmp = 0; if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; next = tmp; #endif if (!SwigPyObject_Check(next)) { return NULL; } sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); } SWIGRUNTIME PyObject* #ifdef METH_NOARGS SwigPyObject_next(PyObject* v) #else SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); } } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_disown(PyObject *v) #else SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = 0; return SWIG_Py_Void(); } SWIGINTERN PyObject* #ifdef METH_NOARGS SwigPyObject_acquire(PyObject *v) #else SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) #endif { SwigPyObject *sobj = (SwigPyObject *)v; sobj->own = SWIG_POINTER_OWN; return SWIG_Py_Void(); } SWIGINTERN PyObject* SwigPyObject_own(PyObject *v, PyObject *args) { PyObject *val = 0; #if (PY_VERSION_HEX < 0x02020000) if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) #else if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) #endif { return NULL; } else { SwigPyObject *sobj = (SwigPyObject *)v; PyObject *obj = PyBool_FromLong(sobj->own); if (val) { #ifdef METH_NOARGS if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v); } else { SwigPyObject_disown(v); } #else if (PyObject_IsTrue(val)) { SwigPyObject_acquire(v,args); } else { SwigPyObject_disown(v,args); } #endif } return obj; } } #ifdef METH_O static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #else static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {0, 0, 0, 0} }; #endif #if PY_VERSION_HEX < 0x02020000 SWIGINTERN PyObject * SwigPyObject_getattr(SwigPyObject *sobj,char *name) { return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); } #endif SWIGRUNTIME PyTypeObject* _PySwigObject_type(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ /* nb_divide removed in Python 3 */ #if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ #endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ (unaryfunc)0, /*nb_negative*/ (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif (unaryfunc)SwigPyObject_long, /*nb_int*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_long, /*nb_long*/ #else 0, /*nb_reserved*/ #endif (unaryfunc)0, /*nb_float*/ #if PY_VERSION_HEX < 0x03000000 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ #endif }; static PyTypeObject swigpyobject_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ (printfunc)SwigPyObject_print, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else (getattrfunc)0, /* tp_getattr */ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif (reprfunc)SwigPyObject_repr, /* tp_repr */ &SwigPyObject_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyObject_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ swigobject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpyobject_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpyobject_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpyobject_type; } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; } return (PyObject *)sobj; } /* ----------------------------------------------------------------------------- * Implements a simple Swig Packed type, and use it instead of string * ----------------------------------------------------------------------------- */ typedef struct { PyObject_HEAD void *pack; swig_type_info *ty; size_t size; } SwigPyPacked; SWIGRUNTIME int SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char result[SWIG_BUFFER_SIZE]; fputs("pack, v->size, 0, sizeof(result))) { fputs("at ", fp); fputs(result, fp); } fputs(v->ty->name,fp); fputs(">", fp); return 0; } SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); } } SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); } } SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) { size_t i = v->size; size_t j = w->size; int s = (i < j) ? -1 : ((i > j) ? 1 : 0); return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); SWIGRUNTIME PyTypeObject* SwigPyPacked_type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { return ((op)->ob_type == _PySwigPacked_type()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v) { if (SwigPyPacked_Check(v)) { SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } PyObject_DEL(v); } SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif (char *)"SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ (printfunc)SwigPyPacked_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ #endif (reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)SwigPyPacked_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ swigpacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ 0, /* tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; swigpypacked_type = tmp; /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 swigpypacked_type.ob_type = &PyType_Type; #endif type_init = 1; } return &swigpypacked_type; } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { memcpy(pack, ptr, size); sobj->pack = pack; sobj->ty = ty; sobj->size = size; } else { PyObject_DEL((PyObject *) sobj); sobj = 0; } } return (PyObject *) sobj; } SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) { if (SwigPyPacked_Check(obj)) { SwigPyPacked *sobj = (SwigPyPacked *)obj; if (sobj->size != size) return 0; memcpy(ptr, sobj->pack, size); return sobj->ty; } else { return 0; } } /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * SWIG_This(void) { static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); return swig_this; } /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { if (SwigPyObject_Check(pyobj)) { return (SwigPyObject *) pyobj; } else { PyObject *obj = 0; #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) if (PyInstance_Check(pyobj)) { obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { #ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } } } #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; } #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; } } /* Acquire a pointer value */ SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { if (own == SWIG_POINTER_OWN) { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; sobj->own = own; return oldown; } } return 0; } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { if (!obj) return SWIG_ERROR; if (obj == Py_None) { if (ptr) *ptr = 0; return SWIG_OK; } else { SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { swig_type_info *to = sobj->ty; if (to == ty) { /* no type cast needed */ if (ptr) *ptr = vptr; break; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) { sobj = (SwigPyObject *)sobj->next; } else { if (ptr) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } break; } } } else { if (ptr) *ptr = vptr; break; } } if (sobj) { if (own) *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } return SWIG_OK; } else { int res = SWIG_ERROR; if (flags & SWIG_POINTER_IMPLICIT_CONV) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; if (data && !data->implicitconv) { PyObject *klass = data->klass; if (klass) { PyObject *impconv; data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ impconv = SWIG_Python_CallFunctor(klass, obj); data->implicitconv = 0; if (PyErr_Occurred()) { PyErr_Clear(); impconv = 0; } if (impconv) { SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); if (iobj) { void *vptr; res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); if (SWIG_IsOK(res)) { if (ptr) { *ptr = vptr; /* transfer the ownership to 'ptr' */ iobj->own = 0; res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { res = SWIG_AddCast(res); } } } Py_DECREF(impconv); } } } } return res; } } } /* Convert a function ptr value */ SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { if (!PyCFunction_Check(obj)) { return SWIG_ConvertPtr(obj, ptr, ty, 0); } else { void *vptr = 0; /* here we get the method pointer for callbacks */ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; if (!desc) return SWIG_ERROR; if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } else { return SWIG_ERROR; } } else { *ptr = vptr; } return SWIG_OK; } } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); if (!to) return SWIG_ERROR; if (ty) { if (to != ty) { /* check type cast? */ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); if (!tc) return SWIG_ERROR; } } return SWIG_OK; } /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- */ /* Create a new instance object, without calling __init__, and set the 'this' attribute. */ SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { #if (PY_VERSION_HEX >= 0x02020000) PyObject *inst = 0; PyObject *newraw = data->newraw; if (newraw) { inst = PyObject_Call(newraw, data->newargs, NULL); if (inst) { #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { PyObject *dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; PyDict_SetItem(dict, SWIG_This(), swig_this); } } #else PyObject *key = SWIG_This(); PyObject_SetAttr(inst, key, swig_this); #endif } } else { #if PY_VERSION_HEX >= 0x03000000 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; #else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); #endif } return inst; #else #if (PY_VERSION_HEX >= 0x02010000) PyObject *inst; PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); return (PyObject *) inst; #else PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); if (inst == NULL) { return NULL; } inst->in_class = (PyClassObject *)data->newargs; Py_INCREF(inst->in_class); inst->in_dict = PyDict_New(); if (inst->in_dict == NULL) { Py_DECREF(inst); return NULL; } #ifdef Py_TPFLAGS_HAVE_WEAKREFS inst->in_weakreflist = NULL; #endif #ifdef Py_TPFLAGS_GC PyObject_GC_Init(inst); #endif PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); return (PyObject *) inst; #endif #endif } SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { PyObject *dict; #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { dict = *dictptr; if (dict == NULL) { dict = PyDict_New(); *dictptr = dict; } PyDict_SetItem(dict, SWIG_This(), swig_this); return; } #endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict); } SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args) { PyObject *obj[2]; if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { return NULL; } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { SwigPyObject_append((PyObject*) sthis, obj[1]); } else { SWIG_Python_SetSwigThis(obj[0], obj[1]); } return SWIG_Py_Void(); } } /* Create a new pointer object */ SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { if (!ptr) { return SWIG_Py_Void(); } else { int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; PyObject *robj = SwigPyObject_New(ptr, type, own); SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); if (inst) { Py_DECREF(robj); robj = inst; } } return robj; } } /* Create a new packed object */ SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } /* -----------------------------------------------------------------------------* * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME void *SWIG_ReturnGlobalTypeList(void *); #endif SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void) { static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; } #endif } return (swig_module_info *) type_pointer; } #if PY_MAJOR_VERSION < 2 /* PyModule_AddObject function was introduced in Python 2.0. The following function is copied out of Python/modsupport.c in python version 2.3.4 */ SWIGINTERN int PyModule_AddObject(PyObject *m, char *name, PyObject *o) { PyObject *dict; if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; } dict = PyModule_GetDict(m); if (dict == NULL) { /* Internal error -- modules must have a dict! */ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m)); return SWIG_ERROR; } if (PyDict_SetItemString(dict, name, o)) return SWIG_ERROR; Py_DECREF(o); return SWIG_OK; } #endif SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { swig_module_info *swig_module = (swig_module_info *) vptr; swig_type_info **types = swig_module->types; size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; if (data) SwigPyClientData_Del(data); } } Py_DECREF(SWIG_This()); } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ #if PY_VERSION_HEX >= 0x03000000 /* Add a dummy module object into sys.modules */ PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); #else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); } else { Py_XDECREF(pointer); } } /* The python cached type query */ SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void) { static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); return cache; } SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCObject_FromVoidPtr(descriptor, NULL); PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } Py_DECREF(key); return descriptor; } /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) { if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; PyObject *traceback = 0; PyErr_Fetch(&type, &value, &traceback); if (value) { char *tmp; PyObject *old_str = PyObject_Str(value); Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); } else { PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); } SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; } else { return 0; } } SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { if (PyErr_Occurred()) { /* add information about failing argument */ char mesg[256]; PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); return SWIG_Python_AddErrMesg(mesg, 1); } else { return 0; } } SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self) { SwigPyObject *v = (SwigPyObject *)self; swig_type_info *ty = v ? v->ty : 0; return ty ? ty->str : (char*)""; } SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { const char *otype = (const char *) SwigPyObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", type, otype); return; } } else #endif { const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); } Py_XDECREF(str); return; } } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); } } /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); #if SWIG_POINTER_EXCEPTION if (flags) { SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); SWIG_Python_ArgFail(argnum); } #endif } return result; } #ifdef __cplusplus #if 0 { /* cc-mode */ #endif } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_DVector swig_types[0] #define SWIGTYPE_p_EST_DiscreteProbDistribution swig_types[1] #define SWIGTYPE_p_EST_IVector swig_types[2] #define SWIGTYPE_p_EST_Item swig_types[3] #define SWIGTYPE_p_EST_Ngrammar swig_types[4] #define SWIGTYPE_p_EST_StrList swig_types[5] #define SWIGTYPE_p_EST_StrVector swig_types[6] #define SWIGTYPE_p_char swig_types[7] #define SWIGTYPE_p_double swig_types[8] #define SWIGTYPE_p_int swig_types[9] #define SWIGTYPE_p_ostream swig_types[10] static swig_type_info *swig_types[12]; static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #if (PY_VERSION_HEX <= 0x02000000) # if !defined(SWIG_PYTHON_CLASSIC) # error "This python version requires swig to be run with the '-classic' option" # endif #endif /*----------------------------------------------- @(target):= _EST_Ngrammar.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__EST_Ngrammar #else # define SWIG_init init_EST_Ngrammar #endif #define SWIG_name "_EST_Ngrammar" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include namespace swig { class SwigPtr_PyObject { protected: PyObject *_obj; public: SwigPtr_PyObject() :_obj(0) { } SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { Py_XINCREF(_obj); } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { Py_XINCREF(_obj); } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; return *this; } ~SwigPtr_PyObject() { Py_XDECREF(_obj); } operator PyObject *() const { return _obj; } PyObject *operator->() const { return _obj; } }; } namespace swig { struct SwigVar_PyObject : SwigPtr_PyObject { SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } SwigVar_PyObject & operator = (PyObject* obj) { Py_XDECREF(_obj); _obj = obj; return *this; } }; } #include "EST_Ngrammar.h" #include "EST_DMatrix.h" #include "EST_rw_status.h" #define SWIG_From_long PyInt_FromLong SWIGINTERNINLINE PyObject * SWIG_From_int (int value) { return SWIG_From_long (value); } #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double (PyObject *obj, double *val) { int res = SWIG_TypeError; if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; double d = PyFloat_AsDouble(obj); if (!PyErr_Occurred()) { if (val) *val = d; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); } else { PyErr_Clear(); } } } #endif return res; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long (PyObject *obj, long* val) { if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; } else if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); } } #ifdef SWIG_PYTHON_CAST_MODE { int dispatch = 0; long v = PyInt_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_AddCast(SWIG_OK); } else { PyErr_Clear(); } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } #endif return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERNINLINE PyObject* SWIG_From_bool (bool value) { return PyBool_FromLong(value ? 1 : 0); } #define SWIG_From_double PyFloat_FromDouble SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 if (PyUnicode_Check(obj)) #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require a UTF-8 representation. TODO(bhy) More detailed explanation */ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner string representation. To warranty that, if you define SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string buffer is always returned. The default behavior is just to return the pointer value, so, be careful. */ #if defined(SWIG_PYTHON_SAFE_CSTRINGS) if (*alloc != SWIG_OLDOBJ) #else if (*alloc == SWIG_NEWOBJ) #endif { *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { #if PY_VERSION_HEX>=0x03000000 assert(0); /* Should never reach here in Python 3 */ #endif *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; #if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *) vptr; if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_bool (PyObject *obj, bool *val) { int r = PyObject_IsTrue(obj); if (r == -1) return SWIG_ERROR; if (val) *val = r ? true : false; return SWIG_OK; } SWIGINTERN int SWIG_AsVal_float (PyObject * obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_new_EST_Ngrammar__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *result = 0 ; if (!PyArg_ParseTuple(args,(char *)":new_EST_Ngrammar")) SWIG_fail; result = (EST_Ngrammar *)new EST_Ngrammar(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Ngrammar, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_new_EST_Ngrammar__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; EST_Ngrammar::representation_t arg2 ; EST_StrList *arg3 = 0 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; EST_StrList temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_Ngrammar *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:new_EST_Ngrammar",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_EST_Ngrammar" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_EST_Ngrammar" "', argument " "2"" of type '" "EST_Ngrammar::representation_t""'"); } arg2 = static_cast< EST_Ngrammar::representation_t >(val2); { if (PyList_Check(obj2)){ int size = PyList_Size( obj2 ); for(int i=0; i(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_EST_Ngrammar" "', argument " "2"" of type '" "EST_Ngrammar::representation_t""'"); } arg2 = static_cast< EST_Ngrammar::representation_t >(val2); { if (PyList_Check(obj2)){ int size = PyList_Size( obj2 ); for(int i=0; i(argp1); delete arg1; resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_clear",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_clear" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); (arg1)->clear(); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_init__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; EST_Ngrammar::representation_t arg3 ; EST_StrList *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; EST_StrList temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_init",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_init" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_init" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_init" "', argument " "3"" of type '" "EST_Ngrammar::representation_t""'"); } arg3 = static_cast< EST_Ngrammar::representation_t >(val3); { if (PyList_Check(obj3)){ int size = PyList_Size( obj3 ); for(int i=0; iinit(arg2,arg3,(EST_StrList const &)*arg4); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_init__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; EST_Ngrammar::representation_t arg3 ; EST_StrList *arg4 = 0 ; EST_StrList *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; EST_StrList temp4 ; EST_StrList temp5 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Ngrammar_init",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_init" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_init" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_init" "', argument " "3"" of type '" "EST_Ngrammar::representation_t""'"); } arg3 = static_cast< EST_Ngrammar::representation_t >(val3); { if (PyList_Check(obj3)){ int size = PyList_Size( obj3 ); for(int i=0; iinit(arg2,arg3,(EST_StrList const &)*arg4,(EST_StrList const &)*arg5); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_init(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_init__SWIG_0(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[4], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_init__SWIG_1(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_init'.\n" " Possible C/C++ prototypes are:\n" " init(EST_Ngrammar *,int,EST_Ngrammar::representation_t,EST_StrList const &)\n" " init(EST_Ngrammar *,int,EST_Ngrammar::representation_t,EST_StrList const &,EST_StrList const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_num_states(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_num_states",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_num_states" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (int)((EST_Ngrammar const *)arg1)->num_states(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_samples(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_samples",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_samples" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (double)((EST_Ngrammar const *)arg1)->samples(); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_order(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_order",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_order" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (int)((EST_Ngrammar const *)arg1)->order(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_vocab_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_get_vocab_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_vocab_length" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (int)(arg1)->get_vocab_length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_vocab_word__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_get_vocab_word",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_vocab_word" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_get_vocab_word" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = ((EST_Ngrammar const *)arg1)->get_vocab_word(arg2); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_vocab_word__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_get_vocab_word",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_vocab_word" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Ngrammar const *)arg1)->get_vocab_word((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_vocab_word(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_get_vocab_word__SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_get_vocab_word__SWIG_1(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_get_vocab_word'.\n" " Possible C/C++ prototypes are:\n" " get_vocab_word(EST_Ngrammar const *,int)\n" " get_vocab_word(EST_Ngrammar const *,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_pred_vocab_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_get_pred_vocab_length",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_pred_vocab_length" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (int)((EST_Ngrammar const *)arg1)->get_pred_vocab_length(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_pred_vocab_word__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_get_pred_vocab_word",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_pred_vocab_word" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_get_pred_vocab_word" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = ((EST_Ngrammar const *)arg1)->get_pred_vocab_word(arg2); { int len = (&result)->length(); resultobj = (len ? PyString_FromStringAndSize((&result)->str(),len) : Py_BuildValue((char*)"")); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_pred_vocab_word__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_get_pred_vocab_word",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_pred_vocab_word" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Ngrammar const *)arg1)->get_pred_vocab_word((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_pred_vocab_word(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_get_pred_vocab_word__SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_get_pred_vocab_word__SWIG_1(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_get_pred_vocab_word'.\n" " Possible C/C++ prototypes are:\n" " get_pred_vocab_word(EST_Ngrammar const *,int)\n" " get_pred_vocab_word(EST_Ngrammar const *,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_closed_vocab(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_closed_vocab",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_closed_vocab" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (int)((EST_Ngrammar const *)arg1)->closed_vocab(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_entry_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Ngrammar::entry_t result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_entry_type",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_entry_type" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (EST_Ngrammar::entry_t)((EST_Ngrammar const *)arg1)->entry_type(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_representation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; EST_Ngrammar::representation_t result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_representation",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_representation" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (EST_Ngrammar::representation_t)((EST_Ngrammar const *)arg1)->representation(); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; EST_String *arg5 = 0 ; EST_String *arg6 = 0 ; EST_String *arg7 = 0 ; int arg8 ; int arg9 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; EST_String temp5 ; EST_String temp6 ; EST_String temp7 ; int val8 ; int ecode8 = 0 ; int val9 ; int ecode9 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; i(val8); ecode9 = SWIG_AsVal_int(obj8, &val9); if (!SWIG_IsOK(ecode9)) { SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "EST_Ngrammar_build" "', argument " "9"" of type '" "int""'"); } arg9 = static_cast< int >(val9); result = (bool)(arg1)->build((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4,(EST_String const &)*arg5,(EST_String const &)*arg6,(EST_String const &)*arg7,arg8,arg9); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; EST_String *arg5 = 0 ; EST_String *arg6 = 0 ; EST_String *arg7 = 0 ; int arg8 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; EST_String temp5 ; EST_String temp6 ; EST_String temp7 ; int val8 ; int ecode8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; i(val8); result = (bool)(arg1)->build((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4,(EST_String const &)*arg5,(EST_String const &)*arg6,(EST_String const &)*arg7,arg8); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; EST_String *arg5 = 0 ; EST_String *arg6 = 0 ; EST_String *arg7 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; EST_String temp5 ; EST_String temp6 ; EST_String temp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4,(EST_String const &)*arg5,(EST_String const &)*arg6,(EST_String const &)*arg7); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; EST_String *arg5 = 0 ; EST_String *arg6 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; EST_String temp5 ; EST_String temp6 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4,(EST_String const &)*arg5,(EST_String const &)*arg6); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; EST_String *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; EST_String temp5 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4,(EST_String const &)*arg5); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; EST_String temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_build",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; EST_String temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_build",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2,(EST_String const &)*arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrList *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_StrList temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_build",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_build" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { if (PyList_Check(obj1)){ int size = PyList_Size( obj1 ); for(int i=0; ibuild((EST_StrList const &)*arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_build(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 9); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_7(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_6(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_5(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_4(self, args); } } } } } } if (argc == 6) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_3(self, args); } } } } } } } if (argc == 7) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_build__SWIG_2(self, args); } } } } } } } } if (argc == 8) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_build__SWIG_1(self, args); } } } } } } } } } if (argc == 9) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[7], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[8], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_build__SWIG_0(self, args); } } } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_build'.\n" " Possible C/C++ prototypes are:\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &,int const,int const)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &,int const)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &,EST_String const &,EST_String const &)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &,EST_String const &)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &,EST_String const &)\n" " build(EST_Ngrammar *,EST_StrList const &,EST_String const &)\n" " build(EST_Ngrammar *,EST_StrList const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_accumulate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_accumulate",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_accumulate" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_accumulate" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); (arg1)->accumulate((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_accumulate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_accumulate",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_accumulate" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); (arg1)->accumulate((EST_StrVector const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_accumulate__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_accumulate",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_accumulate" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_accumulate" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); (arg1)->accumulate((EST_IVector const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_accumulate__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_accumulate",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_accumulate" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_accumulate" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); (arg1)->accumulate((EST_IVector const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_accumulate(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_accumulate__SWIG_1(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_accumulate__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_accumulate__SWIG_2(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_accumulate__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_accumulate'.\n" " Possible C/C++ prototypes are:\n" " accumulate(EST_Ngrammar *,EST_StrVector const &,double const)\n" " accumulate(EST_Ngrammar *,EST_StrVector const &)\n" " accumulate(EST_Ngrammar *,EST_IVector const &,double const)\n" " accumulate(EST_Ngrammar *,EST_IVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_load",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_load" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_read_status)(arg1)->load((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; EST_StrList *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_StrList temp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_read_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_load",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_load" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { if (PyList_Check(obj2)){ int size = PyList_Size( obj2 ); for(int i=0; iload((EST_String const &)*arg2,(EST_StrList const &)*arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_load(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_load__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_EST_StrList, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_load__SWIG_1(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_load'.\n" " Possible C/C++ prototypes are:\n" " load(EST_Ngrammar *,EST_String const &)\n" " load(EST_Ngrammar *,EST_String const &,EST_StrList const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; EST_String arg3 ; bool arg4 ; double arg5 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; bool val4 ; int ecode4 = 0 ; double val5 ; int ecode5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOOOO:EST_Ngrammar_save",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_save" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Ngrammar_save" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); ecode5 = SWIG_AsVal_double(obj4, &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EST_Ngrammar_save" "', argument " "5"" of type '" "double""'"); } arg5 = static_cast< double >(val5); result = (EST_write_status)(arg1)->save((EST_String const &)*arg2,arg3,arg4,arg5); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; EST_String arg3 ; bool arg4 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; bool val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_save",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_save" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Ngrammar_save" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); result = (EST_write_status)(arg1)->save((EST_String const &)*arg2,arg3,arg4); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_save__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; EST_String arg3 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_save",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_save" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); arg3 = EST_String( str, len, 0, len ); } result = (EST_write_status)(arg1)->save((EST_String const &)*arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_save__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_write_status result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_save",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_save" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_write_status)(arg1)->save((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_save(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 5); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_save__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_save__SWIG_2(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_save__SWIG_1(self, args); } } } } } if (argc == 5) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_double(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_save__SWIG_0(self, args); } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_save'.\n" " Possible C/C++ prototypes are:\n" " save(EST_Ngrammar *,EST_String const &,EST_String,bool,double)\n" " save(EST_Ngrammar *,EST_String const &,EST_String,bool)\n" " save(EST_Ngrammar *,EST_String const &,EST_String)\n" " save(EST_Ngrammar *,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_wordlist_index__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_wordlist_index",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_wordlist_index" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_wordlist_index" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); result = (int)((EST_Ngrammar const *)arg1)->wordlist_index((EST_String const &)*arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_wordlist_index__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_wordlist_index",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_wordlist_index" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Ngrammar const *)arg1)->wordlist_index((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_wordlist_index__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_wordlist_index",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_wordlist_index" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_wordlist_index" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (EST_String *) &((EST_Ngrammar const *)arg1)->wordlist_index(arg2); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_wordlist_index(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_wordlist_index__SWIG_2(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_wordlist_index__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_wordlist_index__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_wordlist_index'.\n" " Possible C/C++ prototypes are:\n" " wordlist_index(EST_Ngrammar const *,EST_String const &,bool)\n" " wordlist_index(EST_Ngrammar const *,EST_String const &)\n" " wordlist_index(EST_Ngrammar const *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predlist_index__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_predlist_index",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predlist_index" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Ngrammar const *)arg1)->predlist_index((EST_String const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predlist_index__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_predlist_index",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predlist_index" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_predlist_index" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predlist_index(arg2); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predlist_index(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_predlist_index__SWIG_1(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predlist_index__SWIG_0(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_predlist_index'.\n" " Possible C/C++ prototypes are:\n" " predlist_index(EST_Ngrammar const *,EST_String const &)\n" " predlist_index(EST_Ngrammar const *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_set_entry_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_Ngrammar::entry_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_set_entry_type",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_set_entry_type" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_set_entry_type" "', argument " "2"" of type '" "EST_Ngrammar::entry_t""'"); } arg2 = static_cast< EST_Ngrammar::entry_t >(val2); result = (bool)(arg1)->set_entry_type(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_set_representation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_Ngrammar::representation_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_set_representation",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_set_representation" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_set_representation" "', argument " "2"" of type '" "EST_Ngrammar::representation_t""'"); } arg2 = static_cast< EST_Ngrammar::representation_t >(val2); result = (bool)(arg1)->set_representation(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_probability__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; bool arg3 ; bool arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; bool val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_probability",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_probability" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Ngrammar_probability" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); result = (double)((EST_Ngrammar const *)arg1)->probability((EST_StrVector const &)*arg2,arg3,arg4); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_probability__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_probability",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_probability" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); result = (double)((EST_Ngrammar const *)arg1)->probability((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_probability__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_probability",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (double)((EST_Ngrammar const *)arg1)->probability((EST_StrVector const &)*arg2); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_probability(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_probability__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_probability__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_probability__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_probability'.\n" " Possible C/C++ prototypes are:\n" " probability(EST_Ngrammar const *,EST_StrVector const &,bool,bool)\n" " probability(EST_Ngrammar const *,EST_StrVector const &,bool)\n" " probability(EST_Ngrammar const *,EST_StrVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_frequency__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; bool arg3 ; bool arg4 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; bool val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_frequency",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_frequency" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_frequency" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); ecode4 = SWIG_AsVal_bool(obj3, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EST_Ngrammar_frequency" "', argument " "4"" of type '" "bool""'"); } arg4 = static_cast< bool >(val4); result = (double)((EST_Ngrammar const *)arg1)->frequency((EST_StrVector const &)*arg2,arg3,arg4); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_frequency__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_frequency",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_frequency" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_frequency" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); result = (double)((EST_Ngrammar const *)arg1)->frequency((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_frequency__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_frequency",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_frequency" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_frequency" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (double)((EST_Ngrammar const *)arg1)->frequency((EST_StrVector const &)*arg2); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_frequency(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_frequency__SWIG_2(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_frequency__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_frequency__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_frequency'.\n" " Possible C/C++ prototypes are:\n" " frequency(EST_Ngrammar const *,EST_StrVector const &,bool,bool)\n" " frequency(EST_Ngrammar const *,EST_StrVector const &,bool)\n" " frequency(EST_Ngrammar const *,EST_StrVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_predict",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_StrVector const &)*arg2); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; double *arg3 = (double *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_predict",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_double, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Ngrammar_predict" "', argument " "3"" of type '" "double *""'"); } arg3 = reinterpret_cast< double * >(argp3); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_StrVector const &)*arg2,arg3); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; double *arg3 = (double *) 0 ; int *arg4 = (int *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_predict",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_double, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Ngrammar_predict" "', argument " "3"" of type '" "double *""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "EST_Ngrammar_predict" "', argument " "4"" of type '" "int *""'"); } arg4 = reinterpret_cast< int * >(argp4); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_StrVector const &)*arg2,arg3,arg4); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_predict",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_IVector const &)*arg2); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; double *arg3 = (double *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_predict",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_double, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Ngrammar_predict" "', argument " "3"" of type '" "double *""'"); } arg3 = reinterpret_cast< double * >(argp3); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_IVector const &)*arg2,arg3); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; double *arg3 = (double *) 0 ; int *arg4 = (int *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; EST_String *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_predict",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_predict" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_predict" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_double, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EST_Ngrammar_predict" "', argument " "3"" of type '" "double *""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "EST_Ngrammar_predict" "', argument " "4"" of type '" "int *""'"); } arg4 = reinterpret_cast< int * >(argp4); result = (EST_String *) &((EST_Ngrammar const *)arg1)->predict((EST_IVector const &)*arg2,arg3,arg4); { int len = result->length(); resultobj = len ? PyString_FromStringAndSize(result->str(),len) : Py_BuildValue((char*)""); } return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_predict(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_1(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_4(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_int, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_2(self, args); } } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_int, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_predict__SWIG_5(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_predict'.\n" " Possible C/C++ prototypes are:\n" " predict(EST_Ngrammar const *,EST_StrVector const &)\n" " predict(EST_Ngrammar const *,EST_StrVector const &,double *)\n" " predict(EST_Ngrammar const *,EST_StrVector const &,double *,int *)\n" " predict(EST_Ngrammar const *,EST_IVector const &)\n" " predict(EST_Ngrammar const *,EST_IVector const &,double *)\n" " predict(EST_Ngrammar const *,EST_IVector const &,double *,int *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_find_state_id__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_find_state_id",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_find_state_id" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_find_state_id" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_find_state_id" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (int)((EST_Ngrammar const *)arg1)->find_state_id((EST_StrVector const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_find_state_id__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_find_state_id",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_find_state_id" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_find_state_id" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_find_state_id" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); result = (int)((EST_Ngrammar const *)arg1)->find_state_id((EST_IVector const &)*arg2); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_find_state_id(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_find_state_id__SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_find_state_id__SWIG_1(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_find_state_id'.\n" " Possible C/C++ prototypes are:\n" " find_state_id(EST_Ngrammar const *,EST_StrVector const &)\n" " find_state_id(EST_Ngrammar const *,EST_IVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_find_next_state_id(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_find_next_state_id",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_find_next_state_id" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_find_next_state_id" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_find_next_state_id" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (int)((EST_Ngrammar const *)arg1)->find_next_state_id(arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_reverse_probability__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_reverse_probability",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); result = (double)((EST_Ngrammar const *)arg1)->reverse_probability((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_reverse_probability__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_reverse_probability",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (double)((EST_Ngrammar const *)arg1)->reverse_probability((EST_StrVector const &)*arg2); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_reverse_probability__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; bool arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_reverse_probability",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); ecode3 = SWIG_AsVal_bool(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "3"" of type '" "bool""'"); } arg3 = static_cast< bool >(val3); result = (double)((EST_Ngrammar const *)arg1)->reverse_probability((EST_IVector const &)*arg2,arg3); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_reverse_probability__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_reverse_probability",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_reverse_probability" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); result = (double)((EST_Ngrammar const *)arg1)->reverse_probability((EST_IVector const &)*arg2); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_reverse_probability(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_reverse_probability__SWIG_1(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_reverse_probability__SWIG_3(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_reverse_probability__SWIG_2(self, args); } } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_reverse_probability__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_reverse_probability'.\n" " Possible C/C++ prototypes are:\n" " reverse_probability(EST_Ngrammar const *,EST_StrVector const &,bool)\n" " reverse_probability(EST_Ngrammar const *,EST_StrVector const &)\n" " reverse_probability(EST_Ngrammar const *,EST_IVector const &,bool)\n" " reverse_probability(EST_Ngrammar const *,EST_IVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_prob_dist__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_DiscreteProbDistribution *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_prob_dist",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_prob_dist" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_prob_dist" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_prob_dist" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (EST_DiscreteProbDistribution *) &((EST_Ngrammar const *)arg1)->prob_dist((EST_StrVector const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_DiscreteProbDistribution, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_prob_dist__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_DiscreteProbDistribution *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_prob_dist",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_prob_dist" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_prob_dist" "', argument " "2"" of type '" "EST_IVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_prob_dist" "', argument " "2"" of type '" "EST_IVector const &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); result = (EST_DiscreteProbDistribution *) &((EST_Ngrammar const *)arg1)->prob_dist((EST_IVector const &)*arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_DiscreteProbDistribution, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_prob_dist__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; EST_DiscreteProbDistribution *result = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_prob_dist",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_prob_dist" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_prob_dist" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (EST_DiscreteProbDistribution *) &((EST_Ngrammar const *)arg1)->prob_dist(arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_DiscreteProbDistribution, 0 | 0 ); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_prob_dist(PyObject *self, PyObject *args) { int argc; PyObject *argv[3]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 2); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_prob_dist__SWIG_0(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_prob_dist__SWIG_1(self, args); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_prob_dist__SWIG_2(self, args); } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_prob_dist'.\n" " Possible C/C++ prototypes are:\n" " prob_dist(EST_Ngrammar const *,EST_StrVector const &)\n" " prob_dist(EST_Ngrammar const *,EST_IVector const &)\n" " prob_dist(EST_Ngrammar const *,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_fill_window_start__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_IVector *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; EST_String temp3 ; EST_String temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_fill_window_start",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_fill_window_start" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_IVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_fill_window_start" "', argument " "2"" of type '" "EST_IVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_fill_window_start" "', argument " "2"" of type '" "EST_IVector &""'"); } arg2 = reinterpret_cast< EST_IVector * >(argp2); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj3, &str, &len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } ((EST_Ngrammar const *)arg1)->fill_window_start(*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_fill_window_start__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; EST_String temp3 ; EST_String temp4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOOO:EST_Ngrammar_fill_window_start",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_fill_window_start" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_fill_window_start" "', argument " "2"" of type '" "EST_StrVector &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_fill_window_start" "', argument " "2"" of type '" "EST_StrVector &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj2, &str, &len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj3, &str, &len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } ((EST_Ngrammar const *)arg1)->fill_window_start(*arg2,(EST_String const &)*arg3,(EST_String const &)*arg4); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_fill_window_start(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_IVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_fill_window_start__SWIG_0(self, args); } } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_fill_window_start__SWIG_1(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_fill_window_start'.\n" " Possible C/C++ prototypes are:\n" " fill_window_start(EST_Ngrammar const *,EST_IVector &,EST_String const &,EST_String const &)\n" " fill_window_start(EST_Ngrammar const *,EST_StrVector &,EST_String const &,EST_String const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_ngram_exists__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_ngram_exists",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_ngram_exists" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_ngram_exists" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_ngram_exists" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (bool)((EST_Ngrammar const *)arg1)->ngram_exists((EST_StrVector const &)*arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_ngram_exists__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_ngram_exists",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_ngram_exists" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_ngram_exists" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_ngram_exists" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_ngram_exists" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); result = (bool)((EST_Ngrammar const *)arg1)->ngram_exists((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_ngram_exists(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_ngram_exists__SWIG_0(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_StrVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_ngram_exists__SWIG_1(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_ngram_exists'.\n" " Possible C/C++ prototypes are:\n" " ngram_exists(EST_Ngrammar const *,EST_StrVector const &)\n" " ngram_exists(EST_Ngrammar const *,EST_StrVector const &,double const)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_get_backoff_weight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; double result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_get_backoff_weight",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_get_backoff_weight" "', argument " "1"" of type '" "EST_Ngrammar const *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_get_backoff_weight" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_get_backoff_weight" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); result = (double)((EST_Ngrammar const *)arg1)->get_backoff_weight((EST_StrVector const &)*arg2); resultobj = SWIG_From_double(static_cast< double >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_set_backoff_weight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_StrVector *arg2 = 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_set_backoff_weight",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_set_backoff_weight" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_StrVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_set_backoff_weight" "', argument " "2"" of type '" "EST_StrVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_set_backoff_weight" "', argument " "2"" of type '" "EST_StrVector const &""'"); } arg2 = reinterpret_cast< EST_StrVector * >(argp2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_set_backoff_weight" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); result = (bool)(arg1)->set_backoff_weight((EST_StrVector const &)*arg2,arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_print_freqs__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; ostream *arg2 = 0 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_print_freqs",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_print_freqs" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_ostream, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_print_freqs" "', argument " "2"" of type '" "ostream &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_print_freqs" "', argument " "2"" of type '" "ostream &""'"); } arg2 = reinterpret_cast< ostream * >(argp2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_print_freqs" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); (arg1)->print_freqs(*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_print_freqs__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; ostream *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_print_freqs",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_print_freqs" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_ostream, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_print_freqs" "', argument " "2"" of type '" "ostream &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_print_freqs" "', argument " "2"" of type '" "ostream &""'"); } arg2 = reinterpret_cast< ostream * >(argp2); (arg1)->print_freqs(*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_print_freqs(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ostream, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_print_freqs__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ostream, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_print_freqs__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_print_freqs'.\n" " Possible C/C++ prototypes are:\n" " print_freqs(EST_Ngrammar *,ostream &,double)\n" " print_freqs(EST_Ngrammar *,ostream &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_compute_backoff_weights__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_compute_backoff_weights",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (bool)(arg1)->compute_backoff_weights(arg2,arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_compute_backoff_weights__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:EST_Ngrammar_compute_backoff_weights",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (bool)(arg1)->compute_backoff_weights(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_compute_backoff_weights__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"O:EST_Ngrammar_compute_backoff_weights",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_compute_backoff_weights" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); result = (bool)(arg1)->compute_backoff_weights(); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_compute_backoff_weights(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_EST_Ngrammar_compute_backoff_weights__SWIG_2(self, args); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_compute_backoff_weights__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_EST_Ngrammar_compute_backoff_weights__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EST_Ngrammar_compute_backoff_weights'.\n" " Possible C/C++ prototypes are:\n" " compute_backoff_weights(EST_Ngrammar *,int const,int const)\n" " compute_backoff_weights(EST_Ngrammar *,int const)\n" " compute_backoff_weights(EST_Ngrammar *)\n"); return NULL; } SWIGINTERN PyObject *_wrap_EST_Ngrammar_merge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_Ngrammar *arg2 = 0 ; float arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; float val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:EST_Ngrammar_merge",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Ngrammar_merge" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Ngrammar_merge" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EST_Ngrammar_merge" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } arg2 = reinterpret_cast< EST_Ngrammar * >(argp2); ecode3 = SWIG_AsVal_float(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Ngrammar_merge" "', argument " "3"" of type '" "float""'"); } arg3 = static_cast< float >(val3); result = (bool)(arg1)->merge(*arg2,arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *EST_Ngrammar_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_EST_Ngrammar, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } SWIGINTERN PyObject *_wrap_frequency_of_frequencies__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_DVector *arg1 = 0 ; EST_Ngrammar *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:frequency_of_frequencies",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_DVector, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "frequency_of_frequencies" "', argument " "1"" of type '" "EST_DVector &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "frequency_of_frequencies" "', argument " "1"" of type '" "EST_DVector &""'"); } arg1 = reinterpret_cast< EST_DVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "frequency_of_frequencies" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "frequency_of_frequencies" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } arg2 = reinterpret_cast< EST_Ngrammar * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "frequency_of_frequencies" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); frequency_of_frequencies(*arg1,*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_frequency_of_frequencies__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_DVector *arg1 = 0 ; EST_Ngrammar *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:frequency_of_frequencies",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_DVector, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "frequency_of_frequencies" "', argument " "1"" of type '" "EST_DVector &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "frequency_of_frequencies" "', argument " "1"" of type '" "EST_DVector &""'"); } arg1 = reinterpret_cast< EST_DVector * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "frequency_of_frequencies" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "frequency_of_frequencies" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } arg2 = reinterpret_cast< EST_Ngrammar * >(argp2); frequency_of_frequencies(*arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_frequency_of_frequencies(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_DVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_frequency_of_frequencies__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_DVector, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_frequency_of_frequencies__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'frequency_of_frequencies'.\n" " Possible C/C++ prototypes are:\n" " frequency_of_frequencies(EST_DVector &,EST_Ngrammar &,int)\n" " frequency_of_frequencies(EST_DVector &,EST_Ngrammar &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_map_frequencies__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_DVector *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:map_frequencies",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "map_frequencies" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "map_frequencies" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_DVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "map_frequencies" "', argument " "2"" of type '" "EST_DVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "map_frequencies" "', argument " "2"" of type '" "EST_DVector const &""'"); } arg2 = reinterpret_cast< EST_DVector * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "map_frequencies" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); map_frequencies(*arg1,(EST_DVector const &)*arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_map_frequencies__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_DVector *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:map_frequencies",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "map_frequencies" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "map_frequencies" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_DVector, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "map_frequencies" "', argument " "2"" of type '" "EST_DVector const &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "map_frequencies" "', argument " "2"" of type '" "EST_DVector const &""'"); } arg2 = reinterpret_cast< EST_DVector * >(argp2); map_frequencies(*arg1,(EST_DVector const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_map_frequencies(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_DVector, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_map_frequencies__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_EST_DVector, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_map_frequencies__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'map_frequencies'.\n" " Possible C/C++ prototypes are:\n" " map_frequencies(EST_Ngrammar &,EST_DVector const &,int)\n" " map_frequencies(EST_Ngrammar &,EST_DVector const &)\n"); return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_smooth__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOO:Good_Turing_smooth",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Good_Turing_smooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Good_Turing_smooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Good_Turing_smooth" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Good_Turing_smooth" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (bool)Good_Turing_smooth(*arg1,arg2,arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_smooth__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OO:Good_Turing_smooth",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Good_Turing_smooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Good_Turing_smooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Good_Turing_smooth" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); result = (bool)Good_Turing_smooth(*arg1,arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_smooth(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Good_Turing_smooth__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Good_Turing_smooth__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Good_Turing_smooth'.\n" " Possible C/C++ prototypes are:\n" " Good_Turing_smooth(EST_Ngrammar &,int,int)\n" " Good_Turing_smooth(EST_Ngrammar &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_discount__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; int arg2 ; double arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; double val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:Good_Turing_discount",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Good_Turing_discount" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Good_Turing_discount" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Good_Turing_discount" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_double(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Good_Turing_discount" "', argument " "3"" of type '" "double""'"); } arg3 = static_cast< double >(val3); Good_Turing_discount(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_discount__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:Good_Turing_discount",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Good_Turing_discount" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Good_Turing_discount" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Good_Turing_discount" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); Good_Turing_discount(*arg1,arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Good_Turing_discount(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 3); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Good_Turing_discount__SWIG_1(self, args); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_double(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Good_Turing_discount__SWIG_0(self, args); } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Good_Turing_discount'.\n" " Possible C/C++ prototypes are:\n" " Good_Turing_discount(EST_Ngrammar &,int,double)\n" " Good_Turing_discount(EST_Ngrammar &,int)\n"); return NULL; } SWIGINTERN PyObject *_wrap_fs_build_backoff_ngrams(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_Ngrammar *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OO:fs_build_backoff_ngrams",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "fs_build_backoff_ngrams" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "fs_build_backoff_ngrams" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "fs_build_backoff_ngrams" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } arg2 = reinterpret_cast< EST_Ngrammar * >(argp2); fs_build_backoff_ngrams(arg1,*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_fs_backoff_smooth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = (EST_Ngrammar *) 0 ; EST_Ngrammar *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:fs_backoff_smooth",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EST_Ngrammar, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "fs_backoff_smooth" "', argument " "1"" of type '" "EST_Ngrammar *""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "fs_backoff_smooth" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "fs_backoff_smooth" "', argument " "2"" of type '" "EST_Ngrammar &""'"); } arg2 = reinterpret_cast< EST_Ngrammar * >(argp2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "fs_backoff_smooth" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); result = (int)fs_backoff_smooth(arg1,*arg2,arg3); resultobj = SWIG_From_int(static_cast< int >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_Ngram_freqsmooth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; int arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; if (!PyArg_ParseTuple(args,(char *)"OOO:Ngram_freqsmooth",&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ngram_freqsmooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Ngram_freqsmooth" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Ngram_freqsmooth" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Ngram_freqsmooth" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); Ngram_freqsmooth(*arg1,arg2,arg3); resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_test_stats__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_String *arg2 = 0 ; double *arg3 = 0 ; double *arg4 = 0 ; double *arg5 = 0 ; double *arg6 = 0 ; EST_String *arg7 = 0 ; EST_String *arg8 = 0 ; EST_String *arg9 = 0 ; EST_String *arg10 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; void *argp6 = 0 ; int res6 = 0 ; EST_String temp7 ; EST_String temp8 ; EST_String temp9 ; EST_String temp10 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:test_stats",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } if (!argp4) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } arg4 = reinterpret_cast< double * >(argp4); res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } if (!argp5) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } arg5 = reinterpret_cast< double * >(argp5); res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } if (!argp6) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } arg6 = reinterpret_cast< double * >(argp6); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj6, &str, &len); temp7 = EST_String( str, len, 0, len ); arg7 = &temp7; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj7, &str, &len); temp8 = EST_String( str, len, 0, len ); arg8 = &temp8; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj8, &str, &len); temp9 = EST_String( str, len, 0, len ); arg9 = &temp9; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj9, &str, &len); temp10 = EST_String( str, len, 0, len ); arg10 = &temp10; } result = (bool)test_stats(*arg1,(EST_String const &)*arg2,*arg3,*arg4,*arg5,*arg6,(EST_String const &)*arg7,(EST_String const &)*arg8,(EST_String const &)*arg9,(EST_String const &)*arg10); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_test_stats__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_String *arg2 = 0 ; double *arg3 = 0 ; double *arg4 = 0 ; double *arg5 = 0 ; double *arg6 = 0 ; EST_String *arg7 = 0 ; EST_String *arg8 = 0 ; EST_String *arg9 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; void *argp6 = 0 ; int res6 = 0 ; EST_String temp7 ; EST_String temp8 ; EST_String temp9 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:test_stats",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } if (!argp4) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } arg4 = reinterpret_cast< double * >(argp4); res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } if (!argp5) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } arg5 = reinterpret_cast< double * >(argp5); res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } if (!argp6) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } arg6 = reinterpret_cast< double * >(argp6); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj6, &str, &len); temp7 = EST_String( str, len, 0, len ); arg7 = &temp7; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj7, &str, &len); temp8 = EST_String( str, len, 0, len ); arg8 = &temp8; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj8, &str, &len); temp9 = EST_String( str, len, 0, len ); arg9 = &temp9; } result = (bool)test_stats(*arg1,(EST_String const &)*arg2,*arg3,*arg4,*arg5,*arg6,(EST_String const &)*arg7,(EST_String const &)*arg8,(EST_String const &)*arg9); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_test_stats__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_String *arg2 = 0 ; double *arg3 = 0 ; double *arg4 = 0 ; double *arg5 = 0 ; double *arg6 = 0 ; EST_String *arg7 = 0 ; EST_String *arg8 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; void *argp6 = 0 ; int res6 = 0 ; EST_String temp7 ; EST_String temp8 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:test_stats",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } if (!argp4) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } arg4 = reinterpret_cast< double * >(argp4); res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } if (!argp5) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } arg5 = reinterpret_cast< double * >(argp5); res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } if (!argp6) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } arg6 = reinterpret_cast< double * >(argp6); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj6, &str, &len); temp7 = EST_String( str, len, 0, len ); arg7 = &temp7; } { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj7, &str, &len); temp8 = EST_String( str, len, 0, len ); arg8 = &temp8; } result = (bool)test_stats(*arg1,(EST_String const &)*arg2,*arg3,*arg4,*arg5,*arg6,(EST_String const &)*arg7,(EST_String const &)*arg8); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_test_stats__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; EST_Ngrammar *arg1 = 0 ; EST_String *arg2 = 0 ; double *arg3 = 0 ; double *arg4 = 0 ; double *arg5 = 0 ; double *arg6 = 0 ; EST_String *arg7 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; void *argp6 = 0 ; int res6 = 0 ; EST_String temp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; bool result; if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:test_stats",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_EST_Ngrammar, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "1"" of type '" "EST_Ngrammar &""'"); } arg1 = reinterpret_cast< EST_Ngrammar * >(argp1); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj1, &str, &len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "3"" of type '" "double &""'"); } arg3 = reinterpret_cast< double * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } if (!argp4) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "4"" of type '" "double &""'"); } arg4 = reinterpret_cast< double * >(argp4); res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res5)) { SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } if (!argp5) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "5"" of type '" "double &""'"); } arg5 = reinterpret_cast< double * >(argp5); res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_double, 0 ); if (!SWIG_IsOK(res6)) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } if (!argp6) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "test_stats" "', argument " "6"" of type '" "double &""'"); } arg6 = reinterpret_cast< double * >(argp6); { char *str; Py_ssize_t len; PyString_AsStringAndSize(obj6, &str, &len); temp7 = EST_String( str, len, 0, len ); arg7 = &temp7; } result = (bool)test_stats(*arg1,(EST_String const &)*arg2,*arg3,*arg4,*arg5,*arg6,(EST_String const &)*arg7); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: return NULL; } SWIGINTERN PyObject *_wrap_test_stats(PyObject *self, PyObject *args) { int argc; PyObject *argv[11]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); for (ii = 0; (ii < argc) && (ii < 10); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 7) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_test_stats__SWIG_3(self, args); } } } } } } } } if (argc == 8) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[7], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_test_stats__SWIG_2(self, args); } } } } } } } } } if (argc == 9) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[7], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[8], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_test_stats__SWIG_1(self, args); } } } } } } } } } } if (argc == 10) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EST_Ngrammar, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_double, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[7], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[8], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[9], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_test_stats__SWIG_0(self, args); } } } } } } } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'test_stats'.\n" " Possible C/C++ prototypes are:\n" " test_stats(EST_Ngrammar &,EST_String const &,double &,double &,double &,double &,EST_String const &,EST_String const &,EST_String const &,EST_String const &)\n" " test_stats(EST_Ngrammar &,EST_String const &,double &,double &,double &,double &,EST_String const &,EST_String const &,EST_String const &)\n" " test_stats(EST_Ngrammar &,EST_String const &,double &,double &,double &,double &,EST_String const &,EST_String const &)\n" " test_stats(EST_Ngrammar &,EST_String const &,double &,double &,double &,double &,EST_String const &)\n"); return NULL; } static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { (char *)"new_EST_Ngrammar", _wrap_new_EST_Ngrammar, METH_VARARGS, NULL}, { (char *)"delete_EST_Ngrammar", _wrap_delete_EST_Ngrammar, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_clear", _wrap_EST_Ngrammar_clear, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_init", _wrap_EST_Ngrammar_init, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_num_states", _wrap_EST_Ngrammar_num_states, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_samples", _wrap_EST_Ngrammar_samples, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_order", _wrap_EST_Ngrammar_order, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_get_vocab_length", _wrap_EST_Ngrammar_get_vocab_length, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_get_vocab_word", _wrap_EST_Ngrammar_get_vocab_word, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_get_pred_vocab_length", _wrap_EST_Ngrammar_get_pred_vocab_length, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_get_pred_vocab_word", _wrap_EST_Ngrammar_get_pred_vocab_word, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_closed_vocab", _wrap_EST_Ngrammar_closed_vocab, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_entry_type", _wrap_EST_Ngrammar_entry_type, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_representation", _wrap_EST_Ngrammar_representation, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_build", _wrap_EST_Ngrammar_build, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_accumulate", _wrap_EST_Ngrammar_accumulate, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_load", _wrap_EST_Ngrammar_load, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_save", _wrap_EST_Ngrammar_save, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_wordlist_index", _wrap_EST_Ngrammar_wordlist_index, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_predlist_index", _wrap_EST_Ngrammar_predlist_index, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_set_entry_type", _wrap_EST_Ngrammar_set_entry_type, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_set_representation", _wrap_EST_Ngrammar_set_representation, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_probability", _wrap_EST_Ngrammar_probability, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_frequency", _wrap_EST_Ngrammar_frequency, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_predict", _wrap_EST_Ngrammar_predict, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_find_state_id", _wrap_EST_Ngrammar_find_state_id, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_find_next_state_id", _wrap_EST_Ngrammar_find_next_state_id, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_reverse_probability", _wrap_EST_Ngrammar_reverse_probability, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_prob_dist", _wrap_EST_Ngrammar_prob_dist, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_fill_window_start", _wrap_EST_Ngrammar_fill_window_start, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_ngram_exists", _wrap_EST_Ngrammar_ngram_exists, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_get_backoff_weight", _wrap_EST_Ngrammar_get_backoff_weight, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_set_backoff_weight", _wrap_EST_Ngrammar_set_backoff_weight, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_print_freqs", _wrap_EST_Ngrammar_print_freqs, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_compute_backoff_weights", _wrap_EST_Ngrammar_compute_backoff_weights, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_merge", _wrap_EST_Ngrammar_merge, METH_VARARGS, NULL}, { (char *)"EST_Ngrammar_swigregister", EST_Ngrammar_swigregister, METH_VARARGS, NULL}, { (char *)"frequency_of_frequencies", _wrap_frequency_of_frequencies, METH_VARARGS, NULL}, { (char *)"map_frequencies", _wrap_map_frequencies, METH_VARARGS, NULL}, { (char *)"Good_Turing_smooth", _wrap_Good_Turing_smooth, METH_VARARGS, NULL}, { (char *)"Good_Turing_discount", _wrap_Good_Turing_discount, METH_VARARGS, NULL}, { (char *)"fs_build_backoff_ngrams", _wrap_fs_build_backoff_ngrams, METH_VARARGS, NULL}, { (char *)"fs_backoff_smooth", _wrap_fs_backoff_smooth, METH_VARARGS, NULL}, { (char *)"Ngram_freqsmooth", _wrap_Ngram_freqsmooth, METH_VARARGS, NULL}, { (char *)"test_stats", _wrap_test_stats, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_DVector = {"_p_EST_DVector", "EST_DVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_DiscreteProbDistribution = {"_p_EST_DiscreteProbDistribution", "EST_DiscreteProbDistribution *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_IVector = {"_p_EST_IVector", "EST_IVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_Ngrammar = {"_p_EST_Ngrammar", "EST_Ngrammar *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_StrList = {"_p_EST_StrList", "EST_StrList *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_EST_StrVector = {"_p_EST_StrVector", "EST_StrVector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ostream = {"_p_ostream", "ostream *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_DVector, &_swigt__p_EST_DiscreteProbDistribution, &_swigt__p_EST_IVector, &_swigt__p_EST_Item, &_swigt__p_EST_Ngrammar, &_swigt__p_EST_StrList, &_swigt__p_EST_StrVector, &_swigt__p_char, &_swigt__p_double, &_swigt__p_int, &_swigt__p_ostream, }; static swig_cast_info _swigc__p_EST_DVector[] = { {&_swigt__p_EST_DVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_DiscreteProbDistribution[] = { {&_swigt__p_EST_DiscreteProbDistribution, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_IVector[] = { {&_swigt__p_EST_IVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Ngrammar[] = { {&_swigt__p_EST_Ngrammar, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_StrList[] = { {&_swigt__p_EST_StrList, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_StrVector[] = { {&_swigt__p_EST_StrVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ostream[] = { {&_swigt__p_ostream, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_DVector, _swigc__p_EST_DiscreteProbDistribution, _swigc__p_EST_IVector, _swigc__p_EST_Item, _swigc__p_EST_Ngrammar, _swigc__p_EST_StrList, _swigc__p_EST_StrVector, _swigc__p_char, _swigc__p_double, _swigc__p_int, _swigc__p_ostream, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { {0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" { #endif /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else return PyString_FromString(""); #endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; PyObject *joined; swig_globalvar *var; for (var = v->vars; var; var=var->next) { tail = PyUnicode_FromString(var->name); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; if (var->next) { tail = PyUnicode_InternFromString(", "); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; } } tail = PyUnicode_InternFromString(")"); joined = PyUnicode_Concat(str, tail); Py_DecRef(str); Py_DecRef(tail); str = joined; #else PyObject *str = PyString_FromString("("); swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); #endif return str; } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { char *tmp; PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); SWIG_Python_str_DelForPy3(tmp); Py_DECREF(str); return 0; } SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; free(var->name); free(var); var = n; } } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->get_attr)(); break; } var = var->next; } if (res == NULL && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { res = (*var->set_attr)(p); break; } var = var->next; } if (res == 1 && !PyErr_Occurred()) { PyErr_SetString(PyExc_NameError,"Unknown C global variable"); } return res; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(&PyType_Type, 0) #else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ #endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc) swig_varlink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ #endif #if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */ #endif #ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */ #endif }; varlink_type = tmp; /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ #if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; #endif type_init = 1; } return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *_SWIG_globals = 0; if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); return _SWIG_globals; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); Py_DECREF(obj); } } } /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } } #ifdef __cplusplus } #endif /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else void #endif SWIG_init(void) { PyObject *m, *d; #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, (char *) SWIG_name, NULL, -1, SwigMethods, NULL, NULL, NULL, NULL }; #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); SWIG_Python_SetConstant(d, "read_ok",SWIG_From_int(static_cast< int >(read_ok))); SWIG_Python_SetConstant(d, "read_format_error",SWIG_From_int(static_cast< int >(read_format_error))); SWIG_Python_SetConstant(d, "read_not_found_error",SWIG_From_int(static_cast< int >(read_not_found_error))); SWIG_Python_SetConstant(d, "read_error",SWIG_From_int(static_cast< int >(read_error))); SWIG_Python_SetConstant(d, "write_ok",SWIG_From_int(static_cast< int >(write_ok))); SWIG_Python_SetConstant(d, "write_fail",SWIG_From_int(static_cast< int >(write_fail))); SWIG_Python_SetConstant(d, "write_error",SWIG_From_int(static_cast< int >(write_error))); SWIG_Python_SetConstant(d, "write_partial",SWIG_From_int(static_cast< int >(write_partial))); SWIG_Python_SetConstant(d, "connect_ok",SWIG_From_int(static_cast< int >(connect_ok))); SWIG_Python_SetConstant(d, "connect_not_found_error",SWIG_From_int(static_cast< int >(connect_not_found_error))); SWIG_Python_SetConstant(d, "connect_not_allowed_error",SWIG_From_int(static_cast< int >(connect_not_allowed_error))); SWIG_Python_SetConstant(d, "connect_system_error",SWIG_From_int(static_cast< int >(connect_system_error))); SWIG_Python_SetConstant(d, "connect_error",SWIG_From_int(static_cast< int >(connect_error))); SWIG_Python_SetConstant(d, "EST_Ngrammar_sparse",SWIG_From_int(static_cast< int >(EST_Ngrammar::sparse))); SWIG_Python_SetConstant(d, "EST_Ngrammar_dense",SWIG_From_int(static_cast< int >(EST_Ngrammar::dense))); SWIG_Python_SetConstant(d, "EST_Ngrammar_backoff",SWIG_From_int(static_cast< int >(EST_Ngrammar::backoff))); SWIG_Python_SetConstant(d, "EST_Ngrammar_frequencies",SWIG_From_int(static_cast< int >(EST_Ngrammar::frequencies))); SWIG_Python_SetConstant(d, "EST_Ngrammar_log_frequencies",SWIG_From_int(static_cast< int >(EST_Ngrammar::log_frequencies))); #if PY_VERSION_HEX >= 0x03000000 return m; #else return; #endif } speech_tools/wrappers/python/EST_FVector.py0000644000076400007640000001770511352212617017514 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_FVector', [dirname(__file__)]) except ImportError: import _EST_FVector return _EST_FVector if fp is not None: try: _mod = imp.load_module('_EST_FVector', fp, pathname, description) finally: fp.close() return _mod _EST_FVector = swig_import_helper() del swig_import_helper else: import _EST_FVector del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 read_ok = _EST_FVector.read_ok read_format_error = _EST_FVector.read_format_error read_not_found_error = _EST_FVector.read_not_found_error read_error = _EST_FVector.read_error write_ok = _EST_FVector.write_ok write_fail = _EST_FVector.write_fail write_error = _EST_FVector.write_error write_partial = _EST_FVector.write_partial connect_ok = _EST_FVector.connect_ok connect_not_found_error = _EST_FVector.connect_not_found_error connect_not_allowed_error = _EST_FVector.connect_not_allowed_error connect_system_error = _EST_FVector.connect_system_error connect_error = _EST_FVector.connect_error class floatvector(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, floatvector, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, floatvector, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_FVector.new_floatvector(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_FVector.delete_floatvector __del__ = lambda self : None; def resize(self, *args): return _EST_FVector.floatvector_resize(self, *args) def num_columns(self): return _EST_FVector.floatvector_num_columns(self) def length(self): return _EST_FVector.floatvector_length(self) def n(self): return _EST_FVector.floatvector_n(self) def a_no_check(self, *args): return _EST_FVector.floatvector_a_no_check(self, *args) def a_no_check_1(self, *args): return _EST_FVector.floatvector_a_no_check_1(self, *args) def a_check(self, *args): return _EST_FVector.floatvector_a_check(self, *args) def a(self, *args): return _EST_FVector.floatvector_a(self, *args) def fill(self, *args): return _EST_FVector.floatvector_fill(self, *args) def empty(self): return _EST_FVector.floatvector_empty(self) def __eq__(self, *args): return _EST_FVector.floatvector___eq__(self, *args) def __ne__(self, *args): return _EST_FVector.floatvector___ne__(self, *args) def __setitem__(self, *args): return _EST_FVector.floatvector___setitem__(self, *args) def __getitem__(self, *args): return _EST_FVector.floatvector___getitem__(self, *args) def copy_section(self, *args): return _EST_FVector.floatvector_copy_section(self, *args) def set_section(self, *args): return _EST_FVector.floatvector_set_section(self, *args) floatvector_swigregister = _EST_FVector.floatvector_swigregister floatvector_swigregister(floatvector) class floatsimplevector(floatvector): __swig_setmethods__ = {} for _s in [floatvector]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) __setattr__ = lambda self, name, value: _swig_setattr(self, floatsimplevector, name, value) __swig_getmethods__ = {} for _s in [floatvector]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, floatsimplevector, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_FVector.new_floatsimplevector(*args) try: self.this.append(this) except: self.this = this def resize(self, *args): return _EST_FVector.floatsimplevector_resize(self, *args) def copy_section(self, *args): return _EST_FVector.floatsimplevector_copy_section(self, *args) def set_section(self, *args): return _EST_FVector.floatsimplevector_set_section(self, *args) def zero(self): return _EST_FVector.floatsimplevector_zero(self) def empty(self): return _EST_FVector.floatsimplevector_empty(self) __swig_destroy__ = _EST_FVector.delete_floatsimplevector __del__ = lambda self : None; floatsimplevector_swigregister = _EST_FVector.floatsimplevector_swigregister floatsimplevector_swigregister(floatsimplevector) class EST_FVector(floatsimplevector): __swig_setmethods__ = {} for _s in [floatsimplevector]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) __setattr__ = lambda self, name, value: _swig_setattr(self, EST_FVector, name, value) __swig_getmethods__ = {} for _s in [floatsimplevector]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, EST_FVector, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_FVector.new_EST_FVector(*args) try: self.this.append(this) except: self.this = this def __iadd__(self, *args): return _EST_FVector.EST_FVector___iadd__(self, *args) def __imul__(self, *args): return _EST_FVector.EST_FVector___imul__(self, *args) def __idiv__(self, *args): return _EST_FVector.EST_FVector___idiv__(self, *args) def est_save(self, *args): return _EST_FVector.EST_FVector_est_save(self, *args) def save(self, *args): return _EST_FVector.EST_FVector_save(self, *args) def load(self, *args): return _EST_FVector.EST_FVector_load(self, *args) def est_load(self, *args): return _EST_FVector.EST_FVector_est_load(self, *args) def randomise(self, *args): return _EST_FVector.EST_FVector_randomise(self, *args) def sum(self): return _EST_FVector.EST_FVector_sum(self) __swig_destroy__ = _EST_FVector.delete_EST_FVector __del__ = lambda self : None; EST_FVector_swigregister = _EST_FVector.EST_FVector_swigregister EST_FVector_swigregister(EST_FVector) def add(*args): return _EST_FVector.add(*args) add = _EST_FVector.add def subtract(*args): return _EST_FVector.subtract(*args) subtract = _EST_FVector.subtract def sqrt(*args): return _EST_FVector.sqrt(*args) sqrt = _EST_FVector.sqrt def topower(*args): return _EST_FVector.topower(*args) topower = _EST_FVector.topower def polynomial_value(*args): return _EST_FVector.polynomial_value(*args) polynomial_value = _EST_FVector.polynomial_value def polynomial_fit(*args): return _EST_FVector.polynomial_fit(*args) polynomial_fit = _EST_FVector.polynomial_fit speech_tools/wrappers/python/EST_Wave.py0000644000076400007640000001624111352212620017032 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Wave', [dirname(__file__)]) except ImportError: import _EST_Wave return _EST_Wave if fp is not None: try: _mod = imp.load_module('_EST_Wave', fp, pathname, description) finally: fp.close() return _mod _EST_Wave = swig_import_helper() del swig_import_helper else: import _EST_Wave del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 read_ok = _EST_Wave.read_ok read_format_error = _EST_Wave.read_format_error read_not_found_error = _EST_Wave.read_not_found_error read_error = _EST_Wave.read_error write_ok = _EST_Wave.write_ok write_fail = _EST_Wave.write_fail write_error = _EST_Wave.write_error write_partial = _EST_Wave.write_partial connect_ok = _EST_Wave.connect_ok connect_not_found_error = _EST_Wave.connect_not_found_error connect_not_allowed_error = _EST_Wave.connect_not_allowed_error connect_system_error = _EST_Wave.connect_system_error connect_error = _EST_Wave.connect_error class EST_Wave(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Wave, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Wave, name) __repr__ = _swig_repr __swig_getmethods__["default_sample_rate"] = _EST_Wave.EST_Wave_default_sample_rate_get if _newclass:default_sample_rate = _swig_property(_EST_Wave.EST_Wave_default_sample_rate_get) def __init__(self, *args): this = _EST_Wave.new_EST_Wave(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Wave.delete_EST_Wave __del__ = lambda self : None; def a(self, *args): return _EST_Wave.EST_Wave_a(self, *args) def a_safe(self, *args): return _EST_Wave.EST_Wave_a_safe(self, *args) def set_a(self, *args): return _EST_Wave.EST_Wave_set_a(self, *args) def t(self, *args): return _EST_Wave.EST_Wave_t(self, *args) def num_samples(self): return _EST_Wave.EST_Wave_num_samples(self) def num_channels(self): return _EST_Wave.EST_Wave_num_channels(self) def sample_rate(self): return _EST_Wave.EST_Wave_sample_rate(self) def set_sample_rate(self, *args): return _EST_Wave.EST_Wave_set_sample_rate(self, *args) def length(self): return _EST_Wave.EST_Wave_length(self) def end(self): return _EST_Wave.EST_Wave_end(self) def have_left_context(self, *args): return _EST_Wave.EST_Wave_have_left_context(self, *args) def sample_type(self): return _EST_Wave.EST_Wave_sample_type(self) def set_sample_type(self, *args): return _EST_Wave.EST_Wave_set_sample_type(self, *args) def file_type(self): return _EST_Wave.EST_Wave_file_type(self) def set_file_type(self, *args): return _EST_Wave.EST_Wave_set_file_type(self, *args) def name(self): return _EST_Wave.EST_Wave_name(self) def set_name(self, *args): return _EST_Wave.EST_Wave_set_name(self, *args) def resize(self, *args): return _EST_Wave.EST_Wave_resize(self, *args) def resample(self, *args): return _EST_Wave.EST_Wave_resample(self, *args) def rescale(self, *args): return _EST_Wave.EST_Wave_rescale(self, *args) def clear(self): return _EST_Wave.EST_Wave_clear(self) def copy(self, *args): return _EST_Wave.EST_Wave_copy(self, *args) def fill(self, *args): return _EST_Wave.EST_Wave_fill(self, *args) def empty(self, *args): return _EST_Wave.EST_Wave_empty(self, *args) def load(self, *args): return _EST_Wave.EST_Wave_load(self, *args) def load_file(self, *args): return _EST_Wave.EST_Wave_load_file(self, *args) def save(self, *args): return _EST_Wave.EST_Wave_save(self, *args) def save_file(self, *args): return _EST_Wave.EST_Wave_save_file(self, *args) def integrity(self): return _EST_Wave.EST_Wave_integrity(self) def info(self): return _EST_Wave.EST_Wave_info(self) def play(self): return _EST_Wave.EST_Wave_play(self) EST_Wave_swigregister = _EST_Wave.EST_Wave_swigregister EST_Wave_swigregister(EST_Wave) def wave_extract_channel(*args): return _EST_Wave.wave_extract_channel(*args) wave_extract_channel = _EST_Wave.wave_extract_channel def wave_combine_channels(*args): return _EST_Wave.wave_combine_channels(*args) wave_combine_channels = _EST_Wave.wave_combine_channels def wave_subwave(*args): return _EST_Wave.wave_subwave(*args) wave_subwave = _EST_Wave.wave_subwave def wave_divide(*args): return _EST_Wave.wave_divide(*args) wave_divide = _EST_Wave.wave_divide def wave_extract(*args): return _EST_Wave.wave_extract(*args) wave_extract = _EST_Wave.wave_extract def add_waves(*args): return _EST_Wave.add_waves(*args) add_waves = _EST_Wave.add_waves def difference(*args): return _EST_Wave.difference(*args) difference = _EST_Wave.difference def error(*args): return _EST_Wave.error(*args) error = _EST_Wave.error def absolute(*args): return _EST_Wave.absolute(*args) absolute = _EST_Wave.absolute def wave_info(*args): return _EST_Wave.wave_info(*args) wave_info = _EST_Wave.wave_info def invert(*args): return _EST_Wave.invert(*args) invert = _EST_Wave.invert def differentiate(*args): return _EST_Wave.differentiate(*args) differentiate = _EST_Wave.differentiate def reverse(*args): return _EST_Wave.reverse(*args) reverse = _EST_Wave.reverse def rms_error(*args): return _EST_Wave.rms_error(*args) rms_error = _EST_Wave.rms_error def abs_error(*args): return _EST_Wave.abs_error(*args) abs_error = _EST_Wave.abs_error def correlation(*args): return _EST_Wave.correlation(*args) correlation = _EST_Wave.correlation speech_tools/wrappers/python/EST_Track.py0000644000076400007640000002026211352212620017172 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Track', [dirname(__file__)]) except ImportError: import _EST_Track return _EST_Track if fp is not None: try: _mod = imp.load_module('_EST_Track', fp, pathname, description) finally: fp.close() return _mod _EST_Track = swig_import_helper() del swig_import_helper else: import _EST_Track del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 read_ok = _EST_Track.read_ok read_format_error = _EST_Track.read_format_error read_not_found_error = _EST_Track.read_not_found_error read_error = _EST_Track.read_error write_ok = _EST_Track.write_ok write_fail = _EST_Track.write_fail write_error = _EST_Track.write_error write_partial = _EST_Track.write_partial connect_ok = _EST_Track.connect_ok connect_not_found_error = _EST_Track.connect_not_found_error connect_not_allowed_error = _EST_Track.connect_not_allowed_error connect_system_error = _EST_Track.connect_system_error connect_error = _EST_Track.connect_error import EST_FVector class EST_Track(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Track, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Track, name) __repr__ = _swig_repr __swig_getmethods__["default_frame_shift"] = _EST_Track.EST_Track_default_frame_shift_get if _newclass:default_frame_shift = _swig_property(_EST_Track.EST_Track_default_frame_shift_get) __swig_getmethods__["default_sample_rate"] = _EST_Track.EST_Track_default_sample_rate_get if _newclass:default_sample_rate = _swig_property(_EST_Track.EST_Track_default_sample_rate_get) def __init__(self, *args): this = _EST_Track.new_EST_Track(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Track.delete_EST_Track __del__ = lambda self : None; def resize(self, *args): return _EST_Track.EST_Track_resize(self, *args) def set_num_channels(self, *args): return _EST_Track.EST_Track_set_num_channels(self, *args) def set_num_frames(self, *args): return _EST_Track.EST_Track_set_num_frames(self, *args) def set_channel_name(self, *args): return _EST_Track.EST_Track_set_channel_name(self, *args) def set_aux_channel_name(self, *args): return _EST_Track.EST_Track_set_aux_channel_name(self, *args) def copy_setup(self, *args): return _EST_Track.EST_Track_copy_setup(self, *args) def name(self): return _EST_Track.EST_Track_name(self) def set_name(self, *args): return _EST_Track.EST_Track_set_name(self, *args) def frame(self, *args): return _EST_Track.EST_Track_frame(self, *args) def channel(self, *args): return _EST_Track.EST_Track_channel(self, *args) def sub_track(self, *args): return _EST_Track.EST_Track_sub_track(self, *args) def copy_sub_track(self, *args): return _EST_Track.EST_Track_copy_sub_track(self, *args) def copy_sub_track_out(self, *args): return _EST_Track.EST_Track_copy_sub_track_out(self, *args) def copy_channel_out(self, *args): return _EST_Track.EST_Track_copy_channel_out(self, *args) def copy_frame_out(self, *args): return _EST_Track.EST_Track_copy_frame_out(self, *args) def copy_channel_in(self, *args): return _EST_Track.EST_Track_copy_channel_in(self, *args) def copy_frame_in(self, *args): return _EST_Track.EST_Track_copy_frame_in(self, *args) def channel_position(self, *args): return _EST_Track.EST_Track_channel_position(self, *args) def has_channel(self, *args): return _EST_Track.EST_Track_has_channel(self, *args) def a(self, *args): return _EST_Track.EST_Track_a(self, *args) def t(self, i = 0): return _EST_Track.EST_Track_t(self, i) def ms_t(self, *args): return _EST_Track.EST_Track_ms_t(self, *args) def fill_time(self, *args): return _EST_Track.EST_Track_fill_time(self, *args) def fill(self, *args): return _EST_Track.EST_Track_fill(self, *args) def sample(self, *args): return _EST_Track.EST_Track_sample(self, *args) def shift(self): return _EST_Track.EST_Track_shift(self) def start(self): return _EST_Track.EST_Track_start(self) def end(self): return _EST_Track.EST_Track_end(self) def load(self, *args): return _EST_Track.EST_Track_load(self, *args) def save(self, *args): return _EST_Track.EST_Track_save(self, *args) def set_break(self, *args): return _EST_Track.EST_Track_set_break(self, *args) def set_value(self, *args): return _EST_Track.EST_Track_set_value(self, *args) def val(self, *args): return _EST_Track.EST_Track_val(self, *args) def track_break(self, *args): return _EST_Track.EST_Track_track_break(self, *args) def prev_non_break(self, *args): return _EST_Track.EST_Track_prev_non_break(self, *args) def next_non_break(self, *args): return _EST_Track.EST_Track_next_non_break(self, *args) def empty(self): return _EST_Track.EST_Track_empty(self) def index(self, *args): return _EST_Track.EST_Track_index(self, *args) def index_below(self, *args): return _EST_Track.EST_Track_index_below(self, *args) def num_frames(self): return _EST_Track.EST_Track_num_frames(self) def length(self): return _EST_Track.EST_Track_length(self) def num_channels(self): return _EST_Track.EST_Track_num_channels(self) def num_aux_channels(self): return _EST_Track.EST_Track_num_aux_channels(self) def equal_space(self): return _EST_Track.EST_Track_equal_space(self) def single_break(self): return _EST_Track.EST_Track_single_break(self) def set_equal_space(self, *args): return _EST_Track.EST_Track_set_equal_space(self, *args) def set_single_break(self, *args): return _EST_Track.EST_Track_set_single_break(self, *args) def __iadd__(self, *args): return _EST_Track.EST_Track___iadd__(self, *args) def __ior__(self, *args): return _EST_Track.EST_Track___ior__(self, *args) def load_channel_names(self, *args): return _EST_Track.EST_Track_load_channel_names(self, *args) def save_channel_names(self, *args): return _EST_Track.EST_Track_save_channel_names(self, *args) def channel_name(self, *args): return _EST_Track.EST_Track_channel_name(self, *args) def aux_channel_name(self, *args): return _EST_Track.EST_Track_aux_channel_name(self, *args) EST_Track_swigregister = _EST_Track.EST_Track_swigregister EST_Track_swigregister(EST_Track) def mean(*args): return _EST_Track.mean(*args) mean = _EST_Track.mean def meansd(*args): return _EST_Track.meansd(*args) meansd = _EST_Track.meansd def normalise(*args): return _EST_Track.normalise(*args) normalise = _EST_Track.normalise speech_tools/wrappers/python/EST_SignalProc.py0000644000076400007640000001066611332265740020207 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_SignalProc', [dirname(__file__)]) except ImportError: import _EST_SignalProc return _EST_SignalProc if fp is not None: try: _mod = imp.load_module('_EST_SignalProc', fp, pathname, description) finally: fp.close() return _mod _EST_SignalProc = swig_import_helper() del swig_import_helper else: import _EST_SignalProc del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 import EST_Wave def FIR_double_filter(*args): return _EST_SignalProc.FIR_double_filter(*args) FIR_double_filter = _EST_SignalProc.FIR_double_filter def lpc_filter(*args): return _EST_SignalProc.lpc_filter(*args) lpc_filter = _EST_SignalProc.lpc_filter def inv_lpc_filter(*args): return _EST_SignalProc.inv_lpc_filter(*args) inv_lpc_filter = _EST_SignalProc.inv_lpc_filter def lpc_filter_1(*args): return _EST_SignalProc.lpc_filter_1(*args) lpc_filter_1 = _EST_SignalProc.lpc_filter_1 def lpc_filter_fast(*args): return _EST_SignalProc.lpc_filter_fast(*args) lpc_filter_fast = _EST_SignalProc.lpc_filter_fast def inv_lpc_filter_ola(*args): return _EST_SignalProc.inv_lpc_filter_ola(*args) inv_lpc_filter_ola = _EST_SignalProc.inv_lpc_filter_ola def simple_mean_smooth(*args): return _EST_SignalProc.simple_mean_smooth(*args) simple_mean_smooth = _EST_SignalProc.simple_mean_smooth def design_FIR_filter(*args): return _EST_SignalProc.design_FIR_filter(*args) design_FIR_filter = _EST_SignalProc.design_FIR_filter def design_lowpass_FIR_filter(*args): return _EST_SignalProc.design_lowpass_FIR_filter(*args) design_lowpass_FIR_filter = _EST_SignalProc.design_lowpass_FIR_filter def design_highpass_FIR_filter(*args): return _EST_SignalProc.design_highpass_FIR_filter(*args) design_highpass_FIR_filter = _EST_SignalProc.design_highpass_FIR_filter def FIRfilter(*args): return _EST_SignalProc.FIRfilter(*args) FIRfilter = _EST_SignalProc.FIRfilter def FIRlowpass_filter(*args): return _EST_SignalProc.FIRlowpass_filter(*args) FIRlowpass_filter = _EST_SignalProc.FIRlowpass_filter def FIRhighpass_filter(*args): return _EST_SignalProc.FIRhighpass_filter(*args) FIRhighpass_filter = _EST_SignalProc.FIRhighpass_filter def FIRhighpass_double_filter(*args): return _EST_SignalProc.FIRhighpass_double_filter(*args) FIRhighpass_double_filter = _EST_SignalProc.FIRhighpass_double_filter def FIRlowpass_double_filter(*args): return _EST_SignalProc.FIRlowpass_double_filter(*args) FIRlowpass_double_filter = _EST_SignalProc.FIRlowpass_double_filter def pre_emphasis(*args): return _EST_SignalProc.pre_emphasis(*args) pre_emphasis = _EST_SignalProc.pre_emphasis def post_emphasis(*args): return _EST_SignalProc.post_emphasis(*args) post_emphasis = _EST_SignalProc.post_emphasis speech_tools/wrappers/python/EST_pitchmark.py0000644000076400007640000000537211332265740020126 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_pitchmark', [dirname(__file__)]) except ImportError: import _EST_pitchmark return _EST_pitchmark if fp is not None: try: _mod = imp.load_module('_EST_pitchmark', fp, pathname, description) finally: fp.close() return _mod _EST_pitchmark = swig_import_helper() del swig_import_helper else: import _EST_pitchmark del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 import EST_Wave import EST_Track import EST_FVector def neg_zero_cross_pick(*args): return _EST_pitchmark.neg_zero_cross_pick(*args) neg_zero_cross_pick = _EST_pitchmark.neg_zero_cross_pick def pm_fill(*args): return _EST_pitchmark.pm_fill(*args) pm_fill = _EST_pitchmark.pm_fill def pm_min_check(*args): return _EST_pitchmark.pm_min_check(*args) pm_min_check = _EST_pitchmark.pm_min_check def pitchmark(*args): return _EST_pitchmark.pitchmark(*args) pitchmark = _EST_pitchmark.pitchmark def pm_to_f0(*args): return _EST_pitchmark.pm_to_f0(*args) pm_to_f0 = _EST_pitchmark.pm_to_f0 speech_tools/wrappers/python/EST_Utterance.py0000644000076400007640000001071211332265740020070 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Utterance', [dirname(__file__)]) except ImportError: import _EST_Utterance return _EST_Utterance if fp is not None: try: _mod = imp.load_module('_EST_Utterance', fp, pathname, description) finally: fp.close() return _mod _EST_Utterance = swig_import_helper() del swig_import_helper else: import _EST_Utterance del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 import EST_Item import EST_Relation class EST_Utterance(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Utterance, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Utterance, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_Utterance.new_EST_Utterance(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Utterance.delete_EST_Utterance __del__ = lambda self : None; def init(self): return _EST_Utterance.EST_Utterance_init(self) def clear(self): return _EST_Utterance.EST_Utterance_clear(self) def clear_relations(self): return _EST_Utterance.EST_Utterance_clear_relations(self) def set_highest_id(self, *args): return _EST_Utterance.EST_Utterance_set_highest_id(self, *args) def next_id(self): return _EST_Utterance.EST_Utterance_next_id(self) def load(self, *args): return _EST_Utterance.EST_Utterance_load(self, *args) def save(self, *args): return _EST_Utterance.EST_Utterance_save(self, *args) def evaluate_all_features(self): return _EST_Utterance.EST_Utterance_evaluate_all_features(self) def num_relations(self): return _EST_Utterance.EST_Utterance_num_relations(self) def relation_present(self, *args): return _EST_Utterance.EST_Utterance_relation_present(self, *args) def relation(self, *args): return _EST_Utterance.EST_Utterance_relation(self, *args) def id(self, *args): return _EST_Utterance.EST_Utterance_id(self, *args) def create_relation(self, *args): return _EST_Utterance.EST_Utterance_create_relation(self, *args) def remove_relation(self, *args): return _EST_Utterance.EST_Utterance_remove_relation(self, *args) def sub_utterance(self, *args): return _EST_Utterance.EST_Utterance_sub_utterance(self, *args) EST_Utterance_swigregister = _EST_Utterance.EST_Utterance_swigregister EST_Utterance_swigregister(EST_Utterance) def sub_utterance(*args): return _EST_Utterance.sub_utterance(*args) sub_utterance = _EST_Utterance.sub_utterance def get_utt(*args): return _EST_Utterance.get_utt(*args) get_utt = _EST_Utterance.get_utt def utterance_merge(*args): return _EST_Utterance.utterance_merge(*args) utterance_merge = _EST_Utterance.utterance_merge speech_tools/wrappers/python/EST_Relation.py0000644000076400007640000001206411352212620017704 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Relation', [dirname(__file__)]) except ImportError: import _EST_Relation return _EST_Relation if fp is not None: try: _mod = imp.load_module('_EST_Relation', fp, pathname, description) finally: fp.close() return _mod _EST_Relation = swig_import_helper() del swig_import_helper else: import _EST_Relation del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 read_ok = _EST_Relation.read_ok read_format_error = _EST_Relation.read_format_error read_not_found_error = _EST_Relation.read_not_found_error read_error = _EST_Relation.read_error write_ok = _EST_Relation.write_ok write_fail = _EST_Relation.write_fail write_error = _EST_Relation.write_error write_partial = _EST_Relation.write_partial connect_ok = _EST_Relation.connect_ok connect_not_found_error = _EST_Relation.connect_not_found_error connect_not_allowed_error = _EST_Relation.connect_not_allowed_error connect_system_error = _EST_Relation.connect_system_error connect_error = _EST_Relation.connect_error import EST_Item class EST_Relation(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Relation, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Relation, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_Relation.new_EST_Relation(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Relation.delete_EST_Relation __del__ = lambda self : None; def load(self, *args): return _EST_Relation.EST_Relation_load(self, *args) def save(self, *args): return _EST_Relation.EST_Relation_save(self, *args) def evaluate_item_features(self): return _EST_Relation.EST_Relation_evaluate_item_features(self) def clear(self): return _EST_Relation.EST_Relation_clear(self) def utt(self): return _EST_Relation.EST_Relation_utt(self) def set_utt(self, *args): return _EST_Relation.EST_Relation_set_utt(self, *args) def name(self): return _EST_Relation.EST_Relation_name(self) def head(self): return _EST_Relation.EST_Relation_head(self) def root(self): return _EST_Relation.EST_Relation_root(self) def tail(self): return _EST_Relation.EST_Relation_tail(self) def first(self): return _EST_Relation.EST_Relation_first(self) def first_leaf(self): return _EST_Relation.EST_Relation_first_leaf(self) def last(self): return _EST_Relation.EST_Relation_last(self) def last_leaf(self): return _EST_Relation.EST_Relation_last_leaf(self) def append(self, *args): return _EST_Relation.EST_Relation_append(self, *args) def prepend(self, *args): return _EST_Relation.EST_Relation_prepend(self, *args) def length(self): return _EST_Relation.EST_Relation_length(self) def empty(self): return _EST_Relation.EST_Relation_empty(self) def remove_item(self, *args): return _EST_Relation.EST_Relation_remove_item(self, *args) def remove_item_feature(self, *args): return _EST_Relation.EST_Relation_remove_item_feature(self, *args) def items(self): return _EST_Relation.EST_Relation_items(self) EST_Relation_swigregister = _EST_Relation.EST_Relation_swigregister EST_Relation_swigregister(EST_Relation) def copy_relation(*args): return _EST_Relation.copy_relation(*args) copy_relation = _EST_Relation.copy_relation speech_tools/wrappers/python/EST_Item.py0000644000076400007640000001271311352212617017034 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Item', [dirname(__file__)]) except ImportError: import _EST_Item return _EST_Item if fp is not None: try: _mod = imp.load_module('_EST_Item', fp, pathname, description) finally: fp.close() return _mod _EST_Item = swig_import_helper() del swig_import_helper else: import _EST_Item del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 class EST_Item(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Item, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Item, name) __repr__ = _swig_repr def __init__(self, *args): this = _EST_Item.new_EST_Item(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Item.delete_EST_Item __del__ = lambda self : None; def F(self, *args): return _EST_Item.EST_Item_F(self, *args) def S(self, *args): return _EST_Item.EST_Item_S(self, *args) def I(self, *args): return _EST_Item.EST_Item_I(self, *args) def A(self, *args): return _EST_Item.EST_Item_A(self, *args) def set(self, *args): return _EST_Item.EST_Item_set(self, *args) def set_function(self, *args): return _EST_Item.EST_Item_set_function(self, *args) def f_remove(self, *args): return _EST_Item.EST_Item_f_remove(self, *args) def evaluate_features(self): return _EST_Item.EST_Item_evaluate_features(self) def f_present(self, *args): return _EST_Item.EST_Item_f_present(self, *args) def length(self): return _EST_Item.EST_Item_length(self) def as_relation(self, *args): return _EST_Item.EST_Item_as_relation(self, *args) def in_relation(self, *args): return _EST_Item.EST_Item_in_relation(self, *args) def relation_name(self): return _EST_Item.EST_Item_relation_name(self) def relation(self): return _EST_Item.EST_Item_relation(self) def same_item(self, *args): return _EST_Item.EST_Item_same_item(self, *args) def unref_all(self): return _EST_Item.EST_Item_unref_all(self) def prepend_daughter(self, *args): return _EST_Item.EST_Item_prepend_daughter(self, *args) def append_daughter(self, *args): return _EST_Item.EST_Item_append_daughter(self, *args) def daughter1(self): return _EST_Item.EST_Item_daughter1(self) def daughtern(self): return _EST_Item.EST_Item_daughtern(self) def next_sibling(self): return _EST_Item.EST_Item_next_sibling(self) def prev_sibling(self): return _EST_Item.EST_Item_prev_sibling(self) def parent(self): return _EST_Item.EST_Item_parent(self) def features(self): return _EST_Item.EST_Item_features(self) def leafs(self): return _EST_Item.EST_Item_leafs(self) def daughters(self): return _EST_Item.EST_Item_daughters(self) EST_Item_swigregister = _EST_Item.EST_Item_swigregister EST_Item_swigregister(EST_Item) def next_item(*args): return _EST_Item.next_item(*args) next_item = _EST_Item.next_item def first_leaf(*args): return _EST_Item.first_leaf(*args) first_leaf = _EST_Item.first_leaf def last_leaf(*args): return _EST_Item.last_leaf(*args) last_leaf = _EST_Item.last_leaf def next_leaf(*args): return _EST_Item.next_leaf(*args) next_leaf = _EST_Item.next_leaf def num_leaves(*args): return _EST_Item.num_leaves(*args) num_leaves = _EST_Item.num_leaves def remove_item(*args): return _EST_Item.remove_item(*args) remove_item = _EST_Item.remove_item def copy_node_tree(*args): return _EST_Item.copy_node_tree(*args) copy_node_tree = _EST_Item.copy_node_tree def copy_node_tree_contents(*args): return _EST_Item.copy_node_tree_contents(*args) copy_node_tree_contents = _EST_Item.copy_node_tree_contents def item_jump(*args): return _EST_Item.item_jump(*args) item_jump = _EST_Item.item_jump speech_tools/wrappers/python/EST_Ngrammar.py0000644000076400007640000001737411352212620017704 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_EST_Ngrammar', [dirname(__file__)]) except ImportError: import _EST_Ngrammar return _EST_Ngrammar if fp is not None: try: _mod = imp.load_module('_EST_Ngrammar', fp, pathname, description) finally: fp.close() return _mod _EST_Ngrammar = swig_import_helper() del swig_import_helper else: import _EST_Ngrammar del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 read_ok = _EST_Ngrammar.read_ok read_format_error = _EST_Ngrammar.read_format_error read_not_found_error = _EST_Ngrammar.read_not_found_error read_error = _EST_Ngrammar.read_error write_ok = _EST_Ngrammar.write_ok write_fail = _EST_Ngrammar.write_fail write_error = _EST_Ngrammar.write_error write_partial = _EST_Ngrammar.write_partial connect_ok = _EST_Ngrammar.connect_ok connect_not_found_error = _EST_Ngrammar.connect_not_found_error connect_not_allowed_error = _EST_Ngrammar.connect_not_allowed_error connect_system_error = _EST_Ngrammar.connect_system_error connect_error = _EST_Ngrammar.connect_error class EST_Ngrammar(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EST_Ngrammar, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, EST_Ngrammar, name) __repr__ = _swig_repr sparse = _EST_Ngrammar.EST_Ngrammar_sparse dense = _EST_Ngrammar.EST_Ngrammar_dense backoff = _EST_Ngrammar.EST_Ngrammar_backoff frequencies = _EST_Ngrammar.EST_Ngrammar_frequencies log_frequencies = _EST_Ngrammar.EST_Ngrammar_log_frequencies def __init__(self, *args): this = _EST_Ngrammar.new_EST_Ngrammar(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _EST_Ngrammar.delete_EST_Ngrammar __del__ = lambda self : None; def clear(self): return _EST_Ngrammar.EST_Ngrammar_clear(self) def init(self, *args): return _EST_Ngrammar.EST_Ngrammar_init(self, *args) def num_states(self): return _EST_Ngrammar.EST_Ngrammar_num_states(self) def samples(self): return _EST_Ngrammar.EST_Ngrammar_samples(self) def order(self): return _EST_Ngrammar.EST_Ngrammar_order(self) def get_vocab_length(self): return _EST_Ngrammar.EST_Ngrammar_get_vocab_length(self) def get_vocab_word(self, *args): return _EST_Ngrammar.EST_Ngrammar_get_vocab_word(self, *args) def get_pred_vocab_length(self): return _EST_Ngrammar.EST_Ngrammar_get_pred_vocab_length(self) def get_pred_vocab_word(self, *args): return _EST_Ngrammar.EST_Ngrammar_get_pred_vocab_word(self, *args) def closed_vocab(self): return _EST_Ngrammar.EST_Ngrammar_closed_vocab(self) def entry_type(self): return _EST_Ngrammar.EST_Ngrammar_entry_type(self) def representation(self): return _EST_Ngrammar.EST_Ngrammar_representation(self) def build(self, *args): return _EST_Ngrammar.EST_Ngrammar_build(self, *args) def accumulate(self, *args): return _EST_Ngrammar.EST_Ngrammar_accumulate(self, *args) def load(self, *args): return _EST_Ngrammar.EST_Ngrammar_load(self, *args) def save(self, *args): return _EST_Ngrammar.EST_Ngrammar_save(self, *args) def wordlist_index(self, *args): return _EST_Ngrammar.EST_Ngrammar_wordlist_index(self, *args) def predlist_index(self, *args): return _EST_Ngrammar.EST_Ngrammar_predlist_index(self, *args) def set_entry_type(self, *args): return _EST_Ngrammar.EST_Ngrammar_set_entry_type(self, *args) def set_representation(self, *args): return _EST_Ngrammar.EST_Ngrammar_set_representation(self, *args) def probability(self, *args): return _EST_Ngrammar.EST_Ngrammar_probability(self, *args) def frequency(self, *args): return _EST_Ngrammar.EST_Ngrammar_frequency(self, *args) def predict(self, *args): return _EST_Ngrammar.EST_Ngrammar_predict(self, *args) def find_state_id(self, *args): return _EST_Ngrammar.EST_Ngrammar_find_state_id(self, *args) def find_next_state_id(self, *args): return _EST_Ngrammar.EST_Ngrammar_find_next_state_id(self, *args) def reverse_probability(self, *args): return _EST_Ngrammar.EST_Ngrammar_reverse_probability(self, *args) def prob_dist(self, *args): return _EST_Ngrammar.EST_Ngrammar_prob_dist(self, *args) def fill_window_start(self, *args): return _EST_Ngrammar.EST_Ngrammar_fill_window_start(self, *args) def ngram_exists(self, *args): return _EST_Ngrammar.EST_Ngrammar_ngram_exists(self, *args) def get_backoff_weight(self, *args): return _EST_Ngrammar.EST_Ngrammar_get_backoff_weight(self, *args) def set_backoff_weight(self, *args): return _EST_Ngrammar.EST_Ngrammar_set_backoff_weight(self, *args) def print_freqs(self, *args): return _EST_Ngrammar.EST_Ngrammar_print_freqs(self, *args) def compute_backoff_weights(self, mincount = 1, maxcount = 10): return _EST_Ngrammar.EST_Ngrammar_compute_backoff_weights(self, mincount, maxcount) def merge(self, *args): return _EST_Ngrammar.EST_Ngrammar_merge(self, *args) EST_Ngrammar_swigregister = _EST_Ngrammar.EST_Ngrammar_swigregister EST_Ngrammar_swigregister(EST_Ngrammar) def fs_build_backoff_ngrams(*args): return _EST_Ngrammar.fs_build_backoff_ngrams(*args) fs_build_backoff_ngrams = _EST_Ngrammar.fs_build_backoff_ngrams def fs_backoff_smooth(*args): return _EST_Ngrammar.fs_backoff_smooth(*args) fs_backoff_smooth = _EST_Ngrammar.fs_backoff_smooth def Ngram_freqsmooth(*args): return _EST_Ngrammar.Ngram_freqsmooth(*args) Ngram_freqsmooth = _EST_Ngrammar.Ngram_freqsmooth def frequency_of_frequencies(*args): return _EST_Ngrammar.frequency_of_frequencies(*args) frequency_of_frequencies = _EST_Ngrammar.frequency_of_frequencies def map_frequencies(*args): return _EST_Ngrammar.map_frequencies(*args) map_frequencies = _EST_Ngrammar.map_frequencies def Good_Turing_smooth(*args): return _EST_Ngrammar.Good_Turing_smooth(*args) Good_Turing_smooth = _EST_Ngrammar.Good_Turing_smooth def Good_Turing_discount(*args): return _EST_Ngrammar.Good_Turing_discount(*args) Good_Turing_discount = _EST_Ngrammar.Good_Turing_discount def test_stats(*args): return _EST_Ngrammar.test_stats(*args) test_stats = _EST_Ngrammar.test_stats speech_tools/wrappers/perl5/Makefile0000644000076400007640000001062510570317747016232 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 2003 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Author : Korin Richmond # # Date : April 2003 # #-------------------------------------------------------------------------# # Makefile for perl bindings to speech tools # # # #=========================================================================# TOP=../.. DIRNAME=wrappers/perl5 WRAPPERS = EST_Utterance.i EST_Relation.i EST_Item.i \ EST_Wave.i EST_Track.i WRAPPER_SRCS = $(WRAPPERS:.i=_wrap.cc) OBJS = $(WRAPPER_SRCS:.cc=.o) ALL_WRAPPERS = $(WRAPPERS:.i=.so) WRAPPER_PM = $(WRAPPERS:.i=.pm) FILES= Makefile $(WRAPPER_SRCS) $(WRAPPER_PM) ALL = .make_wrappers LOCAL_INCLUDES = $(CONFIG_PERL_INCLUDES) # following flag switches off GCC's strict aliasing rules assumption # when performing optimization (hence, that optimisiation is no # longer available). This is necessary because swig generated wrapper # code contains lots of type punning in the course of doing its magic, # which violates the strict aliasing and so can generate duff code CC_OTHER_FLAGS += -fno-strict-aliasing include $(TOP)/config/common_make_rules include $(TOP)/config/rules/bin_process.mak # if the user gives a path to swig in $EST/config/config file, then # test *.i interface files, and use swig to rebuild wrappers, otherwise # use the default pre-swigged versions (and not delete them on make clean!) ifdef CONFIG_SWIG_COMPILER SWIG_COMMAND = $(CONFIG_SWIG_COMPILER) -c++ -perl -shadow -Wall INTERFACE_DIRS = ../interface/ ../interface/perl5/ INTERFACE_DIRS_SWG = $(foreach d,$(INTERFACE_DIRS),-I$(d)) vpath %.i $(INTERFACE_DIRS) $(WRAPPER_SRCS) : %_wrap.cc : %.i $(SWIG_COMMAND) $(INTERFACE_DIRS_SWG) -o $@ $< LOCAL_CLEAN = $(WRAPPER_SRCS) $(WRAPPERS:.i=.pm) $(ALL_WRAPPERS) else LOCAL_CLEAN = $(ALL_WRAPPERS) endif # implicit build rules $(ALL_WRAPPERS) : %.so : %_wrap.o $(CXX) -shared $(LIBS) -o $@ $< .make_wrappers : $(ALL_WRAPPERS) speech_tools/wrappers/perl5/EST_Utterance_wrap.cc0000644000076400007640000027111511332265737020600 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPERL #define SWIG_CASTRANK_MODE #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { struct SwigMovePointer { T *ptr; SwigMovePointer(T *p) : ptr(p) { } ~SwigMovePointer() { delete ptr; } SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } }; template T SwigValueInit() { return T(); } #endif /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 #ifdef __cplusplus /* Needed on some windows machines---since MS plays funny games with the header files under C++ */ #include #include extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */ /* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */ #ifndef PERL_REVISION # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) # define PERL_PATCHLEVEL_H_IMPLICIT # include # endif # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) # include # endif # ifndef PERL_REVISION # define PERL_REVISION (5) # define PERL_VERSION PATCHLEVEL # define PERL_SUBVERSION SUBVERSION # endif #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) #endif #ifndef SvIOK_UV # define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv))) #endif #ifndef SvUOK # define SvUOK(sv) SvIOK_UV(sv) #endif #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) # define PL_sv_undef sv_undef # define PL_na na # define PL_errgv errgv # define PL_sv_no sv_no # define PL_sv_yes sv_yes # define PL_markstack_ptr markstack_ptr #endif #ifndef IVSIZE # ifdef LONGSIZE # define IVSIZE LONGSIZE # else # define IVSIZE 4 /* A bold guess, but the best we can make. */ # endif #endif #ifndef INT2PTR # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) # define PTRV UV # define INT2PTR(any,d) (any)(d) # else # if PTRSIZE == LONGSIZE # define PTRV unsigned long # else # define PTRV unsigned # endif # define INT2PTR(any,d) (any)(PTRV)(d) # endif # define NUM2PTR(any,d) (any)(PTRV)(d) # define PTR2IV(p) INT2PTR(IV,p) # define PTR2UV(p) INT2PTR(UV,p) # define PTR2NV(p) NUM2PTR(NV,p) # if PTRSIZE == LONGSIZE # define PTR2ul(p) (unsigned long)(p) # else # define PTR2ul(p) INT2PTR(unsigned long,p) # endif #endif /* !INT2PTR */ #ifndef SvPV_nolen # define SvPV_nolen(x) SvPV(x,PL_na) #endif #ifndef get_sv # define get_sv perl_get_sv #endif #ifndef ERRSV # define ERRSV get_sv("@",FALSE) #endif #ifndef pTHX_ #define pTHX_ #endif #include #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ SWIGINTERN const char* SWIG_Perl_ErrorType(int code) { const char* type = 0; switch(code) { case SWIG_MemoryError: type = "MemoryError"; break; case SWIG_IOError: type = "IOError"; break; case SWIG_RuntimeError: type = "RuntimeError"; break; case SWIG_IndexError: type = "IndexError"; break; case SWIG_TypeError: type = "TypeError"; break; case SWIG_DivisionByZero: type = "ZeroDivisionError"; break; case SWIG_OverflowError: type = "OverflowError"; break; case SWIG_SyntaxError: type = "SyntaxError"; break; case SWIG_ValueError: type = "ValueError"; break; case SWIG_SystemError: type = "SystemError"; break; case SWIG_AttributeError: type = "AttributeError"; break; default: type = "RuntimeError"; } return type; } /* ----------------------------------------------------------------------------- * perlrun.swg * * This file contains the runtime support for Perl modules * and includes code for managing global variables and pointer * type checking. * ----------------------------------------------------------------------------- */ #ifdef PERL_OBJECT #define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl), #define SWIG_PERL_OBJECT_CALL pPerl, #else #define SWIG_PERL_OBJECT_DECL #define SWIG_PERL_OBJECT_CALL #endif /* Common SWIG API */ /* for raw pointers */ #define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags) #define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own) #define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags) /* for raw packed data */ #define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type) #define SWIG_NewPackedObj(p, s, type) SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) /* Error manipulation */ #define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code) #define SWIG_Error(code, msg) sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg) #define SWIG_fail goto fail /* Perl-specific SWIG API */ #define SWIG_MakePtr(sv, ptr, type, flags) SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags) #define SWIG_MakePackedObj(sv, p, s, type) SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type) #define SWIG_SetError(str) SWIG_Error(SWIG_RuntimeError, str) #define SWIG_PERL_DECL_ARGS_1(arg1) (SWIG_PERL_OBJECT_DECL arg1) #define SWIG_PERL_CALL_ARGS_1(arg1) (SWIG_PERL_OBJECT_CALL arg1) #define SWIG_PERL_DECL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_DECL arg1, arg2) #define SWIG_PERL_CALL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_CALL arg1, arg2) /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 #ifdef __cplusplus extern "C" { #endif #define SWIG_OWNER SWIG_POINTER_OWN #define SWIG_SHADOW SWIG_OWNER << 1 #define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL /* SWIG Perl macros */ /* Macro to declare an XS function */ #ifndef XSPROTO # define XSPROTO(name) void name(pTHX_ CV* cv) #endif /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) #else # ifndef MULTIPLICITY # define SWIG_CALLXS(_name) _name(cv) # else # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) # endif #endif #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; #ifdef __cplusplus extern "C" { #endif typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC #else /* PERL_OBJECT */ #define MAGIC_PPERL #define SWIGCLASS_STATIC static SWIGUNUSED #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus } #endif #else /* MULTIPLICITY */ #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus } #endif #endif /* MULTIPLICITY */ #endif /* PERL_OBJECT */ /* Workaround for bug in perl 5.6.x croak and earlier */ #if (PERL_VERSION < 8) # ifdef PERL_OBJECT # define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) static void SWIG_Perl_croak_null(CPerlObj *pPerl) # else static void SWIG_croak_null() # endif { SV *err=ERRSV; # if (PERL_VERSION < 6) croak("%_", err); # else if (SvOK(err) && !SvROK(err)) croak("%_", err); croak(Nullch); # endif } #else # define SWIG_croak_null() croak(Nullch) #endif /* Define how strict is the cast between strings and integers/doubles when overloading between these types occurs. The default is making it as strict as possible by using SWIG_AddCast when needed. You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to disable the SWIG_AddCast, making the casting between string and numbers less strict. In the end, we try to solve the overloading between strings and numerical types in the more natural way, but if you can avoid it, well, avoid it using %rename, for example. */ #ifndef SWIG_PERL_NO_STRICT_STR2NUM # ifndef SWIG_PERL_STRICT_STR2NUM # define SWIG_PERL_STRICT_STR2NUM # endif #endif #ifdef SWIG_PERL_STRICT_STR2NUM /* string takes precedence */ #define SWIG_Str2NumCast(x) SWIG_AddCast(x) #else /* number takes precedence */ #define SWIG_Str2NumCast(x) x #endif #include SWIGRUNTIME const char * SWIG_Perl_TypeProxyName(const swig_type_info *type) { if (!type) return NULL; if (type->clientdata != NULL) { return (const char*) type->clientdata; } else { return type->name; } } /* Identical to SWIG_TypeCheck, except for strcmp comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if ( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0)) ) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Function for getting a pointer value */ SWIGRUNTIME int SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) { swig_cast_info *tc; void *voidptr = (void *)0; SV *tsv = 0; if (own) *own = 0; /* If magical, apply more magic */ if (SvGMAGICAL(sv)) mg_get(sv); /* Check to see if this is an object */ if (sv_isobject(sv)) { IV tmp = 0; tsv = (SV*) SvRV(sv); if ((SvTYPE(tsv) == SVt_PVHV)) { MAGIC *mg; if (SvMAGICAL(tsv)) { mg = mg_find(tsv,'P'); if (mg) { sv = mg->mg_obj; if (sv_isobject(sv)) { tsv = (SV*)SvRV(sv); tmp = SvIV(tsv); } } } else { return SWIG_ERROR; } } else { tmp = SvIV(tsv); } voidptr = INT2PTR(void *,tmp); } else if (! SvOK(sv)) { /* Check for undef */ *(ptr) = (void *) 0; return SWIG_OK; } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ if (!SvROK(sv)) { *(ptr) = (void *) 0; return SWIG_OK; } else { return SWIG_ERROR; } } else { /* Don't know what it is */ return SWIG_ERROR; } if (_t) { /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeProxyCheck(_c,_t); if (!tc) { return SWIG_ERROR; } { int newmemory = 0; *ptr = SWIG_TypeCast(tc,voidptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { assert(own); if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } } } else { *ptr = voidptr; } /* * DISOWN implementation: we need a perl guru to check this one. */ if (tsv && (flags & SWIG_POINTER_DISOWN)) { /* * almost copy paste code from below SWIG_POINTER_OWN setting */ SV *obj = sv; HV *stash = SvSTASH(SvRV(obj)); GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE); if (isGV(gv)) { HV *hv = GvHVn(gv); /* * To set ownership (see below), a newSViv(1) entry is added. * Hence, to remove ownership, we delete the entry. */ if (hv_exists_ent(hv, obj, 0)) { hv_delete_ent(hv, obj, 0, 0); } } } return SWIG_OK; } SWIGRUNTIME int SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0); } SWIGRUNTIME void SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) { SV *self; SV *obj=newSV(0); HV *hash=newHV(); HV *stash; sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr); stash=SvSTASH(SvRV(obj)); if (flags & SWIG_POINTER_OWN) { HV *hv; GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); if (!isGV(gv)) gv_init(gv, stash, "OWNER", 5, FALSE); hv=GvHVn(gv); hv_store_ent(hv, obj, newSViv(1), 0); } sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); SvREFCNT_dec(obj); self=newRV_noinc((SV *)hash); sv_setsv(sv, self); SvREFCNT_dec((SV *)self); sv_bless(sv, stash); } else { sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr); } } SWIGRUNTIMEINLINE SV * SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { SV *result = sv_newmortal(); SWIG_MakePtr(result, ptr, t, flags); return result; } SWIGRUNTIME void SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); strcpy(r,SWIG_Perl_TypeProxyName(type)); sv_setpv(sv, result); } SWIGRUNTIME SV * SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) { SV *result = sv_newmortal(); SWIG_Perl_MakePackedObj(result, ptr, sz, type); return result; } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) { swig_cast_info *tc; const char *c = 0; if ((!obj) || (!SvOK(obj))) return SWIG_ERROR; c = SvPV_nolen(obj); /* Pointer values must start with leading underscore */ if (*c != '_') return SWIG_ERROR; c++; c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) return SWIG_ERROR; } return SWIG_OK; } /* Macros for low-level exception handling */ #define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; } typedef XSPROTO(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ typedef struct { const char *name; SwigPerlWrapperPtr wrapper; } swig_command_info; /* Information for constant table */ #define SWIG_INT 1 #define SWIG_FLOAT 2 #define SWIG_STRING 3 #define SWIG_POINTER 4 #define SWIG_BINARY 5 /* Constant information structure */ typedef struct swig_constant_info { int type; const char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_constant_info; /* Structure for variable table */ typedef struct { const char *name; SwigMagicFunc set; SwigMagicFunc get; swig_type_info **type; } swig_variable_info; /* Magic variable code */ #ifndef PERL_OBJECT #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) #ifndef MULTIPLICITY SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) #else SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) #endif #else # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) #endif { MAGIC *mg; sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFunc) get; mg->mg_virtual->svt_set = (SwigMagicFunc) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; } SWIGRUNTIME swig_module_info * SWIG_Perl_GetModule(void) { static void *type_pointer = (void *)0; SV *pointer; /* first check if pointer already created */ if (!type_pointer) { pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } } return (swig_module_info *) type_pointer; } SWIGRUNTIME void SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI); sv_setiv(pointer, PTR2IV(module)); } #ifdef __cplusplus } #endif /* Workaround perl5 global namespace pollution. Note that undefining library * functions like fopen will not solve the problem on all platforms as fopen * might be a macro on Windows but not necessarily on other operating systems. */ #ifdef do_open #undef do_open #endif #ifdef do_close #undef do_close #endif #ifdef do_exec #undef do_exec #endif #ifdef scalar #undef scalar #endif #ifdef list #undef list #endif #ifdef apply #undef apply #endif #ifdef convert #undef convert #endif #ifdef Error #undef Error #endif #ifdef form #undef form #endif #ifdef vform #undef vform #endif #ifdef LABEL #undef LABEL #endif #ifdef METHOD #undef METHOD #endif #ifdef Move #undef Move #endif #ifdef yylex #undef yylex #endif #ifdef yyparse #undef yyparse #endif #ifdef yyerror #undef yyerror #endif #ifdef invert #undef invert #endif #ifdef ref #undef ref #endif #ifdef read #undef read #endif #ifdef write #undef write #endif #ifdef eof #undef eof #endif #ifdef bool #undef bool #endif #ifdef close #undef close #endif #ifdef rewind #undef rewind #endif #ifdef free #undef free #endif #ifdef malloc #undef malloc #endif #ifdef calloc #undef calloc #endif #ifdef Stat #undef Stat #endif #ifdef check #undef check #endif #ifdef seekdir #undef seekdir #endif #ifdef open #undef open #endif #ifdef readdir #undef readdir #endif #ifdef bind #undef bind #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Item swig_types[0] #define SWIGTYPE_p_EST_Relation swig_types[1] #define SWIGTYPE_p_EST_Utterance swig_types[2] #define SWIGTYPE_p_char swig_types[3] static swig_type_info *swig_types[5]; static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init boot_EST_Utterance #define SWIG_name "EST_Utterancec::boot_EST_Utterance" #define SWIG_prefix "EST_Utterancec::" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include #ifdef __cplusplus extern "C" #endif #ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif #else SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); #endif #include "ling_class/EST_Utterance.h" #include "EST_error.h" #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) # define LLONG_MAX __LONG_LONG_MAX__ # define LLONG_MIN (-LLONG_MAX - 1LL) # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) # endif #endif SWIGINTERN int SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) { if (SvNIOK(obj)) { if (val) *val = SvNV(obj); return SWIG_OK; } else if (SvIOK(obj)) { if (val) *val = (double) SvIV(obj); return SWIG_AddCast(SWIG_OK); } else { const char *nptr = SvPV_nolen(obj); if (nptr) { char *endptr; double v = strtod(nptr, &endptr); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; } else { if (*endptr == '\0') { if (val) *val = v; return SWIG_Str2NumCast(SWIG_OK); } } } } return SWIG_TypeError; } #include #include SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { double fx = floor(x); double cx = ceil(x); double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { double summ, reps, diff; if (rd < x) { diff = x - rd; } else if (rd > x) { diff = rd - x; } else { return 1; } summ = rd + x; reps = diff/summ; if (reps < 8*DBL_EPSILON) { *d = rd; return 1; } } } return 0; } SWIGINTERN int SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val) { if (SvIOK(obj)) { if (val) *val = SvIV(obj); return SWIG_OK; } else { int dispatch = 0; const char *nptr = SvPV_nolen(obj); if (nptr) { char *endptr; long v; errno = 0; v = strtol(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; } else { if (*endptr == '\0') { if (val) *val = v; return SWIG_Str2NumCast(SWIG_OK); } } } if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val) { long v; int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } SWIGINTERNINLINE SV * SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value) { SV *obj = sv_newmortal(); sv_setiv(obj, (IV) value); return obj; } SWIGINTERNINLINE SV * SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value) { return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERN int SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) { if (SvMAGICAL(obj)) { SV *tmp = sv_newmortal(); SvSetSV(tmp, obj); obj = tmp; } if (SvPOK(obj)) { STRLEN len = 0; char *cstr = SvPV(obj, len); size_t size = len + 1; if (cptr) { if (alloc) { if (*alloc == SWIG_NEWOBJ) { *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } } if (psize) *psize = size; return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { char* vptr = 0; if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = vptr; if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERNINLINE SV * SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value) { SV *obj = sv_newmortal(); if (value) { sv_setsv(obj, &PL_sv_yes); } else { sv_setsv(obj, &PL_sv_no); } return obj; } #ifdef __cplusplus extern "C" { #endif #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_EST_Utterance_var:: class _wrap_EST_Utterance_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) { MAGIC_PPERL croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_new_EST_Utterance__SWIG_0) { { int argvi = 0; EST_Utterance *result = 0 ; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: new_EST_Utterance();"); } result = (EST_Utterance *)new EST_Utterance(); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, SWIG_OWNER | SWIG_SHADOW); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_new_EST_Utterance__SWIG_1) { { EST_Utterance *arg1 = 0 ; void *argp1 ; int res1 = 0 ; int argvi = 0; EST_Utterance *result = 0 ; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Utterance(u);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance const &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance const &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (EST_Utterance *)new EST_Utterance((EST_Utterance const &)*arg1); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, SWIG_OWNER | SWIG_SHADOW); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_new_EST_Utterance) { dXSARGS; { unsigned long _index = 0; SWIG_TypeRank _rank = 0; if (items == 0) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 1; if (_rank == _rankm) goto dispatch; } } if (items == 1) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 2; if (_rank == _rankm) goto dispatch; } } check_2: dispatch: switch(_index) { case 1: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EST_Utterance__SWIG_0); return; case 2: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EST_Utterance__SWIG_1); return; } } croak("No matching function for overloaded 'new_EST_Utterance'"); XSRETURN(0); } XS(_wrap_delete_EST_Utterance) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: delete_EST_Utterance(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EST_Utterance" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); delete arg1; ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_init) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_init(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_init" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->init(); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_clear) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_clear(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_clear" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->clear(); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_clear_relations) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_clear_relations(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_clear_relations" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->clear_relations(); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_set_highest_id) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_set_highest_id(self,n);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_set_highest_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EST_Utterance_set_highest_id" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); (arg1)->set_highest_id(arg2); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_next_id) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; int result; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_next_id(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_next_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (int)(arg1)->next_id(); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_load) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_load(self,filename);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_load" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->load((EST_String const &)*arg2); END_CATCH_ERRORS(); } ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_save__SWIG_0) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; EST_String temp3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Utterance_save(self,filename,type);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_save" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { STRLEN len; const char* str = SvPV(ST(2), len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } ((EST_Utterance const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_save__SWIG_1) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_save(self,filename);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_save" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } ((EST_Utterance const *)arg1)->save((EST_String const &)*arg2); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_save) { dXSARGS; { unsigned long _index = 0; SWIG_TypeRank _rank = 0; if (items == 2) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 1; if (_rank == _rankm) goto dispatch; } } check_1: if (items == 3) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 2; if (_rank == _rankm) goto dispatch; } } check_2: dispatch: switch(_index) { case 1: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EST_Utterance_save__SWIG_1); return; case 2: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EST_Utterance_save__SWIG_0); return; } } croak("No matching function for overloaded 'EST_Utterance_save'"); XSRETURN(0); } XS(_wrap_EST_Utterance_evaluate_all_features) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_evaluate_all_features(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_evaluate_all_features" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); (arg1)->evaluate_all_features(); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_num_relations) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; int result; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Utterance_num_relations(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_num_relations" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); result = (int)((EST_Utterance const *)arg1)->num_relations(); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_relation_present) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String arg2 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; bool result; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_relation_present(self,name);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation_present" "', argument " "1"" of type '" "EST_Utterance const *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } result = (bool)((EST_Utterance const *)arg1)->relation_present(arg2); ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_relation__SWIG_0) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int val3 ; int ecode3 = 0 ; int argvi = 0; EST_Relation *result = 0 ; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Utterance_relation(self,name,err_on_not_found);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_relation" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EST_Utterance_relation" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Relation *)(arg1)->relation((char const *)arg2,arg3); END_CATCH_ERRORS(); } ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | SWIG_SHADOW); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; XSRETURN(argvi); fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; SWIG_croak_null(); } } XS(_wrap_EST_Utterance_relation__SWIG_1) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int argvi = 0; EST_Relation *result = 0 ; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_relation(self,name);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_relation" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Relation *)(arg1)->relation((char const *)arg2); END_CATCH_ERRORS(); } ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | SWIG_SHADOW); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; XSRETURN(argvi); fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; SWIG_croak_null(); } } XS(_wrap_EST_Utterance_relation) { dXSARGS; { unsigned long _index = 0; SWIG_TypeRank _rank = 0; if (items == 2) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 1; if (_rank == _rankm) goto dispatch; } } check_1: if (items == 3) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { { int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL); _v = SWIG_CheckState(res); } } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 2; if (_rank == _rankm) goto dispatch; } } check_2: dispatch: switch(_index) { case 1: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EST_Utterance_relation__SWIG_1); return; case 2: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EST_Utterance_relation__SWIG_0); return; } } croak("No matching function for overloaded 'EST_Utterance_relation'"); XSRETURN(0); } XS(_wrap_EST_Utterance_id) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int argvi = 0; EST_Item *result = 0 ; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_id(self,n);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_id" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (EST_Item *)(arg1)->id((EST_String const &)*arg2); END_CATCH_ERRORS(); } ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Item, 0 | SWIG_SHADOW); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_create_relation) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int argvi = 0; EST_Relation *result = 0 ; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_create_relation(self,relname);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_create_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_Relation *)(arg1)->create_relation((EST_String const &)*arg2); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Relation, 0 | SWIG_SHADOW); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_remove_relation) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_String *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_remove_relation(self,relname);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_remove_relation" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->remove_relation((EST_String const &)*arg2); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_EST_Utterance_sub_utterance) { { EST_Utterance *arg1 = (EST_Utterance *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Utterance_sub_utterance(self,i);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Utterance, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EST_Utterance_sub_utterance" "', argument " "1"" of type '" "EST_Utterance *""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EST_Utterance_sub_utterance" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); (arg1)->sub_utterance(arg2); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_utterance_merge__SWIG_0) { { EST_Utterance *arg1 = 0 ; EST_Utterance *arg2 = 0 ; EST_Item *arg3 = (EST_Item *) 0 ; EST_Item *arg4 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; int argvi = 0; int result; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: utterance_merge(utt,sub_utt,utt_root,sub_root);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } arg2 = reinterpret_cast< EST_Utterance * >(argp2); res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "utterance_merge" "', argument " "3"" of type '" "EST_Item *""'"); } arg3 = reinterpret_cast< EST_Item * >(argp3); res4 = SWIG_ConvertPtr(ST(3), &argp4,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "utterance_merge" "', argument " "4"" of type '" "EST_Item *""'"); } arg4 = reinterpret_cast< EST_Item * >(argp4); { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)utterance_merge(*arg1,*arg2,arg3,arg4); END_CATCH_ERRORS(); } ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_utterance_merge__SWIG_1) { { EST_Utterance *arg1 = 0 ; EST_Utterance *arg2 = 0 ; EST_String arg3 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int argvi = 0; int result; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: utterance_merge(utt,extra,feature);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "utterance_merge" "', argument " "2"" of type '" "EST_Utterance &""'"); } arg2 = reinterpret_cast< EST_Utterance * >(argp2); { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } { char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)utterance_merge(*arg1,*arg2,arg3); END_CATCH_ERRORS(); } ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_utterance_merge) { dXSARGS; { unsigned long _index = 0; SWIG_TypeRank _rank = 0; if (items == 3) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_1; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 1; if (_rank == _rankm) goto dispatch; } } check_1: if (items == 4) { SWIG_TypeRank _ranki = 0; SWIG_TypeRank _rankm = 0; SWIG_TypeRank _pi = 1; int _v = 0; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_EST_Utterance, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; { void *vptr = 0; int res = SWIG_ConvertPtr(ST(3), &vptr, SWIGTYPE_p_EST_Item, 0); _v = SWIG_CheckState(res); } if (!_v) goto check_2; _ranki += _v*_pi; _rankm += _pi; _pi *= SWIG_MAXCASTRANK; if (!_index || (_ranki < _rank)) { _rank = _ranki; _index = 2; if (_rank == _rankm) goto dispatch; } } check_2: dispatch: switch(_index) { case 1: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_utterance_merge__SWIG_1); return; case 2: ++PL_markstack_ptr; SWIG_CALLXS(_wrap_utterance_merge__SWIG_0); return; } } croak("No matching function for overloaded 'utterance_merge'"); XSRETURN(0); } XS(_wrap_sub_utterance) { { EST_Utterance *arg1 = 0 ; EST_Item *arg2 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: sub_utterance(sub,i);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_EST_Utterance, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sub_utterance" "', argument " "1"" of type '" "EST_Utterance &""'"); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sub_utterance" "', argument " "1"" of type '" "EST_Utterance &""'"); } arg1 = reinterpret_cast< EST_Utterance * >(argp1); res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sub_utterance" "', argument " "2"" of type '" "EST_Item *""'"); } arg2 = reinterpret_cast< EST_Item * >(argp2); sub_utterance(*arg1,arg2); ST(argvi) = sv_newmortal(); XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_get_utt) { { EST_Item *arg1 = (EST_Item *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int argvi = 0; EST_Utterance *result = 0 ; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: get_utt(s);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EST_Item, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_utt" "', argument " "1"" of type '" "EST_Item *""'"); } arg1 = reinterpret_cast< EST_Item * >(argp1); result = (EST_Utterance *)get_utt(arg1); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EST_Utterance, 0 | SWIG_SHADOW); argvi++ ; XSRETURN(argvi); fail: SWIG_croak_null(); } } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Item = {"_p_EST_Item", "EST_Item *", 0, 0, (void*)"EST_Item::EST_Item", 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, (void*)"EST_Relation::EST_Relation", 0}; static swig_type_info _swigt__p_EST_Utterance = {"_p_EST_Utterance", "EST_Utterance *", 0, 0, (void*)"EST_Utterance::EST_Utterance", 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_EST_Utterance, &_swigt__p_char, }; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Utterance[] = { {&_swigt__p_EST_Utterance, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_EST_Utterance, _swigc__p_char, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_constant_info swig_constants[] = { {0,0,0,0,0,0} }; #ifdef __cplusplus } #endif static swig_variable_info swig_variables[] = { {0,0,0,0} }; static swig_command_info swig_commands[] = { {"EST_Utterancec::new_EST_Utterance", _wrap_new_EST_Utterance}, {"EST_Utterancec::delete_EST_Utterance", _wrap_delete_EST_Utterance}, {"EST_Utterancec::EST_Utterance_init", _wrap_EST_Utterance_init}, {"EST_Utterancec::EST_Utterance_clear", _wrap_EST_Utterance_clear}, {"EST_Utterancec::EST_Utterance_clear_relations", _wrap_EST_Utterance_clear_relations}, {"EST_Utterancec::EST_Utterance_set_highest_id", _wrap_EST_Utterance_set_highest_id}, {"EST_Utterancec::EST_Utterance_next_id", _wrap_EST_Utterance_next_id}, {"EST_Utterancec::EST_Utterance_load", _wrap_EST_Utterance_load}, {"EST_Utterancec::EST_Utterance_save", _wrap_EST_Utterance_save}, {"EST_Utterancec::EST_Utterance_evaluate_all_features", _wrap_EST_Utterance_evaluate_all_features}, {"EST_Utterancec::EST_Utterance_num_relations", _wrap_EST_Utterance_num_relations}, {"EST_Utterancec::EST_Utterance_relation_present", _wrap_EST_Utterance_relation_present}, {"EST_Utterancec::EST_Utterance_relation", _wrap_EST_Utterance_relation}, {"EST_Utterancec::EST_Utterance_id", _wrap_EST_Utterance_id}, {"EST_Utterancec::EST_Utterance_create_relation", _wrap_EST_Utterance_create_relation}, {"EST_Utterancec::EST_Utterance_remove_relation", _wrap_EST_Utterance_remove_relation}, {"EST_Utterancec::EST_Utterance_sub_utterance", _wrap_EST_Utterance_sub_utterance}, {"EST_Utterancec::utterance_merge", _wrap_utterance_merge}, {"EST_Utterancec::sub_utterance", _wrap_sub_utterance}, {"EST_Utterancec::get_utt", _wrap_get_utt}, {0,0} }; /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif #ifdef __cplusplus extern "C" #endif XS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_EST_Utterance, (void*) "EST_Utterance::EST_Utterance"); ST(0) = &PL_sv_yes; XSRETURN(1); } speech_tools/wrappers/perl5/EST_Relation_wrap.cc0000644000076400007640000020225010453550564020413 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.25 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus template class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } SwigValueWrapper(const T& t) : tt(new T(t)) { } ~SwigValueWrapper() { delete tt; } SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } operator T&() const { return *tt; } T *operator&() { return tt; } private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); }; #endif /*********************************************************************** * * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ************************************************************************/ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) || defined(__ICC) # define SWIGUNUSED __attribute__ ((unused)) # else # define SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods for Windows DLLs */ #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # define SWIGEXPORT # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /*********************************************************************** * swigrun.swg * * This file contains generic CAPI SWIG runtime support for pointer * type checking. * ************************************************************************/ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the swig runtime code. In 99.9% of the cases, swig just needs to declare them as 'static'. But only do this if is strictly necessary, ie, if you have problems with your compiler or so. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (int)(*f1 - *f2); } return (l1 - f1) - (l2 - f2); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* think of this as a c++ template<> or a scheme macro */ #define SWIG_TypeCheck_Template(comparison, ty) \ if (ty) { \ swig_cast_info *iter = ty->cast; \ while (iter) { \ if (comparison) { \ if (iter == ty->cast) return iter; \ /* Move iter to the top of the linked list */ \ iter->prev->next = iter->next; \ if (iter->next) \ iter->next->prev = iter->prev; \ iter->next = ty->cast; \ iter->prev = 0; \ if (ty->cast) ty->cast->prev = iter; \ ty->cast = iter; \ return iter; \ } \ iter = iter->next; \ } \ } \ return 0 /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); } /* Same as previous function, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { SWIG_TypeCheck_Template(iter->type == from, into); } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { if (!ti->clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) SWIG_TypeClientData(cast->type, clientdata); cast = cast->next; } } } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu = 0; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* ---------------------------------------------------------------------- -*- c -*- * perl5.swg * * Perl5 runtime library * $Header: /home/CVS/speech_tools/wrappers/perl5/EST_Relation_wrap.cc,v 1.2 2006/06/13 15:12:47 robert Exp $ * ----------------------------------------------------------------------------- */ #define SWIGPERL #define SWIGPERL5 #ifdef __cplusplus /* Needed on some windows machines---since MS plays funny games with the header files under C++ */ #include #include extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Get rid of free and malloc defined by perl */ #undef free #undef malloc #ifndef pTHX_ #define pTHX_ #endif #include #ifdef __cplusplus } #endif /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) #else # ifndef MULTIPLICITY # define SWIG_CALLXS(_name) _name(cv) # else # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) # endif #endif /* Contract support */ #define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else /* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC #else #define MAGIC_PPERL #define SWIGCLASS_STATIC static #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #else #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus } #endif #endif #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) #endif /* Modifications for newer Perl 5.005 releases */ #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) # ifndef PL_sv_yes # define PL_sv_yes sv_yes # endif # ifndef PL_sv_undef # define PL_sv_undef sv_undef # endif # ifndef PL_na # define PL_na na # endif #endif #include #ifdef __cplusplus extern "C" { #endif #define SWIG_OWNER 1 #define SWIG_SHADOW 2 /* Common SWIG API */ #ifdef PERL_OBJECT # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(pPerl, p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags) #else # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(sv, p, s, type ) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(obj, p, s, type, flags) #endif /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) /* Perl-specific API */ #ifdef PERL_OBJECT # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(pPerl, str) #else # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(str) # define SWIG_SetErrorSV(str) \ SWIG_Perl_SetErrorSV(str) #endif #define SWIG_SetErrorf SWIG_Perl_SetErrorf #ifdef PERL_OBJECT # define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl, #else # define SWIG_MAYBE_PERL_OBJECT #endif static swig_cast_info * SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) { SWIG_TypeCheck_Template(sv_derived_from(rv, (char *) iter->type->name), ty); } /* Function for getting a pointer value */ static int SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { swig_cast_info *tc; void *voidptr = (void *)0; /* If magical, apply more magic */ if (SvGMAGICAL(sv)) mg_get(sv); /* Check to see if this is an object */ if (sv_isobject(sv)) { SV *tsv = (SV*) SvRV(sv); IV tmp = 0; if ((SvTYPE(tsv) == SVt_PVHV)) { MAGIC *mg; if (SvMAGICAL(tsv)) { mg = mg_find(tsv,'P'); if (mg) { sv = mg->mg_obj; if (sv_isobject(sv)) { tmp = SvIV((SV*)SvRV(sv)); } } } else { return -1; } } else { tmp = SvIV((SV*)SvRV(sv)); } voidptr = (void *)tmp; if (!_t) { *(ptr) = voidptr; return 0; } } else if (! SvOK(sv)) { /* Check for undef */ *(ptr) = (void *) 0; return 0; } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ *(ptr) = (void *) 0; if (!SvROK(sv)) return 0; else return -1; } else { /* Don't know what it is */ *(ptr) = (void *) 0; return -1; } if (_t) { /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeCheck(_c,_t); if (!tc) { *ptr = voidptr; return -1; } *ptr = SWIG_TypeCast(tc,voidptr); return 0; } *ptr = voidptr; return 0; } static void SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { if (ptr && (flags & SWIG_SHADOW)) { SV *self; SV *obj=newSV(0); HV *hash=newHV(); HV *stash; sv_setref_pv(obj, (char *) t->name, ptr); stash=SvSTASH(SvRV(obj)); if (flags & SWIG_OWNER) { HV *hv; GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); if (!isGV(gv)) gv_init(gv, stash, "OWNER", 5, FALSE); hv=GvHVn(gv); hv_store_ent(hv, obj, newSViv(1), 0); } sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); SvREFCNT_dec(obj); self=newRV_noinc((SV *)hash); sv_setsv(sv, self); SvREFCNT_dec((SV *)self); sv_bless(sv, stash); } else { sv_setref_pv(sv, (char *) t->name, ptr); } } static SWIGINLINE SV * SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { SV *result = sv_newmortal(); SWIG_MakePtr(result, ptr, t, flags); return result; } static void SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(type->name)) > 1000) return; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); strcpy(r,type->name); sv_setpv(sv, result); } /* Convert a packed value value */ static int SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) { swig_cast_info *tc; const char *c = 0; if ((!obj) || (!SvOK(obj))) return -1; c = SvPV(obj, PL_na); /* Pointer values must start with leading underscore */ if (*c != '_') return -1; c++; c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) return -1; } return 0; } static SWIGINLINE void SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) { if (error) sv_setpv(perl_get_sv("@", TRUE), error); } static SWIGINLINE void SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) { if (error) sv_setsv(perl_get_sv("@", TRUE), error); } static void SWIG_Perl_SetErrorf(const char *fmt, ...) { va_list args; va_start(args, fmt); sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*)); va_end(args); } /* Macros for low-level exception handling */ #define SWIG_fail goto fail #define SWIG_croak(x) { SWIG_SetError(x); goto fail; } #define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; } /* most preprocessors do not support vararg macros :-( */ /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ typedef XS(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ typedef struct { const char *name; SwigPerlWrapperPtr wrapper; } swig_command_info; /* Information for constant table */ #define SWIG_INT 1 #define SWIG_FLOAT 2 #define SWIG_STRING 3 #define SWIG_POINTER 4 #define SWIG_BINARY 5 /* Constant information structure */ typedef struct swig_constant_info { int type; const char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_constant_info; #ifdef __cplusplus } #endif /* Structure for variable table */ typedef struct { const char *name; SwigMagicFunc set; SwigMagicFunc get; swig_type_info **type; } swig_variable_info; /* Magic variable code */ #ifndef PERL_OBJECT #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) #ifndef MULTIPLICITY static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) { #else static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { #endif #else # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { #endif MAGIC *mg; sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; } static swig_module_info * SWIG_Perl_GetModule() { static void *type_pointer = (void *)0; SV *pointer; /* first check if pointer already created */ if (!type_pointer) { pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } } return (swig_module_info *) type_pointer; } static void SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); sv_setiv(pointer, PTR2IV(module)); } #ifdef do_open #undef do_open #endif #ifdef do_close #undef do_close #endif #ifdef scalar #undef scalar #endif #ifdef list #undef list #endif #ifdef apply #undef apply #endif #ifdef convert #undef convert #endif #ifdef Error #undef Error #endif #ifdef form #undef form #endif #ifdef vform #undef vform #endif #ifdef LABEL #undef LABEL #endif #ifdef METHOD #undef METHOD #endif #ifdef Move #undef Move #endif #ifdef yylex #undef yylex #endif #ifdef yyparse #undef yyparse #endif #ifdef yyerror #undef yyerror #endif #ifdef invert #undef invert #endif #ifdef ref #undef ref #endif #ifdef ENTER #undef ENTER #endif #ifdef read #undef read #endif #ifdef write #undef write #endif #ifdef eof #undef eof #endif /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Item swig_types[0] #define SWIGTYPE_p_EST_Relation swig_types[1] #define SWIGTYPE_p_EST_Utterance swig_types[2] #define SWIGTYPE_p_EST_read_status swig_types[3] #define SWIGTYPE_p_EST_write_status swig_types[4] static swig_type_info *swig_types[5]; static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init boot_EST_Relation #define SWIG_name "EST_Relationc::boot_EST_Relation" #define SWIG_prefix "EST_Relationc::" #ifdef __cplusplus extern "C" #endif #ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif #else SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); #endif #include "ling_class/EST_Relation.h" #include "ling_class/EST_Item.h" #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_EST_Relation_var:: class _wrap_EST_Relation_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { MAGIC_PPERL sv = sv; mg = mg; croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_new_EST_Relation__SWIG_0) { { EST_Relation *result; int argvi = 0; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: new_EST_Relation();"); } result = (EST_Relation *)new EST_Relation(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Relation, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Relation__SWIG_1) { { char *arg1 = (char *) 0 ; EST_Relation *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Relation(name);"); } if (!SvOK((SV*) ST(0))) arg1 = 0; else arg1 = (char *) SvPV(ST(0), PL_na); result = (EST_Relation *)new EST_Relation((char const *)arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Relation, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Relation__SWIG_2) { { EST_Relation *arg1 = 0 ; EST_Relation *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Relation(r);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Relation. Expected _p_EST_Relation"); } } result = (EST_Relation *)new EST_Relation((EST_Relation const &)*arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Relation, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Relation) { dXSARGS; if (items == 0) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Relation__SWIG_0); return; } if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Relation__SWIG_2); return; } } if (items == 1) { int _v; { _v = SvPOK(ST(0)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Relation__SWIG_1); return; } } croak("No matching function for overloaded 'new_EST_Relation'"); XSRETURN(0); } XS(_wrap_delete_EST_Relation) { { EST_Relation *arg1 = (EST_Relation *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: delete_EST_Relation(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of delete_EST_Relation. Expected _p_EST_Relation"); } } delete arg1; XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_load__SWIG_0) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; EST_read_status result; EST_String temp2 ; EST_String temp3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Relation_load(self,filename,type);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_load. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { STRLEN len; const char* str = SvPV(ST(2), len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = (arg1)->load((EST_String const &)*arg2,(EST_String const &)*arg3); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_load__SWIG_1) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_read_status result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_load(self,filename);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_load. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (arg1)->load((EST_String const &)*arg2); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_load) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Relation_load__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Relation_load__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Relation_load'"); XSRETURN(0); } XS(_wrap_EST_Relation_save__SWIG_0) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; bool arg4 ; EST_write_status result; EST_String temp2 ; EST_String temp3 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Relation_save(self,filename,type,evaluate_ff);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_save. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { STRLEN len; const char* str = SvPV(ST(2), len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } arg4 = (bool) SvIV(ST(3)); result = ((EST_Relation const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3,arg4); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_save__SWIG_1) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; EST_write_status result; EST_String temp2 ; EST_String temp3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Relation_save(self,filename,type);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_save. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { STRLEN len; const char* str = SvPV(ST(2), len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } result = ((EST_Relation const *)arg1)->save((EST_String const &)*arg2,(EST_String const &)*arg3); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_save) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Relation_save__SWIG_1); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Relation_save__SWIG_0); return; } } } } } croak("No matching function for overloaded 'EST_Relation_save'"); XSRETURN(0); } XS(_wrap_EST_Relation_evaluate_item_features) { { EST_Relation *arg1 = (EST_Relation *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_evaluate_item_features(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_evaluate_item_features. Expected _p_EST_Relation"); } } (arg1)->evaluate_item_features(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_clear) { { EST_Relation *arg1 = (EST_Relation *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_clear(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_clear. Expected _p_EST_Relation"); } } (arg1)->clear(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_utt) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Utterance *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_utt(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_utt. Expected _p_EST_Relation"); } } result = (EST_Utterance *)(arg1)->utt(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Utterance, 0|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_set_utt) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Utterance *arg2 = (EST_Utterance *) 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_set_utt(self,u);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_set_utt. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Utterance,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Relation_set_utt. Expected _p_EST_Utterance"); } } (arg1)->set_utt(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_name) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_name(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_name. Expected _p_EST_Relation"); } } { EST_String const &_result_ref = ((EST_Relation const *)arg1)->name(); result = (EST_String *) &_result_ref; } ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)(*result), result->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_head) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_head(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_head. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->head(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_root) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_root(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_root. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->root(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_tail) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_tail(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_tail. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->tail(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_first) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_first(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_first. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->first(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_first_leaf) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_first_leaf(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_first_leaf. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->first_leaf(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_last) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_last(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_last. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->last(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_last_leaf) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_last_leaf(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_last_leaf. Expected _p_EST_Relation"); } } result = (EST_Item *)((EST_Relation const *)arg1)->last_leaf(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_append) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_append(self,si);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_append. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Relation_append. Expected _p_EST_Item"); } } result = (EST_Item *)(arg1)->append(arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_prepend) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_prepend(self,si);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_prepend. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Relation_prepend. Expected _p_EST_Item"); } } result = (EST_Item *)(arg1)->prepend(arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_length) { { EST_Relation *arg1 = (EST_Relation *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_length(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_length. Expected _p_EST_Relation"); } } result = (int)((EST_Relation const *)arg1)->length(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_empty) { { EST_Relation *arg1 = (EST_Relation *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Relation_empty(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_empty. Expected _p_EST_Relation"); } } result = (int)((EST_Relation const *)arg1)->empty(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_remove_item) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_remove_item(self,item);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_remove_item. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Relation_remove_item. Expected _p_EST_Item"); } } (arg1)->remove_item(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Relation_remove_item_feature) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_String *arg2 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Relation_remove_item_feature(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Relation_remove_item_feature. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->remove_item_feature((EST_String const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_copy_relation) { { EST_Relation *arg1 = 0 ; EST_Relation *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: copy_relation(from,to);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of copy_relation. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 2 of copy_relation. Expected _p_EST_Relation"); } } copy_relation((EST_Relation const &)*arg1,*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Item = {"EST_Item::EST_Item", "EST_Item *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Relation = {"EST_Relation::EST_Relation", "EST_Relation *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Utterance = {"_p_EST_Utterance", "EST_Utterance *", 0, 0, 0}; static swig_type_info _swigt__p_EST_read_status = {"_p_EST_read_status", "EST_read_status *", 0, 0, 0}; static swig_type_info _swigt__p_EST_write_status = {"_p_EST_write_status", "EST_write_status *", 0, 0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Item, &_swigt__p_EST_Relation, &_swigt__p_EST_Utterance, &_swigt__p_EST_read_status, &_swigt__p_EST_write_status, }; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Utterance[] = { {&_swigt__p_EST_Utterance, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_read_status[] = { {&_swigt__p_EST_read_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_write_status[] = { {&_swigt__p_EST_write_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Item, _swigc__p_EST_Relation, _swigc__p_EST_Utterance, _swigc__p_EST_read_status, _swigc__p_EST_write_status, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_constant_info swig_constants[] = { {0,0,0,0,0,0} }; #ifdef __cplusplus } #endif static swig_variable_info swig_variables[] = { {0,0,0,0} }; static swig_command_info swig_commands[] = { {"EST_Relationc::new_EST_Relation", _wrap_new_EST_Relation}, {"EST_Relationc::delete_EST_Relation", _wrap_delete_EST_Relation}, {"EST_Relationc::EST_Relation_load", _wrap_EST_Relation_load}, {"EST_Relationc::EST_Relation_save", _wrap_EST_Relation_save}, {"EST_Relationc::EST_Relation_evaluate_item_features", _wrap_EST_Relation_evaluate_item_features}, {"EST_Relationc::EST_Relation_clear", _wrap_EST_Relation_clear}, {"EST_Relationc::EST_Relation_utt", _wrap_EST_Relation_utt}, {"EST_Relationc::EST_Relation_set_utt", _wrap_EST_Relation_set_utt}, {"EST_Relationc::EST_Relation_name", _wrap_EST_Relation_name}, {"EST_Relationc::EST_Relation_head", _wrap_EST_Relation_head}, {"EST_Relationc::EST_Relation_root", _wrap_EST_Relation_root}, {"EST_Relationc::EST_Relation_tail", _wrap_EST_Relation_tail}, {"EST_Relationc::EST_Relation_first", _wrap_EST_Relation_first}, {"EST_Relationc::EST_Relation_first_leaf", _wrap_EST_Relation_first_leaf}, {"EST_Relationc::EST_Relation_last", _wrap_EST_Relation_last}, {"EST_Relationc::EST_Relation_last_leaf", _wrap_EST_Relation_last_leaf}, {"EST_Relationc::EST_Relation_append", _wrap_EST_Relation_append}, {"EST_Relationc::EST_Relation_prepend", _wrap_EST_Relation_prepend}, {"EST_Relationc::EST_Relation_length", _wrap_EST_Relation_length}, {"EST_Relationc::EST_Relation_empty", _wrap_EST_Relation_empty}, {"EST_Relationc::EST_Relation_remove_item", _wrap_EST_Relation_remove_item}, {"EST_Relationc::EST_Relation_remove_item_feature", _wrap_EST_Relation_remove_item_feature}, {"EST_Relationc::copy_relation", _wrap_copy_relation}, {0,0} }; /************************************************************************* * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. **/ #ifdef __cplusplus extern "C" { #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { swig_type_info *type, *ret; swig_cast_info *cast; size_t i; swig_module_info *module_head; static int init_run = 0; clientdata = clientdata; if (init_run) return; init_run = 1; /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; } else { /* This is the first module loaded */ swig_module.next = &swig_module; SWIG_SetModule(clientdata, &swig_module); } /* Now work on filling in swig_module.types */ for (i = 0; i < swig_module.size; ++i) { type = 0; /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); } if (ret && type == swig_module.type_initial[i]) { cast->type = ret; ret = 0; } if (!ret) { if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" #endif XS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_EST_Relation, (void*) "EST_Relation::EST_Relation"); ST(0) = &PL_sv_yes; XSRETURN(1); } speech_tools/wrappers/perl5/EST_Item_wrap.cc0000644000076400007640000024547310357531477017557 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.27 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus template class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } SwigValueWrapper(const T& t) : tt(new T(t)) { } ~SwigValueWrapper() { delete tt; } SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } operator T&() const { return *tt; } T *operator&() { return tt; } private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); }; #endif /*********************************************************************** * * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ************************************************************************/ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) || defined(__ICC) # define SWIGUNUSED __attribute__ ((unused)) # else # define SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods for Windows DLLs */ #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # define SWIGEXPORT # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /*********************************************************************** * swigrun.swg * * This file contains generic CAPI SWIG runtime support for pointer * type checking. * ************************************************************************/ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the swig runtime code. In 99.9% of the cases, swig just needs to declare them as 'static'. But only do this if is strictly necessary, ie, if you have problems with your compiler or so. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (int)(*f1 - *f2); } return (l1 - f1) - (l2 - f2); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* think of this as a c++ template<> or a scheme macro */ #define SWIG_TypeCheck_Template(comparison, ty) \ if (ty) { \ swig_cast_info *iter = ty->cast; \ while (iter) { \ if (comparison) { \ if (iter == ty->cast) return iter; \ /* Move iter to the top of the linked list */ \ iter->prev->next = iter->next; \ if (iter->next) \ iter->next->prev = iter->prev; \ iter->next = ty->cast; \ iter->prev = 0; \ if (ty->cast) ty->cast->prev = iter; \ ty->cast = iter; \ return iter; \ } \ iter = iter->next; \ } \ } \ return 0 /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); } /* Same as previous function, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { SWIG_TypeCheck_Template(iter->type == from, into); } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu = 0; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* ---------------------------------------------------------------------- -*- c -*- * perl5.swg * * Perl5 runtime library * $Header: /home/CVS/speech_tools/wrappers/perl5/EST_Item_wrap.cc,v 1.1 2006/01/06 18:13:19 korin Exp $ * ----------------------------------------------------------------------------- */ #define SWIGPERL #define SWIGPERL5 #ifdef __cplusplus /* Needed on some windows machines---since MS plays funny games with the header files under C++ */ #include #include extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Get rid of free and malloc defined by perl */ #undef free #undef malloc #ifndef pTHX_ #define pTHX_ #endif #include #ifdef __cplusplus } #endif /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) #else # ifndef MULTIPLICITY # define SWIG_CALLXS(_name) _name(cv) # else # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) # endif #endif /* Contract support */ #define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else /* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC #else #define MAGIC_PPERL #define SWIGCLASS_STATIC static #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #else #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus } #endif #endif #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) #endif /* Modifications for newer Perl 5.005 releases */ #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) # ifndef PL_sv_yes # define PL_sv_yes sv_yes # endif # ifndef PL_sv_undef # define PL_sv_undef sv_undef # endif # ifndef PL_na # define PL_na na # endif #endif #include #ifdef __cplusplus extern "C" { #endif #define SWIG_OWNER 1 #define SWIG_SHADOW 2 /* Common SWIG API */ #ifdef PERL_OBJECT # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(pPerl, p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags) #else # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(sv, p, s, type ) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(obj, p, s, type, flags) #endif /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) /* Perl-specific API */ #ifdef PERL_OBJECT # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(pPerl, str) #else # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(str) # define SWIG_SetErrorSV(str) \ SWIG_Perl_SetErrorSV(str) #endif #define SWIG_SetErrorf SWIG_Perl_SetErrorf #ifdef PERL_OBJECT # define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl, #else # define SWIG_MAYBE_PERL_OBJECT #endif static swig_cast_info * SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) { SWIG_TypeCheck_Template(sv_derived_from(rv, (char *) iter->type->name), ty); } /* Function for getting a pointer value */ static int SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { swig_cast_info *tc; void *voidptr = (void *)0; /* If magical, apply more magic */ if (SvGMAGICAL(sv)) mg_get(sv); /* Check to see if this is an object */ if (sv_isobject(sv)) { SV *tsv = (SV*) SvRV(sv); IV tmp = 0; if ((SvTYPE(tsv) == SVt_PVHV)) { MAGIC *mg; if (SvMAGICAL(tsv)) { mg = mg_find(tsv,'P'); if (mg) { sv = mg->mg_obj; if (sv_isobject(sv)) { tmp = SvIV((SV*)SvRV(sv)); } } } else { return -1; } } else { tmp = SvIV((SV*)SvRV(sv)); } voidptr = (void *)tmp; if (!_t) { *(ptr) = voidptr; return 0; } } else if (! SvOK(sv)) { /* Check for undef */ *(ptr) = (void *) 0; return 0; } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ *(ptr) = (void *) 0; if (!SvROK(sv)) return 0; else return -1; } else { /* Don't know what it is */ *(ptr) = (void *) 0; return -1; } if (_t) { /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeCheck(_c,_t); if (!tc) { *ptr = voidptr; return -1; } *ptr = SWIG_TypeCast(tc,voidptr); return 0; } *ptr = voidptr; return 0; } static void SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { if (ptr && (flags & SWIG_SHADOW)) { SV *self; SV *obj=newSV(0); HV *hash=newHV(); HV *stash; sv_setref_pv(obj, (char *) t->name, ptr); stash=SvSTASH(SvRV(obj)); if (flags & SWIG_OWNER) { HV *hv; GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); if (!isGV(gv)) gv_init(gv, stash, "OWNER", 5, FALSE); hv=GvHVn(gv); hv_store_ent(hv, obj, newSViv(1), 0); } sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); SvREFCNT_dec(obj); self=newRV_noinc((SV *)hash); sv_setsv(sv, self); SvREFCNT_dec((SV *)self); sv_bless(sv, stash); } else { sv_setref_pv(sv, (char *) t->name, ptr); } } static SWIGINLINE SV * SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { SV *result = sv_newmortal(); SWIG_MakePtr(result, ptr, t, flags); return result; } static void SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(type->name)) > 1000) return; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); strcpy(r,type->name); sv_setpv(sv, result); } /* Convert a packed value value */ static int SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) { swig_cast_info *tc; const char *c = 0; if ((!obj) || (!SvOK(obj))) return -1; c = SvPV(obj, PL_na); /* Pointer values must start with leading underscore */ if (*c != '_') return -1; c++; c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) return -1; } return 0; } static SWIGINLINE void SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) { if (error) sv_setpv(perl_get_sv("@", TRUE), error); } static SWIGINLINE void SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) { if (error) sv_setsv(perl_get_sv("@", TRUE), error); } static void SWIG_Perl_SetErrorf(const char *fmt, ...) { va_list args; va_start(args, fmt); sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*)); va_end(args); } /* Macros for low-level exception handling */ #define SWIG_fail goto fail #define SWIG_croak(x) { SWIG_SetError(x); goto fail; } #define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; } /* most preprocessors do not support vararg macros :-( */ /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ typedef XS(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ typedef struct { const char *name; SwigPerlWrapperPtr wrapper; } swig_command_info; /* Information for constant table */ #define SWIG_INT 1 #define SWIG_FLOAT 2 #define SWIG_STRING 3 #define SWIG_POINTER 4 #define SWIG_BINARY 5 /* Constant information structure */ typedef struct swig_constant_info { int type; const char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_constant_info; #ifdef __cplusplus } #endif /* Structure for variable table */ typedef struct { const char *name; SwigMagicFunc set; SwigMagicFunc get; swig_type_info **type; } swig_variable_info; /* Magic variable code */ #ifndef PERL_OBJECT #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) #ifndef MULTIPLICITY static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) { #else static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { #endif #else # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { #endif MAGIC *mg; sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; } static swig_module_info * SWIG_Perl_GetModule() { static void *type_pointer = (void *)0; SV *pointer; /* first check if pointer already created */ if (!type_pointer) { pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } } return (swig_module_info *) type_pointer; } static void SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); sv_setiv(pointer, PTR2IV(module)); } #ifdef do_open #undef do_open #endif #ifdef do_close #undef do_close #endif #ifdef scalar #undef scalar #endif #ifdef list #undef list #endif #ifdef apply #undef apply #endif #ifdef convert #undef convert #endif #ifdef Error #undef Error #endif #ifdef form #undef form #endif #ifdef vform #undef vform #endif #ifdef LABEL #undef LABEL #endif #ifdef METHOD #undef METHOD #endif #ifdef Move #undef Move #endif #ifdef yylex #undef yylex #endif #ifdef yyparse #undef yyparse #endif #ifdef yyerror #undef yyerror #endif #ifdef invert #undef invert #endif #ifdef ref #undef ref #endif #ifdef ENTER #undef ENTER #endif #ifdef read #undef read #endif #ifdef write #undef write #endif #ifdef eof #undef eof #endif #ifdef bool #undef bool #endif #ifdef close #undef close #endif #ifdef rewind #undef rewind #endif /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_Features swig_types[0] #define SWIGTYPE_p_EST_Item swig_types[1] #define SWIGTYPE_p_EST_Relation swig_types[2] static swig_type_info *swig_types[4]; static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init boot_EST_Item #define SWIG_name "EST_Itemc::boot_EST_Item" #define SWIG_prefix "EST_Itemc::" #ifdef __cplusplus extern "C" #endif #ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif #else SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); #endif #include "ling_class/EST_Item.h" #include "ling_class/EST_item_aux.h" static HV* features_to_PerlHash( EST_Features *features ){ EST_Features::RwEntries p; HV *result = newHV(); SV *value; for( p.begin(*features); p != 0; ++p ){ const EST_Val &v = p->v; if(v.type() == val_unset) value = &PL_sv_undef; else if( v.type() == val_int ) value = newSViv( v.Int() ); else if( v.type() == val_float ) value = newSVnv( v.Float() ); else if( v.type() == val_type_feats ) value = newRV_noinc((SV*) features_to_PerlHash(feats(v)) ); // else if( v.type() == val_type_featfunc ){ // if( evaluate_ff ){ // EST_Val tempval = ((featfunc)(*v))(##SHOULD BE AN ITEM##); // if( tempval.type() == val_int ) // value = newSViv( tempval.Int() ); // // else if( tempval.type() == val_float ) // value = newSVnv( tempval.Float() ); // // else{ // EST_String s( tempval.string() ); // value = newSVpvn( s.str(), s.length() ); // } // } // else{ // EST_String s( v.string() ); // value = newSVpvn( s.str(), s.length() ); // } else{ EST_String s( v.string() ); value = newSVpvn( s.str(), s.length() ); } char *key = (char*)(p->k); // should we check for duplicates before doing the store? hv_store(result, key, strlen(key), value, 0); } return result; } #include "EST_error.h" #define SWIG_MemoryError 1 #define SWIG_IOError 2 #define SWIG_RuntimeError 3 #define SWIG_IndexError 4 #define SWIG_TypeError 5 #define SWIG_DivisionByZero 6 #define SWIG_OverflowError 7 #define SWIG_SyntaxError 8 #define SWIG_ValueError 9 #define SWIG_SystemError 10 #define SWIG_UnknownError 99 #define SWIG_exception(a,b) SWIG_croak(b) #include static EST_Item *EST_Item_prepend_daughter(EST_Item *self,EST_Item *p){ return prepend_daughter( self, p ); } static EST_Item *EST_Item_append_daughter(EST_Item *self,EST_Item *p){ return append_daughter( self, p ); } static EST_Item *EST_Item_daughter1(EST_Item *self){ return daughter1( self ); } static EST_Item *EST_Item_daughtern(EST_Item *self){ return daughtern( self ); } static EST_Item *EST_Item_next_sibling(EST_Item *self){ return next_sibling( self ); } static EST_Item *EST_Item_prev_sibling(EST_Item *self){ return prev_sibling( self ); } static EST_Item *EST_Item_parent(EST_Item *self){ return parent( self ); } #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_EST_Item_var:: class _wrap_EST_Item_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { MAGIC_PPERL sv = sv; mg = mg; croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_new_EST_Item__SWIG_0) { { EST_Item *result; int argvi = 0; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: new_EST_Item();"); } result = (EST_Item *)new EST_Item(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Item__SWIG_1) { { EST_Item *arg1 = 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Item(item);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Item. Expected _p_EST_Item"); } } result = (EST_Item *)new EST_Item((EST_Item const &)*arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Item__SWIG_2) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Item(rel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Item. Expected _p_EST_Relation"); } } result = (EST_Item *)new EST_Item(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Item__SWIG_3) { { EST_Relation *arg1 = (EST_Relation *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: new_EST_Item(rel,si);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Item. Expected _p_EST_Relation"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of new_EST_Item. Expected _p_EST_Item"); } } result = (EST_Item *)new EST_Item(arg1,arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Item) { dXSARGS; if (items == 0) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Item__SWIG_0); return; } if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Item__SWIG_1); return; } } if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Item__SWIG_2); return; } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Relation, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Item__SWIG_3); return; } } } croak("No matching function for overloaded 'new_EST_Item'"); XSRETURN(0); } XS(_wrap_delete_EST_Item) { { EST_Item *arg1 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: delete_EST_Item(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of delete_EST_Item. Expected _p_EST_Item"); } } delete arg1; XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_F) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; float result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_F(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_F. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (float)((EST_Item const *)arg1)->F((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@@*/ } ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_S) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_String result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_S(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_S. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = ((EST_Item const *)arg1)->S((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@@*/ } ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_I) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; int result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_I(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_I. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } result = (int)((EST_Item const *)arg1)->I((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@@*/ } ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_A) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_Features *result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_A(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_A. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } { EST_Features &_result_ref = ((EST_Item const *)arg1)->A((EST_String const &)*arg2); result = (EST_Features *) &_result_ref; } END_CATCH_ERRORS(); } /*@@*/ } ST(argvi) = sv_newmortal(); sv_setsv( (SV*)ST(argvi++), (SV*)newRV_noinc((SV*)features_to_PerlHash(result)) ); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_set__SWIG_0) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Item_set(self,name,ival);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_set. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); arg3 = (int) SvIV(ST(2)); { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,arg3); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_set__SWIG_1) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; double arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Item_set(self,name,fval);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_set. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); arg3 = (double) SvNV(ST(2)); { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,arg3); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_set__SWIG_2) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Item_set(self,name,cval);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_set. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); if (!SvOK((SV*) ST(2))) arg3 = 0; else arg3 = (char *) SvPV(ST(2), PL_na); { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,(char const *)arg3); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_set__SWIG_3) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; EST_Features *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Item_set(self,name,f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_set. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Features,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Item_set. Expected _p_EST_Features"); } } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set((char const *)arg2,*arg3); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_set) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Features, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Item_set__SWIG_3); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Item_set__SWIG_0); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Item_set__SWIG_1); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Item, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Item_set__SWIG_2); return; } } } } croak("No matching function for overloaded 'EST_Item_set'"); XSRETURN(0); } XS(_wrap_EST_Item_set_function) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_String *arg3 = 0 ; EST_String temp2 ; EST_String temp3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Item_set_function(self,name,funcname);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_set_function. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { STRLEN len; const char* str = SvPV(ST(2), len); temp3 = EST_String( str, len, 0, len ); arg3 = &temp3; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->set_function(*arg2,*arg3); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_f_remove) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_f_remove(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_f_remove. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } { /*@../interface/EST_error.i,38,CATCH_EST_ERROR@*/{ char *p=EST_error_message; CATCH_ERRORS() { SWIG_exception(SWIG_RuntimeError, p); } (arg1)->f_remove((EST_String const &)*arg2); END_CATCH_ERRORS(); } /*@@*/ } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_evaluate_features) { { EST_Item *arg1 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_evaluate_features(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_evaluate_features. Expected _p_EST_Item"); } } (arg1)->evaluate_features(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_f_present) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; int result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_f_present(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_f_present. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Item const *)arg1)->f_present((EST_String const &)*arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_length) { { EST_Item *arg1 = (EST_Item *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_length(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_length. Expected _p_EST_Item"); } } result = (int)((EST_Item const *)arg1)->length(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_as_relation) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_as_relation(self,relname);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_as_relation. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (EST_Item *)((EST_Item const *)arg1)->as_relation((char const *)arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_in_relation) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; int result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_in_relation(self,relname);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_in_relation. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (int)((EST_Item const *)arg1)->in_relation((EST_String const &)*arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_relation_name) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_relation_name(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_relation_name. Expected _p_EST_Item"); } } { EST_String const &_result_ref = ((EST_Item const *)arg1)->relation_name(); result = (EST_String *) &_result_ref; } ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)(*result), result->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_relation) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Relation *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_relation(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_relation. Expected _p_EST_Item"); } } result = (EST_Relation *)((EST_Item const *)arg1)->relation(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Relation, 0|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_same_item) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_same_item(self,li);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_same_item. Expected _p_EST_Item"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Item_same_item. Expected _p_EST_Item"); } } result = (int)((EST_Item const *)arg1)->same_item((EST_Item const *)arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_unref_all) { { EST_Item *arg1 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_unref_all(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_unref_all. Expected _p_EST_Item"); } } (arg1)->unref_all(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_prepend_daughter) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_prepend_daughter(self,p);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_prepend_daughter. Expected _p_EST_Item"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Item_prepend_daughter. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_prepend_daughter(arg1,arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_append_daughter) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Item_append_daughter(self,p);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_append_daughter. Expected _p_EST_Item"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Item_append_daughter. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_append_daughter(arg1,arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_daughter1) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_daughter1(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_daughter1. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_daughter1(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_daughtern) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_daughtern(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_daughtern. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_daughtern(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_next_sibling) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_next_sibling(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_next_sibling. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_next_sibling(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_prev_sibling) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_prev_sibling(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_prev_sibling. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_prev_sibling(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_parent) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_parent(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_parent. Expected _p_EST_Item"); } } result = (EST_Item *)EST_Item_parent(arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Item_features) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Features *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Item_features(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Item_features. Expected _p_EST_Item"); } } { EST_Features &_result_ref = (arg1)->features(); result = (EST_Features *) &_result_ref; } ST(argvi) = sv_newmortal(); sv_setsv( (SV*)ST(argvi++), (SV*)newRV_noinc((SV*)features_to_PerlHash(result)) ); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_as) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: as(n,relname);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of as. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (EST_Item *)as((EST_Item const *)arg1,(char const *)arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_next_item) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: next_item(node);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of next_item. Expected _p_EST_Item"); } } result = (EST_Item *)next_item((EST_Item const *)arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_first_leaf) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: first_leaf(n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of first_leaf. Expected _p_EST_Item"); } } result = (EST_Item *)first_leaf((EST_Item const *)arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_last_leaf) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: last_leaf(n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of last_leaf. Expected _p_EST_Item"); } } result = (EST_Item *)last_leaf((EST_Item const *)arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_next_leaf) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: next_leaf(n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of next_leaf. Expected _p_EST_Item"); } } result = (EST_Item *)next_leaf((EST_Item const *)arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_num_leaves) { { EST_Item *arg1 = (EST_Item *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: num_leaves(n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of num_leaves. Expected _p_EST_Item"); } } result = (int)num_leaves((EST_Item const *)arg1); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_remove_item) { { EST_Item *arg1 = (EST_Item *) 0 ; char *arg2 = (char *) 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: remove_item(l,relname);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of remove_item. Expected _p_EST_Item"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); remove_item(arg1,(char const *)arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_copy_node_tree) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: copy_node_tree(from,to);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of copy_node_tree. Expected _p_EST_Item"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of copy_node_tree. Expected _p_EST_Item"); } } copy_node_tree(arg1,arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_copy_node_tree_contents) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_Item *arg2 = (EST_Item *) 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: copy_node_tree_contents(from,to);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of copy_node_tree_contents. Expected _p_EST_Item"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 2 of copy_node_tree_contents. Expected _p_EST_Item"); } } copy_node_tree_contents(arg1,arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_item_jump) { { EST_Item *arg1 = (EST_Item *) 0 ; EST_String *arg2 = 0 ; EST_Item *result; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: item_jump(from,to);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Item,0) < 0) { SWIG_croak("Type error in argument 1 of item_jump. Expected _p_EST_Item"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } result = (EST_Item *)item_jump(arg1,(EST_String const &)*arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Item, SWIG_SHADOW|0); XSRETURN(argvi); fail: ; } croak(Nullch); } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_Features = {"_p_EST_Features", "EST_Features *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Item = {"EST_Item::EST_Item", "EST_Item *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_Features, &_swigt__p_EST_Item, &_swigt__p_EST_Relation, }; static swig_cast_info _swigc__p_EST_Features[] = { {&_swigt__p_EST_Features, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Item[] = { {&_swigt__p_EST_Item, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_Features, _swigc__p_EST_Item, _swigc__p_EST_Relation, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_constant_info swig_constants[] = { {0,0,0,0,0,0} }; #ifdef __cplusplus } #endif static swig_variable_info swig_variables[] = { {0,0,0,0} }; static swig_command_info swig_commands[] = { {"EST_Itemc::new_EST_Item", _wrap_new_EST_Item}, {"EST_Itemc::delete_EST_Item", _wrap_delete_EST_Item}, {"EST_Itemc::EST_Item_F", _wrap_EST_Item_F}, {"EST_Itemc::EST_Item_S", _wrap_EST_Item_S}, {"EST_Itemc::EST_Item_I", _wrap_EST_Item_I}, {"EST_Itemc::EST_Item_A", _wrap_EST_Item_A}, {"EST_Itemc::EST_Item_set", _wrap_EST_Item_set}, {"EST_Itemc::EST_Item_set_function", _wrap_EST_Item_set_function}, {"EST_Itemc::EST_Item_f_remove", _wrap_EST_Item_f_remove}, {"EST_Itemc::EST_Item_evaluate_features", _wrap_EST_Item_evaluate_features}, {"EST_Itemc::EST_Item_f_present", _wrap_EST_Item_f_present}, {"EST_Itemc::EST_Item_length", _wrap_EST_Item_length}, {"EST_Itemc::EST_Item_as_relation", _wrap_EST_Item_as_relation}, {"EST_Itemc::EST_Item_in_relation", _wrap_EST_Item_in_relation}, {"EST_Itemc::EST_Item_relation_name", _wrap_EST_Item_relation_name}, {"EST_Itemc::EST_Item_relation", _wrap_EST_Item_relation}, {"EST_Itemc::EST_Item_same_item", _wrap_EST_Item_same_item}, {"EST_Itemc::EST_Item_unref_all", _wrap_EST_Item_unref_all}, {"EST_Itemc::EST_Item_prepend_daughter", _wrap_EST_Item_prepend_daughter}, {"EST_Itemc::EST_Item_append_daughter", _wrap_EST_Item_append_daughter}, {"EST_Itemc::EST_Item_daughter1", _wrap_EST_Item_daughter1}, {"EST_Itemc::EST_Item_daughtern", _wrap_EST_Item_daughtern}, {"EST_Itemc::EST_Item_next_sibling", _wrap_EST_Item_next_sibling}, {"EST_Itemc::EST_Item_prev_sibling", _wrap_EST_Item_prev_sibling}, {"EST_Itemc::EST_Item_parent", _wrap_EST_Item_parent}, {"EST_Itemc::EST_Item_features", _wrap_EST_Item_features}, {"EST_Itemc::as", _wrap_as}, {"EST_Itemc::next_item", _wrap_next_item}, {"EST_Itemc::first_leaf", _wrap_first_leaf}, {"EST_Itemc::last_leaf", _wrap_last_leaf}, {"EST_Itemc::next_leaf", _wrap_next_leaf}, {"EST_Itemc::num_leaves", _wrap_num_leaves}, {"EST_Itemc::remove_item", _wrap_remove_item}, {"EST_Itemc::copy_node_tree", _wrap_copy_node_tree}, {"EST_Itemc::copy_node_tree_contents", _wrap_copy_node_tree_contents}, {"EST_Itemc::item_jump", _wrap_item_jump}, {0,0} }; /************************************************************************* * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. **/ #ifdef __cplusplus extern "C" { #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { swig_type_info *type, *ret; swig_cast_info *cast; size_t i; swig_module_info *module_head; static int init_run = 0; clientdata = clientdata; if (init_run) return; init_run = 1; /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; } else { /* This is the first module loaded */ swig_module.next = &swig_module; SWIG_SetModule(clientdata, &swig_module); } /* Now work on filling in swig_module.types */ for (i = 0; i < swig_module.size; ++i) { type = 0; /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); } if (ret && type == swig_module.type_initial[i]) { cast->type = ret; ret = 0; } if (!ret) { if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" #endif XS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_EST_Item, (void*) "EST_Item::EST_Item"); ST(0) = &PL_sv_yes; XSRETURN(1); } speech_tools/wrappers/perl5/EST_Wave_wrap.cc0000644000076400007640000037344110453550564017553 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.25 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus template class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } SwigValueWrapper(const T& t) : tt(new T(t)) { } ~SwigValueWrapper() { delete tt; } SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } operator T&() const { return *tt; } T *operator&() { return tt; } private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); }; #endif /*********************************************************************** * * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ************************************************************************/ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) || defined(__ICC) # define SWIGUNUSED __attribute__ ((unused)) # else # define SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods for Windows DLLs */ #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # define SWIGEXPORT # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /*********************************************************************** * swigrun.swg * * This file contains generic CAPI SWIG runtime support for pointer * type checking. * ************************************************************************/ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the swig runtime code. In 99.9% of the cases, swig just needs to declare them as 'static'. But only do this if is strictly necessary, ie, if you have problems with your compiler or so. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (int)(*f1 - *f2); } return (l1 - f1) - (l2 - f2); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* think of this as a c++ template<> or a scheme macro */ #define SWIG_TypeCheck_Template(comparison, ty) \ if (ty) { \ swig_cast_info *iter = ty->cast; \ while (iter) { \ if (comparison) { \ if (iter == ty->cast) return iter; \ /* Move iter to the top of the linked list */ \ iter->prev->next = iter->next; \ if (iter->next) \ iter->next->prev = iter->prev; \ iter->next = ty->cast; \ iter->prev = 0; \ if (ty->cast) ty->cast->prev = iter; \ ty->cast = iter; \ return iter; \ } \ iter = iter->next; \ } \ } \ return 0 /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); } /* Same as previous function, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { SWIG_TypeCheck_Template(iter->type == from, into); } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { if (!ti->clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) SWIG_TypeClientData(cast->type, clientdata); cast = cast->next; } } } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu = 0; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* ---------------------------------------------------------------------- -*- c -*- * perl5.swg * * Perl5 runtime library * $Header: /home/CVS/speech_tools/wrappers/perl5/EST_Wave_wrap.cc,v 1.2 2006/06/13 15:12:47 robert Exp $ * ----------------------------------------------------------------------------- */ #define SWIGPERL #define SWIGPERL5 #ifdef __cplusplus /* Needed on some windows machines---since MS plays funny games with the header files under C++ */ #include #include extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Get rid of free and malloc defined by perl */ #undef free #undef malloc #ifndef pTHX_ #define pTHX_ #endif #include #ifdef __cplusplus } #endif /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) #else # ifndef MULTIPLICITY # define SWIG_CALLXS(_name) _name(cv) # else # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) # endif #endif /* Contract support */ #define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else /* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC #else #define MAGIC_PPERL #define SWIGCLASS_STATIC static #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #else #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus } #endif #endif #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) #endif /* Modifications for newer Perl 5.005 releases */ #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) # ifndef PL_sv_yes # define PL_sv_yes sv_yes # endif # ifndef PL_sv_undef # define PL_sv_undef sv_undef # endif # ifndef PL_na # define PL_na na # endif #endif #include #ifdef __cplusplus extern "C" { #endif #define SWIG_OWNER 1 #define SWIG_SHADOW 2 /* Common SWIG API */ #ifdef PERL_OBJECT # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(pPerl, p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags) #else # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(sv, p, s, type ) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(obj, p, s, type, flags) #endif /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) /* Perl-specific API */ #ifdef PERL_OBJECT # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(pPerl, str) #else # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(str) # define SWIG_SetErrorSV(str) \ SWIG_Perl_SetErrorSV(str) #endif #define SWIG_SetErrorf SWIG_Perl_SetErrorf #ifdef PERL_OBJECT # define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl, #else # define SWIG_MAYBE_PERL_OBJECT #endif static swig_cast_info * SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) { SWIG_TypeCheck_Template(sv_derived_from(rv, (char *) iter->type->name), ty); } /* Function for getting a pointer value */ static int SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { swig_cast_info *tc; void *voidptr = (void *)0; /* If magical, apply more magic */ if (SvGMAGICAL(sv)) mg_get(sv); /* Check to see if this is an object */ if (sv_isobject(sv)) { SV *tsv = (SV*) SvRV(sv); IV tmp = 0; if ((SvTYPE(tsv) == SVt_PVHV)) { MAGIC *mg; if (SvMAGICAL(tsv)) { mg = mg_find(tsv,'P'); if (mg) { sv = mg->mg_obj; if (sv_isobject(sv)) { tmp = SvIV((SV*)SvRV(sv)); } } } else { return -1; } } else { tmp = SvIV((SV*)SvRV(sv)); } voidptr = (void *)tmp; if (!_t) { *(ptr) = voidptr; return 0; } } else if (! SvOK(sv)) { /* Check for undef */ *(ptr) = (void *) 0; return 0; } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ *(ptr) = (void *) 0; if (!SvROK(sv)) return 0; else return -1; } else { /* Don't know what it is */ *(ptr) = (void *) 0; return -1; } if (_t) { /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeCheck(_c,_t); if (!tc) { *ptr = voidptr; return -1; } *ptr = SWIG_TypeCast(tc,voidptr); return 0; } *ptr = voidptr; return 0; } static void SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { if (ptr && (flags & SWIG_SHADOW)) { SV *self; SV *obj=newSV(0); HV *hash=newHV(); HV *stash; sv_setref_pv(obj, (char *) t->name, ptr); stash=SvSTASH(SvRV(obj)); if (flags & SWIG_OWNER) { HV *hv; GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); if (!isGV(gv)) gv_init(gv, stash, "OWNER", 5, FALSE); hv=GvHVn(gv); hv_store_ent(hv, obj, newSViv(1), 0); } sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); SvREFCNT_dec(obj); self=newRV_noinc((SV *)hash); sv_setsv(sv, self); SvREFCNT_dec((SV *)self); sv_bless(sv, stash); } else { sv_setref_pv(sv, (char *) t->name, ptr); } } static SWIGINLINE SV * SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { SV *result = sv_newmortal(); SWIG_MakePtr(result, ptr, t, flags); return result; } static void SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(type->name)) > 1000) return; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); strcpy(r,type->name); sv_setpv(sv, result); } /* Convert a packed value value */ static int SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) { swig_cast_info *tc; const char *c = 0; if ((!obj) || (!SvOK(obj))) return -1; c = SvPV(obj, PL_na); /* Pointer values must start with leading underscore */ if (*c != '_') return -1; c++; c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) return -1; } return 0; } static SWIGINLINE void SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) { if (error) sv_setpv(perl_get_sv("@", TRUE), error); } static SWIGINLINE void SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) { if (error) sv_setsv(perl_get_sv("@", TRUE), error); } static void SWIG_Perl_SetErrorf(const char *fmt, ...) { va_list args; va_start(args, fmt); sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*)); va_end(args); } /* Macros for low-level exception handling */ #define SWIG_fail goto fail #define SWIG_croak(x) { SWIG_SetError(x); goto fail; } #define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; } /* most preprocessors do not support vararg macros :-( */ /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ typedef XS(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ typedef struct { const char *name; SwigPerlWrapperPtr wrapper; } swig_command_info; /* Information for constant table */ #define SWIG_INT 1 #define SWIG_FLOAT 2 #define SWIG_STRING 3 #define SWIG_POINTER 4 #define SWIG_BINARY 5 /* Constant information structure */ typedef struct swig_constant_info { int type; const char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_constant_info; #ifdef __cplusplus } #endif /* Structure for variable table */ typedef struct { const char *name; SwigMagicFunc set; SwigMagicFunc get; swig_type_info **type; } swig_variable_info; /* Magic variable code */ #ifndef PERL_OBJECT #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) #ifndef MULTIPLICITY static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) { #else static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { #endif #else # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { #endif MAGIC *mg; sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; } static swig_module_info * SWIG_Perl_GetModule() { static void *type_pointer = (void *)0; SV *pointer; /* first check if pointer already created */ if (!type_pointer) { pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } } return (swig_module_info *) type_pointer; } static void SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); sv_setiv(pointer, PTR2IV(module)); } #ifdef do_open #undef do_open #endif #ifdef do_close #undef do_close #endif #ifdef scalar #undef scalar #endif #ifdef list #undef list #endif #ifdef apply #undef apply #endif #ifdef convert #undef convert #endif #ifdef Error #undef Error #endif #ifdef form #undef form #endif #ifdef vform #undef vform #endif #ifdef LABEL #undef LABEL #endif #ifdef METHOD #undef METHOD #endif #ifdef Move #undef Move #endif #ifdef yylex #undef yylex #endif #ifdef yyparse #undef yyparse #endif #ifdef yyerror #undef yyerror #endif #ifdef invert #undef invert #endif #ifdef ref #undef ref #endif #ifdef ENTER #undef ENTER #endif #ifdef read #undef read #endif #ifdef write #undef write #endif #ifdef eof #undef eof #endif /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_Relation swig_types[1] #define SWIGTYPE_p_EST_Track swig_types[2] #define SWIGTYPE_p_EST_Wave swig_types[3] #define SWIGTYPE_p_EST_WaveList swig_types[4] #define SWIGTYPE_p_EST_read_status swig_types[5] #define SWIGTYPE_p_EST_write_status swig_types[6] #define SWIGTYPE_p_short swig_types[7] static swig_type_info *swig_types[8]; static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init boot_EST_Wave #define SWIG_name "EST_Wavec::boot_EST_Wave" #define SWIG_prefix "EST_Wavec::" #ifdef __cplusplus extern "C" #endif #ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif #else SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); #endif #include "EST_Wave.h" #include "EST_wave_aux.h" #include "EST_audio.h" #include "EST_Option.h" static void EST_Wave_info(EST_Wave *self){ wave_info( *self ); } static void EST_Wave_play(EST_Wave *self){ EST_Option empty; play_wave( *self, empty ); } #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_EST_Wave_var:: class _wrap_EST_Wave_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { MAGIC_PPERL sv = sv; mg = mg; croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_EST_Wave_default_sample_rate_get) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_default_sample_rate_get(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_default_sample_rate_get. Expected _p_EST_Wave"); } } result = (int)(int) ((arg1)->default_sample_rate); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Wave__SWIG_0) { { EST_Wave *result; int argvi = 0; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: new_EST_Wave();"); } result = (EST_Wave *)new EST_Wave(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Wave, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Wave__SWIG_1) { { EST_Wave *arg1 = 0 ; EST_Wave *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Wave(a);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Wave. Expected _p_EST_Wave"); } } result = (EST_Wave *)new EST_Wave((EST_Wave const &)*arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Wave, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Wave__SWIG_2) { { int arg1 ; int arg2 ; int arg3 ; EST_Wave *result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: new_EST_Wave(n,c,sr);"); } arg1 = (int) SvIV(ST(0)); arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); result = (EST_Wave *)new EST_Wave(arg1,arg2,arg3); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Wave, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Wave) { dXSARGS; if (items == 0) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Wave__SWIG_0); return; } if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Wave__SWIG_1); return; } } if (items == 3) { int _v; { _v = SvIOK(ST(0)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Wave__SWIG_2); return; } } } } croak("No matching function for overloaded 'new_EST_Wave'"); XSRETURN(0); } XS(_wrap_delete_EST_Wave) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: delete_EST_Wave(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of delete_EST_Wave. Expected _p_EST_Wave"); } } delete arg1; XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_a__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; short result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_a(self,i,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_a. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); result = (short)((EST_Wave const *)arg1)->a(arg2,arg3); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_a__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; short result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_a(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_a. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); result = (short)((EST_Wave const *)arg1)->a(arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_a) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_a__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_a__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Wave_a'"); XSRETURN(0); } XS(_wrap_EST_Wave_a_safe__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; short *result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_a_safe(self,i,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_a_safe. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); { short &_result_ref = (arg1)->a_safe(arg2,arg3); result = (short *) &_result_ref; } ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_short, 0|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_a_safe__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; short *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_a_safe(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_a_safe. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); { short &_result_ref = (arg1)->a_safe(arg2); result = (short *) &_result_ref; } ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_short, 0|0); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_a_safe) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_a_safe__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_a_safe__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Wave_a_safe'"); XSRETURN(0); } XS(_wrap_EST_Wave_set_a__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; short arg4 ; short result; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Wave_set_a(self,i,channel,val);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_a. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); arg4 = (short) SvIV(ST(3)); result = (short)(arg1)->set_a(arg2,arg3,arg4); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_a__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; short result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_set_a(self,i,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_a. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); result = (short)(arg1)->set_a(arg2,arg3); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_a__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; short result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_set_a(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_a. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); result = (short)(arg1)->set_a(arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_a) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_set_a__SWIG_2); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_set_a__SWIG_1); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_set_a__SWIG_0); return; } } } } } croak("No matching function for overloaded 'EST_Wave_set_a'"); XSRETURN(0); } XS(_wrap_EST_Wave_t) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_t(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_t. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); result = (float)((EST_Wave const *)arg1)->t(arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_num_samples) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_num_samples(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_num_samples. Expected _p_EST_Wave"); } } result = (int)((EST_Wave const *)arg1)->num_samples(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_num_channels) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_num_channels(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_num_channels. Expected _p_EST_Wave"); } } result = (int)((EST_Wave const *)arg1)->num_channels(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_sample_rate) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_sample_rate(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_sample_rate. Expected _p_EST_Wave"); } } result = (int)((EST_Wave const *)arg1)->sample_rate(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_sample_rate) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_set_sample_rate(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_sample_rate. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); (arg1)->set_sample_rate(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_length) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_length(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_length. Expected _p_EST_Wave"); } } result = (int)((EST_Wave const *)arg1)->length(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_end) { { EST_Wave *arg1 = (EST_Wave *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_end(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_end. Expected _p_EST_Wave"); } } result = (float)(arg1)->end(); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_have_left_context) { { EST_Wave *arg1 = (EST_Wave *) 0 ; unsigned int arg2 ; bool result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_have_left_context(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_have_left_context. Expected _p_EST_Wave"); } } arg2 = (unsigned int) SvUV(ST(1)); result = (bool)((EST_Wave const *)arg1)->have_left_context(arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_sample_type) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_sample_type(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_sample_type. Expected _p_EST_Wave"); } } result = ((EST_Wave const *)arg1)->sample_type(); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_sample_type) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_set_sample_type(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_sample_type. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_sample_type(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_file_type) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_file_type(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_file_type. Expected _p_EST_Wave"); } } result = ((EST_Wave const *)arg1)->file_type(); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_file_type) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_set_file_type(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_file_type. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_file_type(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_name) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_name(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_name. Expected _p_EST_Wave"); } } result = ((EST_Wave const *)arg1)->name(); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_set_name) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_set_name(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_set_name. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } (arg1)->set_name(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_resize__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Wave_resize(self,num_samples,num_channels,set);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_resize. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); (arg1)->resize(arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_resize__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_resize(self,num_samples,num_channels);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_resize. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); (arg1)->resize(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_resize__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_resize(self,num_samples);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_resize. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); (arg1)->resize(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_resize) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_resize__SWIG_2); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_resize__SWIG_1); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_resize__SWIG_0); return; } } } } } croak("No matching function for overloaded 'EST_Wave_resize'"); XSRETURN(0); } XS(_wrap_EST_Wave_resample) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_resample(self,rate);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_resample. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); (arg1)->resample(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_rescale__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; float arg2 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_rescale(self,gain,normalize);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_rescale. Expected _p_EST_Wave"); } } arg2 = (float) SvNV(ST(1)); arg3 = (int) SvIV(ST(2)); (arg1)->rescale(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_rescale__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; float arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_rescale(self,gain);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_rescale. Expected _p_EST_Wave"); } } arg2 = (float) SvNV(ST(1)); (arg1)->rescale(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_rescale__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_Track *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_rescale(self,factor_contour);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_rescale. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Wave_rescale. Expected _p_EST_Track"); } } (arg1)->rescale((EST_Track const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_rescale) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_rescale__SWIG_2); return; } } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_rescale__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_rescale__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Wave_rescale'"); XSRETURN(0); } XS(_wrap_EST_Wave_clear) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_clear(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_clear. Expected _p_EST_Wave"); } } (arg1)->clear(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_copy) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_Wave *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_copy(self,from);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_copy. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Wave_copy. Expected _p_EST_Wave"); } } (arg1)->copy((EST_Wave const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_fill__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; short arg2 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_fill(self,v,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_fill. Expected _p_EST_Wave"); } } arg2 = (short) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); (arg1)->fill(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_fill__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; short arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_fill(self,v);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_fill. Expected _p_EST_Wave"); } } arg2 = (short) SvIV(ST(1)); (arg1)->fill(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_fill__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_fill(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_fill. Expected _p_EST_Wave"); } } (arg1)->fill(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_fill) { dXSARGS; if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_fill__SWIG_2); return; } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_fill__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_fill__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Wave_fill'"); XSRETURN(0); } XS(_wrap_EST_Wave_empty__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_empty(self,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_empty. Expected _p_EST_Wave"); } } arg2 = (int) SvIV(ST(1)); (arg1)->empty(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_empty__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_empty(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_empty. Expected _p_EST_Wave"); } } (arg1)->empty(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_empty) { dXSARGS; if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_empty__SWIG_1); return; } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_empty__SWIG_0); return; } } } croak("No matching function for overloaded 'EST_Wave_empty'"); XSRETURN(0); } XS(_wrap_EST_Wave_load__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; int arg4 ; int arg5 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Wave_load(self,filename,offset,length,rate);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); result = (arg1)->load(arg2,arg3,arg4,arg5); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; int arg4 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Wave_load(self,filename,offset,length);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); result = (arg1)->load(arg2,arg3,arg4); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; int arg3 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_load(self,filename,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } arg3 = (int) SvIV(ST(2)); result = (arg1)->load(arg2,arg3); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load__SWIG_3) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_load(self,filename);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } result = (arg1)->load(arg2); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load__SWIG_3); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load__SWIG_1); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load__SWIG_0); return; } } } } } } croak("No matching function for overloaded 'EST_Wave_load'"); XSRETURN(0); } XS(_wrap_EST_Wave_load_file__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; int arg8 ; int arg9 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 9) || (items > 9)) { SWIG_croak("Usage: EST_Wave_load_file(self,filename,filetype,sample_rate,sample_type,bo,nc,offset,length);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load_file. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } arg4 = (int) SvIV(ST(3)); { STRLEN len; const char* str = SvPV(ST(4), len); arg5 = EST_String( str, len, 0, len ); } arg6 = (int) SvIV(ST(5)); arg7 = (int) SvIV(ST(6)); arg8 = (int) SvIV(ST(7)); arg9 = (int) SvIV(ST(8)); result = (arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load_file__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; int arg8 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 8) || (items > 8)) { SWIG_croak("Usage: EST_Wave_load_file(self,filename,filetype,sample_rate,sample_type,bo,nc,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load_file. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } arg4 = (int) SvIV(ST(3)); { STRLEN len; const char* str = SvPV(ST(4), len); arg5 = EST_String( str, len, 0, len ); } arg6 = (int) SvIV(ST(5)); arg7 = (int) SvIV(ST(6)); arg8 = (int) SvIV(ST(7)); result = (arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7,arg8); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load_file__SWIG_2) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; int arg4 ; EST_String arg5 ; int arg6 ; int arg7 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 7) || (items > 7)) { SWIG_croak("Usage: EST_Wave_load_file(self,filename,filetype,sample_rate,sample_type,bo,nc);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_load_file. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } arg4 = (int) SvIV(ST(3)); { STRLEN len; const char* str = SvPV(ST(4), len); arg5 = EST_String( str, len, 0, len ); } arg6 = (int) SvIV(ST(5)); arg7 = (int) SvIV(ST(6)); result = (arg1)->load_file(arg2,arg3,arg4,arg5,arg6,arg7); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_load_file) { dXSARGS; if (items == 7) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(6)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load_file__SWIG_2); return; } } } } } } } } if (items == 8) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(6)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(7)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load_file__SWIG_1); return; } } } } } } } } } if (items == 9) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(6)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(7)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(8)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_load_file__SWIG_0); return; } } } } } } } } } } croak("No matching function for overloaded 'EST_Wave_load_file'"); XSRETURN(0); } XS(_wrap_EST_Wave_save__SWIG_0) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Wave_save(self,filename,EST_filetype);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_save. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } result = (arg1)->save(arg2,arg3); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_save__SWIG_1) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Wave_save(self,filename);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_save. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } result = (arg1)->save(arg2); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_save) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_save__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Wave_save__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Wave_save'"); XSRETURN(0); } XS(_wrap_EST_Wave_save_file) { { EST_Wave *arg1 = (EST_Wave *) 0 ; EST_String arg2 ; EST_String arg3 ; EST_String arg4 ; int arg5 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Wave_save_file(self,filename,filetype,sample_type,bo);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_save_file. Expected _p_EST_Wave"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(2), len); arg3 = EST_String( str, len, 0, len ); } { STRLEN len; const char* str = SvPV(ST(3), len); arg4 = EST_String( str, len, 0, len ); } arg5 = (int) SvIV(ST(4)); result = (arg1)->save_file(arg2,arg3,arg4,arg5); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_integrity) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_integrity(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_integrity. Expected _p_EST_Wave"); } } ((EST_Wave const *)arg1)->integrity(); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_info) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_info(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_info. Expected _p_EST_Wave"); } } EST_Wave_info(arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Wave_play) { { EST_Wave *arg1 = (EST_Wave *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Wave_play(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Wave_play. Expected _p_EST_Wave"); } } EST_Wave_play(arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_extract_channel) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: wave_extract_channel(single,multi,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of wave_extract_channel. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of wave_extract_channel. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); result = (int)wave_extract_channel(*arg1,(EST_Wave const &)*arg2,arg3); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_combine_channels) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: wave_combine_channels(combined,multi);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of wave_combine_channels. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of wave_combine_channels. Expected _p_EST_Wave"); } } wave_combine_channels(*arg1,(EST_Wave const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_subwave) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; int arg4 ; int result; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: wave_subwave(subsig,sig,offset,length);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of wave_subwave. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of wave_subwave. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); result = (int)wave_subwave(*arg1,*arg2,arg3,arg4); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_divide) { { EST_WaveList *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Relation *arg3 = 0 ; EST_String *arg4 = 0 ; int result; EST_String temp4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: wave_divide(wl,sig,keylab,ext);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_WaveList,0) < 0) { SWIG_croak("Type error in argument 1 of wave_divide. Expected _p_EST_WaveList"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of wave_divide. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 3 of wave_divide. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(3), len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } result = (int)wave_divide(*arg1,*arg2,*arg3,(EST_String const &)*arg4); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_extract) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Relation *arg3 = 0 ; EST_String *arg4 = 0 ; int result; EST_String temp4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: wave_extract(part,sig,keylab,file);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of wave_extract. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of wave_extract. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Relation,0) < 0) { SWIG_croak("Type error in argument 3 of wave_extract. Expected _p_EST_Relation"); } } { STRLEN len; const char* str = SvPV(ST(3), len); temp4 = EST_String( str, len, 0, len ); arg4 = &temp4; } result = (int)wave_extract(*arg1,*arg2,*arg3,(EST_String const &)*arg4); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_add_waves) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: add_waves(s,m);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of add_waves. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of add_waves. Expected _p_EST_Wave"); } } add_waves(*arg1,(EST_Wave const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_difference) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_Wave result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: difference(a,b);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of difference. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of difference. Expected _p_EST_Wave"); } } result = difference(*arg1,*arg2); { EST_Wave * resultobj = new EST_Wave((EST_Wave &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_Wave, SWIG_SHADOW|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_rms_error__SWIG_0) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; float result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: rms_error(a,b,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of rms_error. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of rms_error. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); result = (float)rms_error(*arg1,*arg2,arg3); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_abs_error__SWIG_0) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; float result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: abs_error(a,b,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of abs_error. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of abs_error. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); result = (float)abs_error(*arg1,*arg2,arg3); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_correlation__SWIG_0) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; float result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: correlation(a,b,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of correlation. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of correlation. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); result = (float)correlation(*arg1,*arg2,arg3); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_rms_error__SWIG_1) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: rms_error(a,b);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of rms_error. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of rms_error. Expected _p_EST_Wave"); } } result = rms_error(*arg1,*arg2); { EST_FVector * resultobj = new EST_FVector((EST_FVector &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_FVector, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_rms_error) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_rms_error__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_rms_error__SWIG_0); return; } } } } croak("No matching function for overloaded 'rms_error'"); XSRETURN(0); } XS(_wrap_abs_error__SWIG_1) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: abs_error(a,b);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of abs_error. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of abs_error. Expected _p_EST_Wave"); } } result = abs_error(*arg1,*arg2); { EST_FVector * resultobj = new EST_FVector((EST_FVector &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_FVector, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_abs_error) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_abs_error__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_abs_error__SWIG_0); return; } } } } croak("No matching function for overloaded 'abs_error'"); XSRETURN(0); } XS(_wrap_correlation__SWIG_1) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; EST_FVector result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: correlation(a,b);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of correlation. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of correlation. Expected _p_EST_Wave"); } } result = correlation(*arg1,*arg2); { EST_FVector * resultobj = new EST_FVector((EST_FVector &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_FVector, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_correlation) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_correlation__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Wave, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_correlation__SWIG_0); return; } } } } croak("No matching function for overloaded 'correlation'"); XSRETURN(0); } XS(_wrap_error) { { EST_Wave *arg1 = 0 ; EST_Wave *arg2 = 0 ; int arg3 ; EST_Wave result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: error(ref,test,relax);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of error. Expected _p_EST_Wave"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 2 of error. Expected _p_EST_Wave"); } } arg3 = (int) SvIV(ST(2)); result = error(*arg1,*arg2,arg3); { EST_Wave * resultobj = new EST_Wave((EST_Wave &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_Wave, SWIG_SHADOW|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_absolute) { { EST_Wave *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: absolute(a);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of absolute. Expected _p_EST_Wave"); } } absolute(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_wave_info) { { EST_Wave *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: wave_info(w);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of wave_info. Expected _p_EST_Wave"); } } wave_info(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_invert) { { EST_Wave *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: invert(sig);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of invert. Expected _p_EST_Wave"); } } invert(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_differentiate) { { EST_Wave *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: differentiate(sig);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of differentiate. Expected _p_EST_Wave"); } } differentiate(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_reverse) { { EST_Wave *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: reverse(sig);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Wave,0) < 0) { SWIG_croak("Type error in argument 1 of reverse. Expected _p_EST_Wave"); } } reverse(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_FVector = {"_p_EST_FVector", "EST_FVector *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Relation = {"_p_EST_Relation", "EST_Relation *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Track = {"_p_EST_Track", "EST_Track *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Wave = {"EST_Wave::EST_Wave", "EST_Wave *", 0, 0, 0}; static swig_type_info _swigt__p_EST_WaveList = {"_p_EST_WaveList", "EST_WaveList *", 0, 0, 0}; static swig_type_info _swigt__p_EST_read_status = {"_p_EST_read_status", "EST_read_status *", 0, 0, 0}; static swig_type_info _swigt__p_EST_write_status = {"_p_EST_write_status", "EST_write_status *", 0, 0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *", 0, 0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_Relation, &_swigt__p_EST_Track, &_swigt__p_EST_Wave, &_swigt__p_EST_WaveList, &_swigt__p_EST_read_status, &_swigt__p_EST_write_status, &_swigt__p_short, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Relation[] = { {&_swigt__p_EST_Relation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Wave[] = { {&_swigt__p_EST_Wave, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_WaveList[] = { {&_swigt__p_EST_WaveList, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_read_status[] = { {&_swigt__p_EST_read_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_write_status[] = { {&_swigt__p_EST_write_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_Relation, _swigc__p_EST_Track, _swigc__p_EST_Wave, _swigc__p_EST_WaveList, _swigc__p_EST_read_status, _swigc__p_EST_write_status, _swigc__p_short, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_constant_info swig_constants[] = { {0,0,0,0,0,0} }; #ifdef __cplusplus } #endif static swig_variable_info swig_variables[] = { {0,0,0,0} }; static swig_command_info swig_commands[] = { {"EST_Wavec::EST_Wave_default_sample_rate_get", _wrap_EST_Wave_default_sample_rate_get}, {"EST_Wavec::new_EST_Wave", _wrap_new_EST_Wave}, {"EST_Wavec::delete_EST_Wave", _wrap_delete_EST_Wave}, {"EST_Wavec::EST_Wave_a", _wrap_EST_Wave_a}, {"EST_Wavec::EST_Wave_a_safe", _wrap_EST_Wave_a_safe}, {"EST_Wavec::EST_Wave_set_a", _wrap_EST_Wave_set_a}, {"EST_Wavec::EST_Wave_t", _wrap_EST_Wave_t}, {"EST_Wavec::EST_Wave_num_samples", _wrap_EST_Wave_num_samples}, {"EST_Wavec::EST_Wave_num_channels", _wrap_EST_Wave_num_channels}, {"EST_Wavec::EST_Wave_sample_rate", _wrap_EST_Wave_sample_rate}, {"EST_Wavec::EST_Wave_set_sample_rate", _wrap_EST_Wave_set_sample_rate}, {"EST_Wavec::EST_Wave_length", _wrap_EST_Wave_length}, {"EST_Wavec::EST_Wave_end", _wrap_EST_Wave_end}, {"EST_Wavec::EST_Wave_have_left_context", _wrap_EST_Wave_have_left_context}, {"EST_Wavec::EST_Wave_sample_type", _wrap_EST_Wave_sample_type}, {"EST_Wavec::EST_Wave_set_sample_type", _wrap_EST_Wave_set_sample_type}, {"EST_Wavec::EST_Wave_file_type", _wrap_EST_Wave_file_type}, {"EST_Wavec::EST_Wave_set_file_type", _wrap_EST_Wave_set_file_type}, {"EST_Wavec::EST_Wave_name", _wrap_EST_Wave_name}, {"EST_Wavec::EST_Wave_set_name", _wrap_EST_Wave_set_name}, {"EST_Wavec::EST_Wave_resize", _wrap_EST_Wave_resize}, {"EST_Wavec::EST_Wave_resample", _wrap_EST_Wave_resample}, {"EST_Wavec::EST_Wave_rescale", _wrap_EST_Wave_rescale}, {"EST_Wavec::EST_Wave_clear", _wrap_EST_Wave_clear}, {"EST_Wavec::EST_Wave_copy", _wrap_EST_Wave_copy}, {"EST_Wavec::EST_Wave_fill", _wrap_EST_Wave_fill}, {"EST_Wavec::EST_Wave_empty", _wrap_EST_Wave_empty}, {"EST_Wavec::EST_Wave_load", _wrap_EST_Wave_load}, {"EST_Wavec::EST_Wave_load_file", _wrap_EST_Wave_load_file}, {"EST_Wavec::EST_Wave_save", _wrap_EST_Wave_save}, {"EST_Wavec::EST_Wave_save_file", _wrap_EST_Wave_save_file}, {"EST_Wavec::EST_Wave_integrity", _wrap_EST_Wave_integrity}, {"EST_Wavec::EST_Wave_info", _wrap_EST_Wave_info}, {"EST_Wavec::EST_Wave_play", _wrap_EST_Wave_play}, {"EST_Wavec::wave_extract_channel", _wrap_wave_extract_channel}, {"EST_Wavec::wave_combine_channels", _wrap_wave_combine_channels}, {"EST_Wavec::wave_subwave", _wrap_wave_subwave}, {"EST_Wavec::wave_divide", _wrap_wave_divide}, {"EST_Wavec::wave_extract", _wrap_wave_extract}, {"EST_Wavec::add_waves", _wrap_add_waves}, {"EST_Wavec::difference", _wrap_difference}, {"EST_Wavec::rms_error", _wrap_rms_error}, {"EST_Wavec::abs_error", _wrap_abs_error}, {"EST_Wavec::correlation", _wrap_correlation}, {"EST_Wavec::error", _wrap_error}, {"EST_Wavec::absolute", _wrap_absolute}, {"EST_Wavec::wave_info", _wrap_wave_info}, {"EST_Wavec::invert", _wrap_invert}, {"EST_Wavec::differentiate", _wrap_differentiate}, {"EST_Wavec::reverse", _wrap_reverse}, {0,0} }; /************************************************************************* * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. **/ #ifdef __cplusplus extern "C" { #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { swig_type_info *type, *ret; swig_cast_info *cast; size_t i; swig_module_info *module_head; static int init_run = 0; clientdata = clientdata; if (init_run) return; init_run = 1; /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; } else { /* This is the first module loaded */ swig_module.next = &swig_module; SWIG_SetModule(clientdata, &swig_module); } /* Now work on filling in swig_module.types */ for (i = 0; i < swig_module.size; ++i) { type = 0; /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); } if (ret && type == swig_module.type_initial[i]) { cast->type = ret; ret = 0; } if (!ret) { if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" #endif XS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_EST_Wave, (void*) "EST_Wave::EST_Wave"); ST(0) = &PL_sv_yes; XSRETURN(1); } speech_tools/wrappers/perl5/EST_Track_wrap.cc0000644000076400007640000061140310357531477017713 0ustar awbawb/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.27 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus template class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } SwigValueWrapper(const T& t) : tt(new T(t)) { } ~SwigValueWrapper() { delete tt; } SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } operator T&() const { return *tt; } T *operator&() { return tt; } private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); }; #endif /*********************************************************************** * * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ************************************************************************/ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) || defined(__ICC) # define SWIGUNUSED __attribute__ ((unused)) # else # define SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods for Windows DLLs */ #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # define SWIGEXPORT # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /*********************************************************************** * swigrun.swg * * This file contains generic CAPI SWIG runtime support for pointer * type checking. * ************************************************************************/ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the swig runtime code. In 99.9% of the cases, swig just needs to declare them as 'static'. But only do this if is strictly necessary, ie, if you have problems with your compiler or so. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (int)(*f1 - *f2); } return (l1 - f1) - (l2 - f2); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* think of this as a c++ template<> or a scheme macro */ #define SWIG_TypeCheck_Template(comparison, ty) \ if (ty) { \ swig_cast_info *iter = ty->cast; \ while (iter) { \ if (comparison) { \ if (iter == ty->cast) return iter; \ /* Move iter to the top of the linked list */ \ iter->prev->next = iter->next; \ if (iter->next) \ iter->next->prev = iter->prev; \ iter->next = ty->cast; \ iter->prev = 0; \ if (ty->cast) ty->cast->prev = iter; \ ty->cast = iter; \ return iter; \ } \ iter = iter->next; \ } \ } \ return 0 /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); } /* Same as previous function, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { SWIG_TypeCheck_Template(iter->type == from, into); } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu = 0; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* ---------------------------------------------------------------------- -*- c -*- * perl5.swg * * Perl5 runtime library * $Header: /home/CVS/speech_tools/wrappers/perl5/EST_Track_wrap.cc,v 1.1 2006/01/06 18:13:19 korin Exp $ * ----------------------------------------------------------------------------- */ #define SWIGPERL #define SWIGPERL5 #ifdef __cplusplus /* Needed on some windows machines---since MS plays funny games with the header files under C++ */ #include #include extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* Get rid of free and malloc defined by perl */ #undef free #undef malloc #ifndef pTHX_ #define pTHX_ #endif #include #ifdef __cplusplus } #endif /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) #else # ifndef MULTIPLICITY # define SWIG_CALLXS(_name) _name(cv) # else # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) # endif #endif /* Contract support */ #define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else /* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC #else #define MAGIC_PPERL #define SWIGCLASS_STATIC static #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #else #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus } #endif #endif #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) #endif /* Modifications for newer Perl 5.005 releases */ #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) # ifndef PL_sv_yes # define PL_sv_yes sv_yes # endif # ifndef PL_sv_undef # define PL_sv_undef sv_undef # endif # ifndef PL_na # define PL_na na # endif #endif #include #ifdef __cplusplus extern "C" { #endif #define SWIG_OWNER 1 #define SWIG_SHADOW 2 /* Common SWIG API */ #ifdef PERL_OBJECT # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(pPerl, p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags) #else # define SWIG_ConvertPtr(obj, pp, type, flags) \ SWIG_Perl_ConvertPtr(obj, pp, type, flags) # define SWIG_NewPointerObj(p, type, flags) \ SWIG_Perl_NewPointerObj(p, type, flags) # define SWIG_MakePackedObj(sv, p, s, type) \ SWIG_Perl_MakePackedObj(sv, p, s, type ) # define SWIG_ConvertPacked(obj, p, s, type, flags) \ SWIG_Perl_ConvertPacked(obj, p, s, type, flags) #endif /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) /* Perl-specific API */ #ifdef PERL_OBJECT # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(pPerl, str) #else # define SWIG_MakePtr(sv, ptr, type, flags) \ SWIG_Perl_MakePtr(sv, ptr, type, flags) # define SWIG_SetError(str) \ SWIG_Perl_SetError(str) # define SWIG_SetErrorSV(str) \ SWIG_Perl_SetErrorSV(str) #endif #define SWIG_SetErrorf SWIG_Perl_SetErrorf #ifdef PERL_OBJECT # define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl, #else # define SWIG_MAYBE_PERL_OBJECT #endif static swig_cast_info * SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) { SWIG_TypeCheck_Template(sv_derived_from(rv, (char *) iter->type->name), ty); } /* Function for getting a pointer value */ static int SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { swig_cast_info *tc; void *voidptr = (void *)0; /* If magical, apply more magic */ if (SvGMAGICAL(sv)) mg_get(sv); /* Check to see if this is an object */ if (sv_isobject(sv)) { SV *tsv = (SV*) SvRV(sv); IV tmp = 0; if ((SvTYPE(tsv) == SVt_PVHV)) { MAGIC *mg; if (SvMAGICAL(tsv)) { mg = mg_find(tsv,'P'); if (mg) { sv = mg->mg_obj; if (sv_isobject(sv)) { tmp = SvIV((SV*)SvRV(sv)); } } } else { return -1; } } else { tmp = SvIV((SV*)SvRV(sv)); } voidptr = (void *)tmp; if (!_t) { *(ptr) = voidptr; return 0; } } else if (! SvOK(sv)) { /* Check for undef */ *(ptr) = (void *) 0; return 0; } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ *(ptr) = (void *) 0; if (!SvROK(sv)) return 0; else return -1; } else { /* Don't know what it is */ *(ptr) = (void *) 0; return -1; } if (_t) { /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeCheck(_c,_t); if (!tc) { *ptr = voidptr; return -1; } *ptr = SWIG_TypeCast(tc,voidptr); return 0; } *ptr = voidptr; return 0; } static void SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { if (ptr && (flags & SWIG_SHADOW)) { SV *self; SV *obj=newSV(0); HV *hash=newHV(); HV *stash; sv_setref_pv(obj, (char *) t->name, ptr); stash=SvSTASH(SvRV(obj)); if (flags & SWIG_OWNER) { HV *hv; GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); if (!isGV(gv)) gv_init(gv, stash, "OWNER", 5, FALSE); hv=GvHVn(gv); hv_store_ent(hv, obj, newSViv(1), 0); } sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); SvREFCNT_dec(obj); self=newRV_noinc((SV *)hash); sv_setsv(sv, self); SvREFCNT_dec((SV *)self); sv_bless(sv, stash); } else { sv_setref_pv(sv, (char *) t->name, ptr); } } static SWIGINLINE SV * SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { SV *result = sv_newmortal(); SWIG_MakePtr(result, ptr, t, flags); return result; } static void SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(type->name)) > 1000) return; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); strcpy(r,type->name); sv_setpv(sv, result); } /* Convert a packed value value */ static int SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) { swig_cast_info *tc; const char *c = 0; if ((!obj) || (!SvOK(obj))) return -1; c = SvPV(obj, PL_na); /* Pointer values must start with leading underscore */ if (*c != '_') return -1; c++; c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) return -1; } return 0; } static SWIGINLINE void SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) { if (error) sv_setpv(perl_get_sv("@", TRUE), error); } static SWIGINLINE void SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) { if (error) sv_setsv(perl_get_sv("@", TRUE), error); } static void SWIG_Perl_SetErrorf(const char *fmt, ...) { va_list args; va_start(args, fmt); sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*)); va_end(args); } /* Macros for low-level exception handling */ #define SWIG_fail goto fail #define SWIG_croak(x) { SWIG_SetError(x); goto fail; } #define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; } /* most preprocessors do not support vararg macros :-( */ /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ typedef XS(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ typedef struct { const char *name; SwigPerlWrapperPtr wrapper; } swig_command_info; /* Information for constant table */ #define SWIG_INT 1 #define SWIG_FLOAT 2 #define SWIG_STRING 3 #define SWIG_POINTER 4 #define SWIG_BINARY 5 /* Constant information structure */ typedef struct swig_constant_info { int type; const char *name; long lvalue; double dvalue; void *pvalue; swig_type_info **ptype; } swig_constant_info; #ifdef __cplusplus } #endif /* Structure for variable table */ typedef struct { const char *name; SwigMagicFunc set; SwigMagicFunc get; swig_type_info **type; } swig_variable_info; /* Magic variable code */ #ifndef PERL_OBJECT #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) #ifndef MULTIPLICITY static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) { #else static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { #endif #else # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { #endif MAGIC *mg; sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; } static swig_module_info * SWIG_Perl_GetModule() { static void *type_pointer = (void *)0; SV *pointer; /* first check if pointer already created */ if (!type_pointer) { pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } } return (swig_module_info *) type_pointer; } static void SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); sv_setiv(pointer, PTR2IV(module)); } #ifdef do_open #undef do_open #endif #ifdef do_close #undef do_close #endif #ifdef scalar #undef scalar #endif #ifdef list #undef list #endif #ifdef apply #undef apply #endif #ifdef convert #undef convert #endif #ifdef Error #undef Error #endif #ifdef form #undef form #endif #ifdef vform #undef vform #endif #ifdef LABEL #undef LABEL #endif #ifdef METHOD #undef METHOD #endif #ifdef Move #undef Move #endif #ifdef yylex #undef yylex #endif #ifdef yyparse #undef yyparse #endif #ifdef yyerror #undef yyerror #endif #ifdef invert #undef invert #endif #ifdef ref #undef ref #endif #ifdef ENTER #undef ENTER #endif #ifdef read #undef read #endif #ifdef write #undef write #endif #ifdef eof #undef eof #endif #ifdef bool #undef bool #endif #ifdef close #undef close #endif #ifdef rewind #undef rewind #endif /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_EST_FVector swig_types[0] #define SWIGTYPE_p_EST_IVector swig_types[1] #define SWIGTYPE_p_EST_Track swig_types[2] #define SWIGTYPE_p_EST_read_status swig_types[3] #define SWIGTYPE_p_EST_write_status swig_types[4] #define SWIGTYPE_p_float swig_types[5] static swig_type_info *swig_types[7]; static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init boot_EST_Track #define SWIG_name "EST_Trackc::boot_EST_Track" #define SWIG_prefix "EST_Trackc::" #ifdef __cplusplus extern "C" #endif #ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif #else SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); #endif #include "EST_Track.h" #include "EST_track_aux.h" #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_EST_Track_var:: class _wrap_EST_Track_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { MAGIC_PPERL sv = sv; mg = mg; croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_EST_Track_default_frame_shift_get) { { EST_Track *arg1 = (EST_Track *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_default_frame_shift_get(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_default_frame_shift_get. Expected _p_EST_Track"); } } result = (float)(float) ((arg1)->default_frame_shift); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_default_sample_rate_get) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_default_sample_rate_get(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_default_sample_rate_get. Expected _p_EST_Track"); } } result = (int)(int) ((arg1)->default_sample_rate); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Track__SWIG_0) { { EST_Track *result; int argvi = 0; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: new_EST_Track();"); } result = (EST_Track *)new EST_Track(); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Track, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Track__SWIG_1) { { EST_Track *arg1 = 0 ; EST_Track *result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: new_EST_Track(a);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of new_EST_Track. Expected _p_EST_Track"); } } result = (EST_Track *)new EST_Track((EST_Track const &)*arg1); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Track, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Track__SWIG_2) { { int arg1 ; int arg2 ; EST_Track *result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: new_EST_Track(num_frames,num_channels);"); } arg1 = (int) SvIV(ST(0)); arg2 = (int) SvIV(ST(1)); result = (EST_Track *)new EST_Track(arg1,arg2); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_EST_Track, SWIG_SHADOW|SWIG_OWNER); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_new_EST_Track) { dXSARGS; if (items == 0) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Track__SWIG_0); return; } if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Track__SWIG_1); return; } } if (items == 2) { int _v; { _v = SvIOK(ST(0)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_new_EST_Track__SWIG_2); return; } } } croak("No matching function for overloaded 'new_EST_Track'"); XSRETURN(0); } XS(_wrap_delete_EST_Track) { { EST_Track *arg1 = (EST_Track *) 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: delete_EST_Track(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of delete_EST_Track. Expected _p_EST_Track"); } } delete arg1; XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_resize__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; bool arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_resize(self,num_frames,num_channels,preserve);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_resize. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); arg4 = SvIV(ST(3)) ? true : false; (arg1)->resize(arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_resize__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_resize(self,num_frames,num_channels);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_resize. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); (arg1)->resize(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_resize) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_resize__SWIG_1); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_resize__SWIG_0); return; } } } } } croak("No matching function for overloaded 'EST_Track_resize'"); XSRETURN(0); } XS(_wrap_EST_Track_set_num_channels__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; bool arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_set_num_channels(self,n,preserve);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_num_channels. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = SvIV(ST(2)) ? true : false; (arg1)->set_num_channels(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_num_channels__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_set_num_channels(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_num_channels. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); (arg1)->set_num_channels(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_num_channels) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_set_num_channels__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_set_num_channels__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_set_num_channels'"); XSRETURN(0); } XS(_wrap_EST_Track_set_num_frames__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; bool arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_set_num_frames(self,n,preserve);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_num_frames. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = SvIV(ST(2)) ? true : false; (arg1)->set_num_frames(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_num_frames__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_set_num_frames(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_num_frames. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); (arg1)->set_num_frames(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_num_frames) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_set_num_frames__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_set_num_frames__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_set_num_frames'"); XSRETURN(0); } XS(_wrap_EST_Track_set_channel_name) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; int arg3 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_set_channel_name(self,name,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_channel_name. Expected _p_EST_Track"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } arg3 = (int) SvIV(ST(2)); (arg1)->set_channel_name((EST_String const &)*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_aux_channel_name) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; int arg3 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_set_aux_channel_name(self,name,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_aux_channel_name. Expected _p_EST_Track"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } arg3 = (int) SvIV(ST(2)); (arg1)->set_aux_channel_name((EST_String const &)*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_setup) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_copy_setup(self,a);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_setup. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_setup. Expected _p_EST_Track"); } } (arg1)->copy_setup((EST_Track const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_name) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_name(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_name. Expected _p_EST_Track"); } } result = ((EST_Track const *)arg1)->name(); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_name) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String *arg2 = 0 ; EST_String temp2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_set_name(self,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_name. Expected _p_EST_Track"); } } { STRLEN len; const char* str = SvPV(ST(1), len); temp2 = EST_String( str, len, 0, len ); arg2 = &temp2; } (arg1)->set_name((EST_String const &)*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_frame__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_frame(self,fv,n,startf,nf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_frame. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_frame. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->frame(*arg2,arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_frame__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_frame(self,fv,n,startf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_frame. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_frame. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); (arg1)->frame(*arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_frame__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_frame(self,fv,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_frame. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_frame. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); (arg1)->frame(*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_frame) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_frame__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_frame__SWIG_1); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_frame__SWIG_0); return; } } } } } } croak("No matching function for overloaded 'EST_Track_frame'"); XSRETURN(0); } XS(_wrap_EST_Track_channel__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_channel(self,cv,n,startf,nf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->channel(*arg2,arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_channel(self,cv,n,startf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); (arg1)->channel(*arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_channel(self,cv,n);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } arg3 = (int) SvIV(ST(2)); (arg1)->channel(*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_channel(self,cv,name,startf,nf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } if (!SvOK((SV*) ST(2))) arg3 = 0; else arg3 = (char *) SvPV(ST(2), PL_na); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->channel(*arg2,(char const *)arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel__SWIG_4) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_channel(self,cv,name,startf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } if (!SvOK((SV*) ST(2))) arg3 = 0; else arg3 = (char *) SvPV(ST(2), PL_na); arg4 = (int) SvIV(ST(3)); (arg1)->channel(*arg2,(char const *)arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel__SWIG_5) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_FVector *arg2 = 0 ; char *arg3 = (char *) 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_channel(self,cv,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_channel. Expected _p_EST_FVector"); } } if (!SvOK((SV*) ST(2))) arg3 = 0; else arg3 = (char *) SvPV(ST(2), PL_na); (arg1)->channel(*arg2,(char const *)arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_2); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_5); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_1); return; } } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_4); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_0); return; } } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel__SWIG_3); return; } } } } } } croak("No matching function for overloaded 'EST_Track_channel'"); XSRETURN(0); } XS(_wrap_EST_Track_sub_track__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; int argvi = 0; dXSARGS; if ((items < 6) || (items > 6)) { SWIG_croak("Usage: EST_Track_sub_track(self,st,start_frame,nframes,start_chan,nchans);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); (arg1)->sub_track(*arg2,arg3,arg4,arg5,arg6); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sub_track__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_sub_track(self,st,start_frame,nframes,start_chan);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->sub_track(*arg2,arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sub_track__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_sub_track(self,st,start_frame,nframes);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); (arg1)->sub_track(*arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sub_track__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_sub_track(self,st,start_frame);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); (arg1)->sub_track(*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sub_track__SWIG_4) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_sub_track(self,st);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_sub_track. Expected _p_EST_Track"); } } (arg1)->sub_track(*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sub_track) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_sub_track__SWIG_4); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_sub_track__SWIG_3); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_sub_track__SWIG_2); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_sub_track__SWIG_1); return; } } } } } } if (items == 6) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_sub_track__SWIG_0); return; } } } } } } } croak("No matching function for overloaded 'EST_Track_sub_track'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_sub_track__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int arg6 ; int argvi = 0; dXSARGS; if ((items < 6) || (items > 6)) { SWIG_croak("Usage: EST_Track_copy_sub_track(self,st,start_frame,nframes,start_chan,nchans);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4,arg5,arg6); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_sub_track(self,st,start_frame,nframes,start_chan);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_sub_track(self,st,start_frame,nframes);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); arg4 = (int) SvIV(ST(3)); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_sub_track(self,st,start_frame);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } arg3 = (int) SvIV(ST(2)); ((EST_Track const *)arg1)->copy_sub_track(*arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track__SWIG_4) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_copy_sub_track(self,st);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track. Expected _p_EST_Track"); } } ((EST_Track const *)arg1)->copy_sub_track(*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track__SWIG_4); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track__SWIG_3); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track__SWIG_2); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track__SWIG_1); return; } } } } } } if (items == 6) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track__SWIG_0); return; } } } } } } } croak("No matching function for overloaded 'EST_Track_copy_sub_track'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_sub_track_out__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_sub_track_out(self,st,frame_times);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track_out. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track_out. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_sub_track_out. Expected _p_EST_FVector"); } } ((EST_Track const *)arg1)->copy_sub_track_out(*arg2,(EST_FVector const &)*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track_out__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; EST_IVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_sub_track_out(self,st,frame_indices);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_sub_track_out. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_copy_sub_track_out. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_IVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_sub_track_out. Expected _p_EST_IVector"); } } ((EST_Track const *)arg1)->copy_sub_track_out(*arg2,(EST_IVector const &)*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_sub_track_out) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track_out__SWIG_0); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_IVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_sub_track_out__SWIG_1); return; } } } } croak("No matching function for overloaded 'EST_Track_copy_sub_track_out'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_channel_out__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_channel_out(self,n,f,offset,nf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_out. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_out__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_channel_out(self,n,f,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_out. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_out__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_channel_out(self,n,f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_out. Expected _p_EST_FVector"); } } ((EST_Track const *)arg1)->copy_channel_out(arg2,*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_out) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_out__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_out__SWIG_1); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_out__SWIG_0); return; } } } } } } croak("No matching function for overloaded 'EST_Track_copy_channel_out'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_frame_out__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_frame_out(self,n,f,offset,nc);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_out. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_out__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_frame_out(self,n,f,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_out. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_out__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_frame_out(self,n,f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_out. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_out. Expected _p_EST_FVector"); } } ((EST_Track const *)arg1)->copy_frame_out(arg2,*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_out) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_out__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_out__SWIG_1); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_out__SWIG_0); return; } } } } } } croak("No matching function for overloaded 'EST_Track_copy_frame_out'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_channel_in__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,n,f,offset,num);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,n,f,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,n,f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_FVector"); } } (arg1)->copy_channel_in(arg2,(EST_FVector const &)*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; int argvi = 0; dXSARGS; if ((items < 7) || (items > 7)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,c,from,from_c,from_offset,offset,num);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); arg7 = (int) SvIV(ST(6)); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6,arg7); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_4) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int argvi = 0; dXSARGS; if ((items < 6) || (items > 6)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,c,from,from_c,from_offset,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_5) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,c,from,from_c,from_offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in__SWIG_6) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_channel_in(self,c,from,from_c);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_channel_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); (arg1)->copy_channel_in(arg2,(EST_Track const &)*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_channel_in) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_1); return; } } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_6); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_5); return; } } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_0); return; } } } } } } if (items == 6) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_4); return; } } } } } } } if (items == 7) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(6)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_channel_in__SWIG_3); return; } } } } } } } } croak("No matching function for overloaded 'EST_Track_copy_channel_in'"); XSRETURN(0); } XS(_wrap_EST_Track_copy_frame_in__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,n,f,offset,nf);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,n,f,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_FVector"); } } arg4 = (int) SvIV(ST(3)); (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,n,f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_FVector"); } } (arg1)->copy_frame_in(arg2,(EST_FVector const &)*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int arg7 ; int argvi = 0; dXSARGS; if ((items < 7) || (items > 7)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,i,from,from_f,from_offset,offset,num);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); arg7 = (int) SvIV(ST(6)); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6,arg7); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_4) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int arg6 ; int argvi = 0; dXSARGS; if ((items < 6) || (items > 6)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,i,from,from_f,from_offset,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); arg6 = (int) SvIV(ST(5)); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5,arg6); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_5) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,i,from,from_f,from_offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); arg5 = (int) SvIV(ST(4)); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in__SWIG_6) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_Track *arg3 = 0 ; int arg4 ; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_copy_frame_in(self,i,from,from_f);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 3 of EST_Track_copy_frame_in. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(3)); (arg1)->copy_frame_in(arg2,(EST_Track const &)*arg3,arg4); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_copy_frame_in) { dXSARGS; if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_2); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_1); return; } } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_6); return; } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_5); return; } } } } } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_0); return; } } } } } } if (items == 6) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_4); return; } } } } } } } if (items == 7) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(5)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(6)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_copy_frame_in__SWIG_3); return; } } } } } } } } croak("No matching function for overloaded 'EST_Track_copy_frame_in'"); XSRETURN(0); } XS(_wrap_EST_Track_channel_position__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; int result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_channel_position(self,name,offset);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel_position. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); arg3 = (int) SvIV(ST(2)); result = (int)((EST_Track const *)arg1)->channel_position((char const *)arg2,arg3); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel_position__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_channel_position(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel_position. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (int)((EST_Track const *)arg1)->channel_position((char const *)arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel_position) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel_position__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel_position__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_channel_position'"); XSRETURN(0); } XS(_wrap_EST_Track_has_channel) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; bool result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_has_channel(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_has_channel. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (bool)((EST_Track const *)arg1)->has_channel((char const *)arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_a__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; float result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_a(self,i,c);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_a. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); result = (float)((EST_Track const *)arg1)->a(arg2,arg3); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_a__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_a(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_a. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = (float)((EST_Track const *)arg1)->a(arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_a__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int arg3 ; float result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_a(self,t,c);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_a. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); arg3 = (int) SvIV(ST(2)); result = (float)((EST_Track const *)arg1)->a(arg2,arg3); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_a__SWIG_3) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_a(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_a. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); result = (float)((EST_Track const *)arg1)->a(arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_a) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_a__SWIG_1); return; } } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_a__SWIG_3); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_a__SWIG_0); return; } } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_a__SWIG_2); return; } } } } croak("No matching function for overloaded 'EST_Track_a'"); XSRETURN(0); } XS(_wrap_EST_Track_t__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_t(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_t. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = (float)((EST_Track const *)arg1)->t(arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_t__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_t(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_t. Expected _p_EST_Track"); } } result = (float)((EST_Track const *)arg1)->t(); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_t) { dXSARGS; if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_t__SWIG_1); return; } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_t__SWIG_0); return; } } } croak("No matching function for overloaded 'EST_Track_t'"); XSRETURN(0); } XS(_wrap_EST_Track_ms_t) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_ms_t(self,i);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_ms_t. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = (float)((EST_Track const *)arg1)->ms_t(arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_fill_time__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; float arg3 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_fill_time(self,t,startt);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_fill_time. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); arg3 = (float) SvNV(ST(2)); (arg1)->fill_time(arg2,arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_fill_time__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_fill_time(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_fill_time. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); (arg1)->fill_time(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_fill_time__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_Track *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_fill_time(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_fill_time. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 2 of EST_Track_fill_time. Expected _p_EST_Track"); } } (arg1)->fill_time(*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_fill_time) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_fill_time__SWIG_2); return; } } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_fill_time__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_fill_time__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_fill_time'"); XSRETURN(0); } XS(_wrap_EST_Track_fill) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_fill(self,v);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_fill. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); (arg1)->fill(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_sample) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_sample(self,shift);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_sample. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); (arg1)->sample(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_shift) { { EST_Track *arg1 = (EST_Track *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_shift(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_shift. Expected _p_EST_Track"); } } result = (float)((EST_Track const *)arg1)->shift(); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_start) { { EST_Track *arg1 = (EST_Track *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_start(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_start. Expected _p_EST_Track"); } } result = (float)((EST_Track const *)arg1)->start(); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_end) { { EST_Track *arg1 = (EST_Track *) 0 ; float result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_end(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_end. Expected _p_EST_Track"); } } result = (float)((EST_Track const *)arg1)->end(); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_load__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; float arg3 ; float arg4 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 4) || (items > 4)) { SWIG_croak("Usage: EST_Track_load(self,name,ishift,startt);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_load. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); arg3 = (float) SvNV(ST(2)); arg4 = (float) SvNV(ST(3)); result = (arg1)->load((char const *)arg2,arg3,arg4); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_load__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; float arg3 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_load(self,name,ishift);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_load. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); arg3 = (float) SvNV(ST(2)); result = (arg1)->load((char const *)arg2,arg3); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_load__SWIG_2) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_load(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_load. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (arg1)->load((char const *)arg2); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_load) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_load__SWIG_2); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_load__SWIG_1); return; } } } } if (items == 4) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(3)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_load__SWIG_0); return; } } } } } croak("No matching function for overloaded 'EST_Track_load'"); XSRETURN(0); } XS(_wrap_EST_Track_save__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_save(self,name,EST_filetype);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_save. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); if (!SvOK((SV*) ST(2))) arg3 = 0; else arg3 = (char *) SvPV(ST(2), PL_na); result = (arg1)->save((char const *)arg2,(char const *)arg3); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_save__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; char *arg2 = (char *) 0 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_save(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_save. Expected _p_EST_Track"); } } if (!SvOK((SV*) ST(1))) arg2 = 0; else arg2 = (char *) SvPV(ST(1), PL_na); result = (arg1)->save((char const *)arg2); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_save) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_save__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvPOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvPOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_save__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_save'"); XSRETURN(0); } XS(_wrap_EST_Track_empty) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_empty(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_empty. Expected _p_EST_Track"); } } result = (int)((EST_Track const *)arg1)->empty(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_index) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_index(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_index. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); result = (int)((EST_Track const *)arg1)->index(arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_index_below) { { EST_Track *arg1 = (EST_Track *) 0 ; float arg2 ; int result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_index_below(self,x);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_index_below. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); result = (int)((EST_Track const *)arg1)->index_below(arg2); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_num_frames) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_num_frames(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_num_frames. Expected _p_EST_Track"); } } result = (int)((EST_Track const *)arg1)->num_frames(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_length) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_length(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_length. Expected _p_EST_Track"); } } result = (int)((EST_Track const *)arg1)->length(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_num_channels) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_num_channels(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_num_channels. Expected _p_EST_Track"); } } result = (int)((EST_Track const *)arg1)->num_channels(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_num_aux_channels) { { EST_Track *arg1 = (EST_Track *) 0 ; int result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_num_aux_channels(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_num_aux_channels. Expected _p_EST_Track"); } } result = (int)((EST_Track const *)arg1)->num_aux_channels(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_equal_space) { { EST_Track *arg1 = (EST_Track *) 0 ; bool result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_equal_space(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_equal_space. Expected _p_EST_Track"); } } result = (bool)((EST_Track const *)arg1)->equal_space(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_single_break) { { EST_Track *arg1 = (EST_Track *) 0 ; bool result; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: EST_Track_single_break(self);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_single_break. Expected _p_EST_Track"); } } result = (bool)((EST_Track const *)arg1)->single_break(); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_equal_space) { { EST_Track *arg1 = (EST_Track *) 0 ; bool arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_set_equal_space(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_equal_space. Expected _p_EST_Track"); } } arg2 = SvIV(ST(1)) ? true : false; (arg1)->set_equal_space(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_set_single_break) { { EST_Track *arg1 = (EST_Track *) 0 ; bool arg2 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_set_single_break(self,t);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_set_single_break. Expected _p_EST_Track"); } } arg2 = SvIV(ST(1)) ? true : false; (arg1)->set_single_break(arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_load_channel_names) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String arg2 ; EST_read_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_load_channel_names(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_load_channel_names. Expected _p_EST_Track"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } result = (arg1)->load_channel_names(arg2); { EST_read_status * resultobj = new EST_read_status((EST_read_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_read_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_save_channel_names) { { EST_Track *arg1 = (EST_Track *) 0 ; EST_String arg2 ; EST_write_status result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_save_channel_names(self,name);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_save_channel_names. Expected _p_EST_Track"); } } { STRLEN len; const char* str = SvPV(ST(1), len); arg2 = EST_String( str, len, 0, len ); } result = (arg1)->save_channel_names(arg2); { EST_write_status * resultobj = new EST_write_status((EST_write_status &)result); ST(argvi) = sv_newmortal(); SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_EST_write_status, 0|SWIG_OWNER); } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel_name__SWIG_0) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; int arg3 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: EST_Track_channel_name(self,channel,strings_override);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel_name. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); arg3 = (int) SvIV(ST(2)); result = ((EST_Track const *)arg1)->channel_name(arg2,arg3); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel_name__SWIG_1) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_channel_name(self,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_channel_name. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = ((EST_Track const *)arg1)->channel_name(arg2); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_EST_Track_channel_name) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel_name__SWIG_1); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(2)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_EST_Track_channel_name__SWIG_0); return; } } } } croak("No matching function for overloaded 'EST_Track_channel_name'"); XSRETURN(0); } XS(_wrap_EST_Track_aux_channel_name) { { EST_Track *arg1 = (EST_Track *) 0 ; int arg2 ; EST_String result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: EST_Track_aux_channel_name(self,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of EST_Track_aux_channel_name. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = ((EST_Track const *)arg1)->aux_channel_name(arg2); ST(argvi) = sv_newmortal(); sv_setpvn((SV*)ST(argvi++),(char *)result, (&result)->length()); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_mean__SWIG_0) { { EST_Track *arg1 = 0 ; int arg2 ; float result; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: mean(tr,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of mean. Expected _p_EST_Track"); } } arg2 = (int) SvIV(ST(1)); result = (float)mean((EST_Track const &)*arg1,arg2); ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi++), (double) result); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_mean__SWIG_1) { { EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: mean(tr,means);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of mean. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of mean. Expected _p_EST_FVector"); } } mean((EST_Track const &)*arg1,*arg2); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_mean) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_mean__SWIG_1); return; } } } if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_mean__SWIG_0); return; } } } croak("No matching function for overloaded 'mean'"); XSRETURN(0); } XS(_wrap_meansd__SWIG_0) { { EST_Track *arg1 = 0 ; float *arg2 = 0 ; float *arg3 = 0 ; int arg4 ; float temp2 ; float temp3 ; int argvi = 0; dXSARGS; arg2 = &temp2; arg3 = &temp3; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: meansd(tr,channel);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of meansd. Expected _p_EST_Track"); } } arg4 = (int) SvIV(ST(1)); meansd(*arg1,*arg2,*arg3,arg4); { if (argvi >= items) { EXTEND(sp,1); } ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi),(double) *(arg2)); argvi++; } { if (argvi >= items) { EXTEND(sp,1); } ST(argvi) = sv_newmortal(); sv_setnv(ST(argvi),(double) *(arg3)); argvi++; } XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_meansd__SWIG_1) { { EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; int argvi = 0; dXSARGS; if ((items < 3) || (items > 3)) { SWIG_croak("Usage: meansd(tr,m,sd);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of meansd. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of meansd. Expected _p_EST_FVector"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of meansd. Expected _p_EST_FVector"); } } meansd(*arg1,*arg2,*arg3); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_meansd) { dXSARGS; if (items == 2) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvIOK(ST(1)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_meansd__SWIG_0); return; } } } if (items == 3) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_meansd__SWIG_1); return; } } } } croak("No matching function for overloaded 'meansd'"); XSRETURN(0); } XS(_wrap_normalise__SWIG_0) { { EST_Track *arg1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: normalise(tr);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of normalise. Expected _p_EST_Track"); } } normalise(*arg1); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_normalise__SWIG_1) { { EST_Track *arg1 = 0 ; float arg2 ; float arg3 ; int arg4 ; float arg5 ; float arg6 ; int argvi = 0; dXSARGS; if ((items < 6) || (items > 6)) { SWIG_croak("Usage: normalise(tr,mean,sd,channel,upper,lower);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of normalise. Expected _p_EST_Track"); } } arg2 = (float) SvNV(ST(1)); arg3 = (float) SvNV(ST(2)); arg4 = (int) SvIV(ST(3)); arg5 = (float) SvNV(ST(4)); arg6 = (float) SvNV(ST(5)); normalise(*arg1,arg2,arg3,arg4,arg5,arg6); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_normalise__SWIG_2) { { EST_Track *arg1 = 0 ; EST_FVector *arg2 = 0 ; EST_FVector *arg3 = 0 ; float arg4 ; float arg5 ; int argvi = 0; dXSARGS; if ((items < 5) || (items > 5)) { SWIG_croak("Usage: normalise(tr,mean,sd,upper,lower);"); } { if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_EST_Track,0) < 0) { SWIG_croak("Type error in argument 1 of normalise. Expected _p_EST_Track"); } } { if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 2 of normalise. Expected _p_EST_FVector"); } } { if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_EST_FVector,0) < 0) { SWIG_croak("Type error in argument 3 of normalise. Expected _p_EST_FVector"); } } arg4 = (float) SvNV(ST(3)); arg5 = (float) SvNV(ST(4)); normalise(*arg1,*arg2,*arg3,arg4,arg5); XSRETURN(argvi); fail: ; } croak(Nullch); } XS(_wrap_normalise) { dXSARGS; if (items == 1) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_normalise__SWIG_0); return; } } if (items == 5) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(1), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { void *tmp; if (SWIG_ConvertPtr(ST(2), (void **) &tmp, SWIGTYPE_p_EST_FVector, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(4)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_normalise__SWIG_2); return; } } } } } } if (items == 6) { int _v; { void *tmp; if (SWIG_ConvertPtr(ST(0), (void **) &tmp, SWIGTYPE_p_EST_Track, 0) == -1) { _v = 0; } else { _v = 1; } } if (_v) { { _v = SvNIOK(ST(1)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(2)) ? 1 : 0; } if (_v) { { _v = SvIOK(ST(3)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(4)) ? 1 : 0; } if (_v) { { _v = SvNIOK(ST(5)) ? 1 : 0; } if (_v) { (*PL_markstack_ptr++);SWIG_CALLXS(_wrap_normalise__SWIG_1); return; } } } } } } } croak("No matching function for overloaded 'normalise'"); XSRETURN(0); } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_EST_FVector = {"EST_FVector::EST_FVector", "EST_FVector *", 0, 0, 0}; static swig_type_info _swigt__p_EST_IVector = {"_p_EST_IVector", "EST_IVector *", 0, 0, 0}; static swig_type_info _swigt__p_EST_Track = {"EST_Track::EST_Track", "EST_Track *", 0, 0, 0}; static swig_type_info _swigt__p_EST_read_status = {"_p_EST_read_status", "EST_read_status *", 0, 0, 0}; static swig_type_info _swigt__p_EST_write_status = {"_p_EST_write_status", "EST_write_status *", 0, 0, 0}; static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_EST_FVector, &_swigt__p_EST_IVector, &_swigt__p_EST_Track, &_swigt__p_EST_read_status, &_swigt__p_EST_write_status, &_swigt__p_float, }; static swig_cast_info _swigc__p_EST_FVector[] = { {&_swigt__p_EST_FVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_IVector[] = { {&_swigt__p_EST_IVector, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_Track[] = { {&_swigt__p_EST_Track, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_read_status[] = { {&_swigt__p_EST_read_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EST_write_status[] = { {&_swigt__p_EST_write_status, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_EST_FVector, _swigc__p_EST_IVector, _swigc__p_EST_Track, _swigc__p_EST_read_status, _swigc__p_EST_write_status, _swigc__p_float, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_constant_info swig_constants[] = { {0,0,0,0,0,0} }; #ifdef __cplusplus } #endif static swig_variable_info swig_variables[] = { {0,0,0,0} }; static swig_command_info swig_commands[] = { {"EST_Trackc::EST_Track_default_frame_shift_get", _wrap_EST_Track_default_frame_shift_get}, {"EST_Trackc::EST_Track_default_sample_rate_get", _wrap_EST_Track_default_sample_rate_get}, {"EST_Trackc::new_EST_Track", _wrap_new_EST_Track}, {"EST_Trackc::delete_EST_Track", _wrap_delete_EST_Track}, {"EST_Trackc::EST_Track_resize", _wrap_EST_Track_resize}, {"EST_Trackc::EST_Track_set_num_channels", _wrap_EST_Track_set_num_channels}, {"EST_Trackc::EST_Track_set_num_frames", _wrap_EST_Track_set_num_frames}, {"EST_Trackc::EST_Track_set_channel_name", _wrap_EST_Track_set_channel_name}, {"EST_Trackc::EST_Track_set_aux_channel_name", _wrap_EST_Track_set_aux_channel_name}, {"EST_Trackc::EST_Track_copy_setup", _wrap_EST_Track_copy_setup}, {"EST_Trackc::EST_Track_name", _wrap_EST_Track_name}, {"EST_Trackc::EST_Track_set_name", _wrap_EST_Track_set_name}, {"EST_Trackc::EST_Track_frame", _wrap_EST_Track_frame}, {"EST_Trackc::EST_Track_channel", _wrap_EST_Track_channel}, {"EST_Trackc::EST_Track_sub_track", _wrap_EST_Track_sub_track}, {"EST_Trackc::EST_Track_copy_sub_track", _wrap_EST_Track_copy_sub_track}, {"EST_Trackc::EST_Track_copy_sub_track_out", _wrap_EST_Track_copy_sub_track_out}, {"EST_Trackc::EST_Track_copy_channel_out", _wrap_EST_Track_copy_channel_out}, {"EST_Trackc::EST_Track_copy_frame_out", _wrap_EST_Track_copy_frame_out}, {"EST_Trackc::EST_Track_copy_channel_in", _wrap_EST_Track_copy_channel_in}, {"EST_Trackc::EST_Track_copy_frame_in", _wrap_EST_Track_copy_frame_in}, {"EST_Trackc::EST_Track_channel_position", _wrap_EST_Track_channel_position}, {"EST_Trackc::EST_Track_has_channel", _wrap_EST_Track_has_channel}, {"EST_Trackc::EST_Track_a", _wrap_EST_Track_a}, {"EST_Trackc::EST_Track_t", _wrap_EST_Track_t}, {"EST_Trackc::EST_Track_ms_t", _wrap_EST_Track_ms_t}, {"EST_Trackc::EST_Track_fill_time", _wrap_EST_Track_fill_time}, {"EST_Trackc::EST_Track_fill", _wrap_EST_Track_fill}, {"EST_Trackc::EST_Track_sample", _wrap_EST_Track_sample}, {"EST_Trackc::EST_Track_shift", _wrap_EST_Track_shift}, {"EST_Trackc::EST_Track_start", _wrap_EST_Track_start}, {"EST_Trackc::EST_Track_end", _wrap_EST_Track_end}, {"EST_Trackc::EST_Track_load", _wrap_EST_Track_load}, {"EST_Trackc::EST_Track_save", _wrap_EST_Track_save}, {"EST_Trackc::EST_Track_empty", _wrap_EST_Track_empty}, {"EST_Trackc::EST_Track_index", _wrap_EST_Track_index}, {"EST_Trackc::EST_Track_index_below", _wrap_EST_Track_index_below}, {"EST_Trackc::EST_Track_num_frames", _wrap_EST_Track_num_frames}, {"EST_Trackc::EST_Track_length", _wrap_EST_Track_length}, {"EST_Trackc::EST_Track_num_channels", _wrap_EST_Track_num_channels}, {"EST_Trackc::EST_Track_num_aux_channels", _wrap_EST_Track_num_aux_channels}, {"EST_Trackc::EST_Track_equal_space", _wrap_EST_Track_equal_space}, {"EST_Trackc::EST_Track_single_break", _wrap_EST_Track_single_break}, {"EST_Trackc::EST_Track_set_equal_space", _wrap_EST_Track_set_equal_space}, {"EST_Trackc::EST_Track_set_single_break", _wrap_EST_Track_set_single_break}, {"EST_Trackc::EST_Track_load_channel_names", _wrap_EST_Track_load_channel_names}, {"EST_Trackc::EST_Track_save_channel_names", _wrap_EST_Track_save_channel_names}, {"EST_Trackc::EST_Track_channel_name", _wrap_EST_Track_channel_name}, {"EST_Trackc::EST_Track_aux_channel_name", _wrap_EST_Track_aux_channel_name}, {"EST_Trackc::mean", _wrap_mean}, {"EST_Trackc::meansd", _wrap_meansd}, {"EST_Trackc::normalise", _wrap_normalise}, {0,0} }; /************************************************************************* * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. **/ #ifdef __cplusplus extern "C" { #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { swig_type_info *type, *ret; swig_cast_info *cast; size_t i; swig_module_info *module_head; static int init_run = 0; clientdata = clientdata; if (init_run) return; init_run = 1; /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; } else { /* This is the first module loaded */ swig_module.next = &swig_module; SWIG_SetModule(clientdata, &swig_module); } /* Now work on filling in swig_module.types */ for (i = 0; i < swig_module.size; ++i) { type = 0; /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); } if (ret && type == swig_module.type_initial[i]) { cast->type = ret; ret = 0; } if (!ret) { if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" #endif XS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_EST_Track, (void*) "EST_Track::EST_Track"); ST(0) = &PL_sv_yes; XSRETURN(1); } speech_tools/wrappers/perl5/EST_Utterance.pm0000644000076400007640000000541611332265737017575 0ustar awbawb# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. package EST_Utterance; use base qw(Exporter); use base qw(DynaLoader); require EST_Item; require EST_Relation; package EST_Utterancec; bootstrap EST_Utterance; package EST_Utterance; @EXPORT = qw(); # ---------- BASE METHODS ------------- package EST_Utterance; sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname; } sub CLEAR { } sub FIRSTKEY { } sub NEXTKEY { } sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func(); } sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval); } sub this { my $ptr = shift; return tied(%$ptr); } # ------- FUNCTION WRAPPERS -------- package EST_Utterance; *utterance_merge = *EST_Utterancec::utterance_merge; *sub_utterance = *EST_Utterancec::sub_utterance; *get_utt = *EST_Utterancec::get_utt; ############# Class : EST_Utterance::EST_Utterance ############## package EST_Utterance::EST_Utterance; use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); @ISA = qw( EST_Utterance ); %OWNER = (); %ITERATORS = (); sub new { my $pkg = shift; my $self = EST_Utterancec::new_EST_Utterance(@_); bless $self, $pkg if defined($self); } sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { EST_Utterancec::delete_EST_Utterance($self); delete $OWNER{$self}; } } *init = *EST_Utterancec::EST_Utterance_init; *clear = *EST_Utterancec::EST_Utterance_clear; *clear_relations = *EST_Utterancec::EST_Utterance_clear_relations; *set_highest_id = *EST_Utterancec::EST_Utterance_set_highest_id; *next_id = *EST_Utterancec::EST_Utterance_next_id; *load = *EST_Utterancec::EST_Utterance_load; *save = *EST_Utterancec::EST_Utterance_save; *evaluate_all_features = *EST_Utterancec::EST_Utterance_evaluate_all_features; *num_relations = *EST_Utterancec::EST_Utterance_num_relations; *relation_present = *EST_Utterancec::EST_Utterance_relation_present; *relation = *EST_Utterancec::EST_Utterance_relation; *id = *EST_Utterancec::EST_Utterance_id; *create_relation = *EST_Utterancec::EST_Utterance_create_relation; *remove_relation = *EST_Utterancec::EST_Utterance_remove_relation; *sub_utterance = *EST_Utterancec::EST_Utterance_sub_utterance; sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr}; } sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1; } # ------- VARIABLE STUBS -------- package EST_Utterance; 1; speech_tools/wrappers/perl5/EST_Relation.pm0000644000076400007640000000511210453550564017407 0ustar awbawb# This file was automatically generated by SWIG package EST_Relation; require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); require EST_Item; package EST_Relationc; bootstrap EST_Relation; package EST_Relation; @EXPORT = qw( ); # ---------- BASE METHODS ------------- package EST_Relation; sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname; } sub CLEAR { } sub FIRSTKEY { } sub NEXTKEY { } sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func(); } sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval); } sub this { my $ptr = shift; return tied(%$ptr); } # ------- FUNCTION WRAPPERS -------- package EST_Relation; *copy_relation = *EST_Relationc::copy_relation; ############# Class : EST_Relation::EST_Relation ############## package EST_Relation::EST_Relation; @ISA = qw( EST_Relation ); %OWNER = (); %ITERATORS = (); sub new { my $pkg = shift; my $self = EST_Relationc::new_EST_Relation(@_); bless $self, $pkg if defined($self); } sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { EST_Relationc::delete_EST_Relation($self); delete $OWNER{$self}; } } *load = *EST_Relationc::EST_Relation_load; *save = *EST_Relationc::EST_Relation_save; *evaluate_item_features = *EST_Relationc::EST_Relation_evaluate_item_features; *clear = *EST_Relationc::EST_Relation_clear; *utt = *EST_Relationc::EST_Relation_utt; *set_utt = *EST_Relationc::EST_Relation_set_utt; *name = *EST_Relationc::EST_Relation_name; *head = *EST_Relationc::EST_Relation_head; *root = *EST_Relationc::EST_Relation_root; *tail = *EST_Relationc::EST_Relation_tail; *first = *EST_Relationc::EST_Relation_first; *first_leaf = *EST_Relationc::EST_Relation_first_leaf; *last = *EST_Relationc::EST_Relation_last; *last_leaf = *EST_Relationc::EST_Relation_last_leaf; *append = *EST_Relationc::EST_Relation_append; *prepend = *EST_Relationc::EST_Relation_prepend; *length = *EST_Relationc::EST_Relation_length; *empty = *EST_Relationc::EST_Relation_empty; *remove_item = *EST_Relationc::EST_Relation_remove_item; *remove_item_feature = *EST_Relationc::EST_Relation_remove_item_feature; sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr}; } sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1; } # ------- VARIABLE STUBS -------- package EST_Relation; 1; speech_tools/wrappers/perl5/EST_Item.pm0000644000076400007640000000563410357531477016546 0ustar awbawb# This file was automatically generated by SWIG package EST_Item; require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); package EST_Itemc; bootstrap EST_Item; package EST_Item; @EXPORT = qw( ); # ---------- BASE METHODS ------------- package EST_Item; sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname; } sub CLEAR { } sub FIRSTKEY { } sub NEXTKEY { } sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func(); } sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval); } sub this { my $ptr = shift; return tied(%$ptr); } # ------- FUNCTION WRAPPERS -------- package EST_Item; *as = *EST_Itemc::as; *next_item = *EST_Itemc::next_item; *first_leaf = *EST_Itemc::first_leaf; *last_leaf = *EST_Itemc::last_leaf; *next_leaf = *EST_Itemc::next_leaf; *num_leaves = *EST_Itemc::num_leaves; *remove_item = *EST_Itemc::remove_item; *copy_node_tree = *EST_Itemc::copy_node_tree; *copy_node_tree_contents = *EST_Itemc::copy_node_tree_contents; *item_jump = *EST_Itemc::item_jump; ############# Class : EST_Item::EST_Item ############## package EST_Item::EST_Item; @ISA = qw( EST_Item ); %OWNER = (); %ITERATORS = (); sub new { my $pkg = shift; my $self = EST_Itemc::new_EST_Item(@_); bless $self, $pkg if defined($self); } sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { EST_Itemc::delete_EST_Item($self); delete $OWNER{$self}; } } *F = *EST_Itemc::EST_Item_F; *S = *EST_Itemc::EST_Item_S; *I = *EST_Itemc::EST_Item_I; *A = *EST_Itemc::EST_Item_A; *set = *EST_Itemc::EST_Item_set; *set_function = *EST_Itemc::EST_Item_set_function; *f_remove = *EST_Itemc::EST_Item_f_remove; *evaluate_features = *EST_Itemc::EST_Item_evaluate_features; *f_present = *EST_Itemc::EST_Item_f_present; *length = *EST_Itemc::EST_Item_length; *as_relation = *EST_Itemc::EST_Item_as_relation; *in_relation = *EST_Itemc::EST_Item_in_relation; *relation_name = *EST_Itemc::EST_Item_relation_name; *relation = *EST_Itemc::EST_Item_relation; *same_item = *EST_Itemc::EST_Item_same_item; *unref_all = *EST_Itemc::EST_Item_unref_all; *prepend_daughter = *EST_Itemc::EST_Item_prepend_daughter; *append_daughter = *EST_Itemc::EST_Item_append_daughter; *daughter1 = *EST_Itemc::EST_Item_daughter1; *daughtern = *EST_Itemc::EST_Item_daughtern; *next_sibling = *EST_Itemc::EST_Item_next_sibling; *prev_sibling = *EST_Itemc::EST_Item_prev_sibling; *parent = *EST_Itemc::EST_Item_parent; *features = *EST_Itemc::EST_Item_features; sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr}; } sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1; } # ------- VARIABLE STUBS -------- package EST_Item; 1; speech_tools/wrappers/perl5/EST_Wave.pm0000644000076400007640000000702310453550564016537 0ustar awbawb# This file was automatically generated by SWIG package EST_Wave; require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); package EST_Wavec; bootstrap EST_Wave; package EST_Wave; @EXPORT = qw( ); # ---------- BASE METHODS ------------- package EST_Wave; sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname; } sub CLEAR { } sub FIRSTKEY { } sub NEXTKEY { } sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func(); } sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval); } sub this { my $ptr = shift; return tied(%$ptr); } # ------- FUNCTION WRAPPERS -------- package EST_Wave; *wave_extract_channel = *EST_Wavec::wave_extract_channel; *wave_combine_channels = *EST_Wavec::wave_combine_channels; *wave_subwave = *EST_Wavec::wave_subwave; *wave_divide = *EST_Wavec::wave_divide; *wave_extract = *EST_Wavec::wave_extract; *add_waves = *EST_Wavec::add_waves; *difference = *EST_Wavec::difference; *rms_error = *EST_Wavec::rms_error; *abs_error = *EST_Wavec::abs_error; *correlation = *EST_Wavec::correlation; *error = *EST_Wavec::error; *absolute = *EST_Wavec::absolute; *wave_info = *EST_Wavec::wave_info; *invert = *EST_Wavec::invert; *differentiate = *EST_Wavec::differentiate; *reverse = *EST_Wavec::reverse; ############# Class : EST_Wave::EST_Wave ############## package EST_Wave::EST_Wave; @ISA = qw( EST_Wave ); %OWNER = (); %ITERATORS = (); *swig_default_sample_rate_get = *EST_Wavec::EST_Wave_default_sample_rate_get; *swig_default_sample_rate_set = *EST_Wavec::EST_Wave_default_sample_rate_set; sub new { my $pkg = shift; my $self = EST_Wavec::new_EST_Wave(@_); bless $self, $pkg if defined($self); } sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { EST_Wavec::delete_EST_Wave($self); delete $OWNER{$self}; } } *a = *EST_Wavec::EST_Wave_a; *a_safe = *EST_Wavec::EST_Wave_a_safe; *set_a = *EST_Wavec::EST_Wave_set_a; *t = *EST_Wavec::EST_Wave_t; *num_samples = *EST_Wavec::EST_Wave_num_samples; *num_channels = *EST_Wavec::EST_Wave_num_channels; *sample_rate = *EST_Wavec::EST_Wave_sample_rate; *set_sample_rate = *EST_Wavec::EST_Wave_set_sample_rate; *length = *EST_Wavec::EST_Wave_length; *end = *EST_Wavec::EST_Wave_end; *have_left_context = *EST_Wavec::EST_Wave_have_left_context; *sample_type = *EST_Wavec::EST_Wave_sample_type; *set_sample_type = *EST_Wavec::EST_Wave_set_sample_type; *file_type = *EST_Wavec::EST_Wave_file_type; *set_file_type = *EST_Wavec::EST_Wave_set_file_type; *name = *EST_Wavec::EST_Wave_name; *set_name = *EST_Wavec::EST_Wave_set_name; *resize = *EST_Wavec::EST_Wave_resize; *resample = *EST_Wavec::EST_Wave_resample; *rescale = *EST_Wavec::EST_Wave_rescale; *clear = *EST_Wavec::EST_Wave_clear; *copy = *EST_Wavec::EST_Wave_copy; *fill = *EST_Wavec::EST_Wave_fill; *empty = *EST_Wavec::EST_Wave_empty; *load = *EST_Wavec::EST_Wave_load; *load_file = *EST_Wavec::EST_Wave_load_file; *save = *EST_Wavec::EST_Wave_save; *save_file = *EST_Wavec::EST_Wave_save_file; *integrity = *EST_Wavec::EST_Wave_integrity; *info = *EST_Wavec::EST_Wave_info; *play = *EST_Wavec::EST_Wave_play; sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr}; } sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1; } # ------- VARIABLE STUBS -------- package EST_Wave; 1; speech_tools/wrappers/perl5/EST_Track.pm0000644000076400007640000001014510357531477016705 0ustar awbawb# This file was automatically generated by SWIG package EST_Track; require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); require EST_FVector; package EST_Trackc; bootstrap EST_Track; package EST_Track; @EXPORT = qw( ); # ---------- BASE METHODS ------------- package EST_Track; sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname; } sub CLEAR { } sub FIRSTKEY { } sub NEXTKEY { } sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func(); } sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval); } sub this { my $ptr = shift; return tied(%$ptr); } # ------- FUNCTION WRAPPERS -------- package EST_Track; *mean = *EST_Trackc::mean; *meansd = *EST_Trackc::meansd; *normalise = *EST_Trackc::normalise; ############# Class : EST_Track::EST_Track ############## package EST_Track::EST_Track; @ISA = qw( EST_Track ); %OWNER = (); %ITERATORS = (); *swig_default_frame_shift_get = *EST_Trackc::EST_Track_default_frame_shift_get; *swig_default_frame_shift_set = *EST_Trackc::EST_Track_default_frame_shift_set; *swig_default_sample_rate_get = *EST_Trackc::EST_Track_default_sample_rate_get; *swig_default_sample_rate_set = *EST_Trackc::EST_Track_default_sample_rate_set; sub new { my $pkg = shift; my $self = EST_Trackc::new_EST_Track(@_); bless $self, $pkg if defined($self); } sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { EST_Trackc::delete_EST_Track($self); delete $OWNER{$self}; } } *resize = *EST_Trackc::EST_Track_resize; *set_num_channels = *EST_Trackc::EST_Track_set_num_channels; *set_num_frames = *EST_Trackc::EST_Track_set_num_frames; *set_channel_name = *EST_Trackc::EST_Track_set_channel_name; *set_aux_channel_name = *EST_Trackc::EST_Track_set_aux_channel_name; *copy_setup = *EST_Trackc::EST_Track_copy_setup; *name = *EST_Trackc::EST_Track_name; *set_name = *EST_Trackc::EST_Track_set_name; *frame = *EST_Trackc::EST_Track_frame; *channel = *EST_Trackc::EST_Track_channel; *sub_track = *EST_Trackc::EST_Track_sub_track; *copy_sub_track = *EST_Trackc::EST_Track_copy_sub_track; *copy_sub_track_out = *EST_Trackc::EST_Track_copy_sub_track_out; *copy_channel_out = *EST_Trackc::EST_Track_copy_channel_out; *copy_frame_out = *EST_Trackc::EST_Track_copy_frame_out; *copy_channel_in = *EST_Trackc::EST_Track_copy_channel_in; *copy_frame_in = *EST_Trackc::EST_Track_copy_frame_in; *channel_position = *EST_Trackc::EST_Track_channel_position; *has_channel = *EST_Trackc::EST_Track_has_channel; *a = *EST_Trackc::EST_Track_a; *t = *EST_Trackc::EST_Track_t; *ms_t = *EST_Trackc::EST_Track_ms_t; *fill_time = *EST_Trackc::EST_Track_fill_time; *fill = *EST_Trackc::EST_Track_fill; *sample = *EST_Trackc::EST_Track_sample; *shift = *EST_Trackc::EST_Track_shift; *start = *EST_Trackc::EST_Track_start; *end = *EST_Trackc::EST_Track_end; *load = *EST_Trackc::EST_Track_load; *save = *EST_Trackc::EST_Track_save; *empty = *EST_Trackc::EST_Track_empty; *index = *EST_Trackc::EST_Track_index; *index_below = *EST_Trackc::EST_Track_index_below; *num_frames = *EST_Trackc::EST_Track_num_frames; *length = *EST_Trackc::EST_Track_length; *num_channels = *EST_Trackc::EST_Track_num_channels; *num_aux_channels = *EST_Trackc::EST_Track_num_aux_channels; *equal_space = *EST_Trackc::EST_Track_equal_space; *single_break = *EST_Trackc::EST_Track_single_break; *set_equal_space = *EST_Trackc::EST_Track_set_equal_space; *set_single_break = *EST_Trackc::EST_Track_set_single_break; *load_channel_names = *EST_Trackc::EST_Track_load_channel_names; *save_channel_names = *EST_Trackc::EST_Track_save_channel_names; *channel_name = *EST_Trackc::EST_Track_channel_name; *aux_channel_name = *EST_Trackc::EST_Track_aux_channel_name; sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr}; } sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1; } # ------- VARIABLE STUBS -------- package EST_Track; 1; speech_tools/config/Makefile0000644000076400007640000000602707262616577014615 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### TOP=.. DIRNAME=config FILES = Makefile ReadMe example.Makefile example.module.mak\ common_make_rules test_make_rules vc_common_make_rules \ config.in vc_config_make_rules-dist \ project.mak system.sh make_system.mak #LOCAL_CLEAN = modinclude*.inc system.mak ALL_DIRS = systems compilers rules configs modules include $(TOP)/config/common_make_rules speech_tools/config/ReadMe0000644000076400007640000001725010044502523014206 0ustar awbawb Edinburgh Speech Tools Configuration ==================================== Contents -------- 1 How Configuration Works 2 Quick Configuration 3 Adapting The Configuration For Your System 4 Adding a New Optional Module --o--oOo--o-- 1 How Configuration Works ------------------------- The configuration for the system is set in 4 sections A system description in `config/systems/' describes the common layout for this kind of system. A compiler description in `config/compilers/' describes the options available for the compiler, how to build shared libraries etc. Configuration descriptions in `config/configs/' describe some common differences from the default configurations. Anything you put at the end of config/config. The next two sections describes some of the things you might need to set --o--oOo--o-- 2 Quick Configuration --------------------- Copy the file `config/config-dist' to `config/config'. Load `config/config' into your editor and read through it, selecting what compiler to use, which festures you wish to include in the system and so on. Run `gnumake info' in the top level speech_tools directory to see what the system thinks of your configuration. If all looks well, `gnumake' will build the system. We have tried to make it compile `out of the box' on as many systems as possible. However the idiosyncratic details of your system may mean you have to do some --o--oOo--o-- 2 Quick Configuration --------------------- Copy the file `config/config-dist' to `config/config'. Load `config/config' into your editor and read through it, selecting what compiler to use, which festures you wish to include in the system and so on. Run `gnumake info' in the top level speech_tools directory to see what the system thinks of your configuration. If all looks well, `gnumake' will build the system. We have tried to make it compile `out of the box' on as many systems as possible. However the idiosyncratic details of your system may mean you have to give some information. We have included a mechanism for noting common variations from the default configuration for a given system type. These variations can be listed in the CONFIGURATIONS line of the config file. At the moment only one generally useful variation is defined egcs_as_gcc This system has the egcs C++ compilation system installed under the names gcc and g++. If you need to give the system more detailed information about your situation, for instance where libraries are located, you will need to add definitions to the end of `config/config' as desribed in the next section. --o--oOo--o-- 3 Adapting The Configuration For Your System -------------------------------------------- We have included pre-defined configurations for a number of different types of system. Also some variants we know about are described by options which can be included in the CONFIGURATION line in the config file, as described in the previous section. However, if your system has some of the libraries or programs which the speech tools use installed in unusual locations you will need to add settings to the end of `config' to say where they are. Below are the settings you are most likely to need to fix in this way and typical values. Copy the relevant ones to the position indicted at the very end of config and customise as necessary. ########################################################################### ## Location of libraries. ########################################################################### ## Where to find Network Audio NAS_INCLUDE = /usr/X11R6/include NAS_LIB = /usr/X11R6/lib ########################################################################### ## Where to find X11 X11_INCLUDE = /usr/X11R6/include X11_LIB = /usr/X11R6/lib ########################################################################### ## TCL support TCL_INCLUDE = /usr/local/include TCL_LIB = /usr/local/lib ########################################################################### ## Efence library for malloc debugging EFENCE_LIB = /usr/local/lib ########################################################################### ## Java class path JAVA_HOME = $(pack $(shell echo "$$JAVA_HOME")) SYSTEM_JAVA_CLASSPATH = $(pack $(shell echo "$$CLASSPATH")) JAVA_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/solaris ########################################################################### ## Programs ## make dependancies MAKE_DEPEND = makedepend $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) ## Normal library building BUILD_LIB =$(AR) cruv ## library indexing INDEX_LIB = $(RANLIB) ## shrink executables STRIP = strip ## different types of awk. For our purposes gawk can be used for nawk AWK = awk NAWK = nawk ## Just in case someone has a broken test TEST = test ## Must understand -nt GNUTEST = gnutest ## Avoid clever RMs people may have on their path RM = /bin/rm ########################################################################### ## Any other command line arguments which you need to pass to your ## compiler to compiler the system. CONFIG_DEFINES = CONFIG_INCLUDES = CONFIG_TEMPLATES = CONFIG_LIBS = --o--oOo--o-- 4 Rationale ----------- It may help to know why this configuration system is how it is. Most of the pieces of software distributed in source form via the internet and similar channels are simpel tools. The aim of people getting them is to have a working system as quickly and easily as possible. For such systems having a configuration script which when run works out some combination of options and so on which will let the system compile is ideal. However, the Edinburgh Speech Tools and Festival are designed as research platforms. While many people just want to compile and go, many want to be able to change how the system is configured, what compiler to use, what facilities to include and so on easily. To support this the configuration system needs to: (a) Determine what kind of system we are on, which awk to use and so on. (b) Find out where the required third party libraries and so on are hidden on this system. (c) Allow the user to change between compilers, java development systems etc. (d) Allow the user to select compilation options (optimisation level, debugging, whether to compile shared libraries) (e) Allow the user to include and exclude the various optional sections of the system. A normal configuration script can, with various amounts of ingenuity, do (a), but for the rest it would be necessary to supply information on the command line to the script. --o--oOo--o-- 5 Adding A New Optional Module ------------------------------ If you wish to add new code to the speech tools you should, initially at least, make a new optional module. This will let you include or exclude your extension from your config file. First you must decide on a unique name for your module. There is a list of existing module names in `config/project.mak'. For the example below we'll assume this new module is called `widgets'. Create a directory for your module. Where you put it will depend on where you think it fits logically into the existing hierachy. For the example we will imagine the `widgets' module is used to manipulate some kind of representation of linguistic structures and put it under `ling_class'. mkdir ling_class/widgets In the `widgets' directory you need to create 2 files, a `Makefile' controlling the compilation of that directory and a `widgets.mak' file which describes how it fits into the speech_tools. Follow the structure of `example.Makefile' and `example.module.mak' in this directory. Once you have created your module you just need to turn it on in your `config' file. Add a line like: INCLUDE_MODULES += WIDGETS speech_tools/config/example.Makefile0000644000076400007640000001075610044502523016224 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## A skeleton makefile for a speech tools directory. This would be for ## ## a directory of mainly C++ code to be included in the library. ## ## ## ########################################################################### ########################################################################### ## About this directory ## The name of this directory DIRNAME=ling_class/widgets ## A path from this directory to the top of the speech_tools tree, TOP=../.. ########################################################################### ## The code in this directory ## The include files in this directory H = foo.h bar.h ## The C++ sources which contain template instantiation code. TSRCS = foo.cc ## All C++ sources. CPPSRCS = bar.cc $(TSRCS) ## Ansi C sources CSRCS = baz.c ## All sources SRCS = $(CPPSRCS) $(CSRCS) ## Object files to be created OBJS = $(CPPSRCS:.cc=.o) $(CSRCS:.c=.o) ########################################################################### ## Everything in this directory ## All files in this directory. FILES = $(SRCS) $(H) Makefile example.mak ## Sub directories which need to be compiled when the library is rebuilt LIB_BUILD_DIRS=sub_example ## Sub directories which need to be built in a full rebuild BUILD_DIRS=$(LIB_BUILD_DIRS) sub_example sub_example_main ## All sub directories ALL_DIRS=$(BUILD_DIRS) extra_gubbins ########################################################################### ## What we need to do to build this directory ALL = .buildlibs ########################################################################### ## Include the common speech_tools compilation rules include $(EST)/config/common_make_rules ########################################################################### ## Any directory specific compilation rules would go here. speech_tools/config/example.module.mak0000644000076400007640000000706107262605664016560 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Example module description file. ## ## ## ########################################################################### ## Set a flag which can be used to detect that this module is being included INCLUDE_WIDGETS=1 ## Include this directory in the list of things to be built in the ## parent directory ifeq ($(DIRNAME),ling_class) EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) widgets endif ## Optionally add some executables to the list in `main' ifeq ($(DIRNAME),main) MAINSRCS := $(MAINSRCS) widget_main.cc endif ## If this module depends on others we need to check as follows ifndef INCLUDE_DONGLES .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| Must include DONGLES to use WIDGETS" @echo "+--------------------------------------------------" @exit 1 endif speech_tools/config/common_make_rules0000644000076400007640000000707010056153677016566 0ustar awbawb ########################################################-*-mode:Makefile-*- ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Various People ## ## : Reorganised (and probably broken) ## ## : by Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: June 1997 ## ## --------------------------------------------------------------------- ## ## Default Makefile rules included everywhere. ## ## ## ########################################################################### # This is the default rule all: $(ALL) .sub_directories @ : Do nothing but shut up make # Include generated system description include $(TOP)/config/system.mak ifeq ($(SYSTEM_LOADED),) MACHINETYPE=unknown OSTYPE=unknown OSREV= endif # Include project specific rules -include $(TOP)/config/project.mak # Include installation specific information -include $(TOP)/config/config # indirect to shared rule sets directory include $(EST)/config/rules/common_make_rules.mak speech_tools/config/test_make_rules0000644000076400007640000000522507262605664016260 0ustar awbawb ########################################################-*-mode:Makefile-*- ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996,1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile rules for testing things # ########################################################################### # indirect to shared rule sets directory include $(TOP)/config/rules/test_make_rules.mak speech_tools/config/vc_common_make_rules0000644000076400007640000000317310127000720017231 0ustar awbawb ###################################################################### # # # Make rules for MicroCruft Visual C++ # # # ###################################################################### !include $(TOP)\config\vc_config_make_rules .SUFFIXES: .cc .obj CPP=cl /nologo /DSYSTEM_IS_WIN32=1 /DINSTANTIATE_TEMPLATES=1 $(MODULEFLAGS) $(AUDIOFLAGS) CC=cl /nologo /DSYSTEM_IS_WIN32=1 $(MODULEFLAGS) default_target: all $(DIRS) @echo done $(DIRNAME) all: $(ALL) $(DIRS) x1 : FORCE @echo building in $(DIRNAME)\$@ @cd $@ @nmake /nologo /fVCMakefile @cd .. FORCE: .vcbuildlibs: .vcbuildlib .vcbuildlib: $(OBJS) @echo add to $(INLIB) $(OBJS) @if EXIST $(INLIB) lib/nologo $(INLIB) $(OBJS) @if NOT EXIST $(INLIB) lib/nologo /out:$(INLIB) $(OBJS) echo built > .vcbuildlib .vc_add_to_lib: $(TOADD) @if EXIST $(ADDLIB) lib/nologo $(ADDLIB) $(TOADD) @if NOT EXIST $(ADDLIB) lib/nologo /out:$(ADDLIB) $(TOADD) @echo built > .vc_add_to_lib .libraries: @echo Libraries not touched for VC++ relink: @echo Links not made for Visual C++ .config_error:: @echo Config not checked for VC .sub_directories: $(BUILD_DIRS) .remove_links: @echo Links not made for Visual C++ .process_scripts: @echo Scripts not created for VC .link_main: @echo Links not made for Visual C++ .cc.obj: $(CPP) $(CFLAGS) /c /Tp$*.cc /Fo$*.obj .c.obj: $(CC) $(CFLAGS) /c $*.c /Fo$*.obj # this dummy rule stops the comment in make.depend getting # interpreted as a command... YEUCH hack_dummy_target: speech_tools/config/config.in0000644000076400007640000001373311101663021014721 0ustar awbawb########################################################-*-mode:Makefile-*- ## ## ## Edinburgh Speech Tools: local configuration file ## ## ## ########################################################################### ## ## Specific config file for local installation ## ########################################################################### ## Where the speech_tools tree will be installed. ## ## The default is that the speech_tools will remain where it is compiled. ## ## You may need to set this explicitly if automounter or NFS ## side effects cause problems EST_HOME := $(shell (cd $(EST); pwd)) ########################################################################### ## System type. ## ## The system will attempt to determine this, but if it is wrong you may ## need to set it explicitly. The definitions are in ## systems/$(SYSTEM_TYPE).mak ## ## Format: machine _ os osrev ## ## Examples: sparc_SunOS5 intel_Linux2.0 SYSTEM_TYPE=$(MACHINETYPE)_$(OSTYPE)$(OSREV) ########################################################################### ## Compiler. ## The definitions are in compilers/$(COMPILER).mak ## Examples: gcc suncc egcs gcc28 COMPILER=@COMPILERTYPE@ ########################################################################### ## Java system to use if you include the Java interface. ## Examples jdk JAVA_COMPILER=jdk ########################################################################### ## Pre defined configurations (for directory locations, setup peculiarities ## etc.) ## ## Examples: default cstr rjc CONFIGURATION = ########################################################################### ## Compilation options. ## ## OPTIMISE=4 will turn off DEBUG OPTIMISE=3 WARN=1 # VERBOSE=1 #DEBUG=1 # PROFILE=gprof #SHARED=2 ## Directory specific selections which override the above OPTIMISE_sigpr = 3 ########################################################################### ## Feature selection. ## ## Select modules to include. ## AUDIO ## various audio devices are supported directly but you can always ## specify a program to play files in a desired format. ## NCD's network audio system. # INCLUDE_MODULES += NAS_AUDIO ## Elightenment Sound Demon, for KDE etc. # INCLUDE_MODULES += ESD_AUDIO ## Native audio for your platform (sun, linux, freebsd, irix, macosx, windows) INCLUDE_MODULES += NATIVE_AUDIO ## Special code to run Windows MPLAYER # INCLUDE_MODULES += MPLAYER_AUDIO ## Under Linux there may be a choice of audio support ## This is only used if we are under Linux (or a linux like system) LINUXAUDIO = @LINUXAUDIO@ ## USER INTERFACE ## Command-line editing. This option gives command line editing and history. ## It may not work under all systems, so may be optionally omitted. INCLUDE_MODULES += EDITLINE TERMCAPLIB = @TERMCAPLIB@ # speech recognition #INCLUDE_MODULES += ASR ## Scheme ## Scheme In One Defun interpreter and data structures INCLUDE_MODULES += SIOD ## The following subsystems depend on the Scheme subsystem and so ## must be removed if Scheme is not included INCLUDE_MODULES += WAGON INCLUDE_MODULES += SCFG INCLUDE_MODULES += WFST INCLUDE_MODULES += OLS ## Java ## Define this to include the pure Java code # INCLUDE_MODULES += JAVA # JAVA_HOME = PUT_SOMETHING_HERE ## Define this to compile the Java interface to the EST classes. You ## need to compile with the SHARED option above. This is required for ## fringe. # INCLUDE_MODULES += JAVA_CPP ## Define this to have the Java code use the Java Media API to ## play sounds etc. # INCLUDE_MODULES += JAVA_MEDIA # JMF_HOME = PUT_SOMETHING_HERE ## Richard Tobin's RXP XML parser. INCLUDE_MODULES += RXP ## Debugging, You should probably only do one or the other of these. ## Efence protected malloc library to catch memory errors # INCLUDE_MODULES += EFENCE ## Dmalloc, another chekcing malloc library # INCLUDE_MODULES += DMALLOC ################################################################### ## Wrappers for selected EST Classes and functionality for ## various high level scripted languages, such as Perl ## Uncomment following to enable building of wrappers #INCLUDE_MODULES += WRAPPERS ## Path to Swig. ## ## If you can't or don't need to run swig yourself (you probably ## don't), then leaving this variable commented out will use the ## default pre-generated code. ## ## Only set this if you *DO* want to run swig (for example to modify ## the wrappers yourself). If so, the safest bet is to use the same ## version of swig as speech tools developers (download from ## http://www.swig.org/ (SWIG-1.3.27 used here)) ## #CONFIG_SWIG_COMPILER = /usr/bin/swig # Languages to generate wrappers for. Currently: PYTHON and PERL5 CONFIG_WRAPPER_LANGUAGES = PYTHON PERL5 # Language specific includes should be set to correct site paths CONFIG_PYTHON_INCLUDES= -I/usr/include/python2.2/ CONFIG_PERL_INCLUDES= -I/usr/lib/perl5/5.8.3/i386-linux-thread-multi/CORE/ #OR OLD#CONFIG_PERL_INCLUDES= -I/usr/lib/perl5/5.6.1/i386-linux/CORE/ ## ################################################################### ## Additional subsystems to include should be listed here. ALSO_INCLUDE= ## Turn this on to compile all known modules. This is intended for ## portability testing. # INCLUDE_EVERYTHING=1 ########################################################################### ## Now include the settings include $(EST)/config/systems/$(SYSTEM_TYPE).mak include $(EST)/config/compilers/$(COMPILER).mak ifneq ($(JAVA_COMPILER),none) include $(EST)/config/compilers/$(JAVA_COMPILER).mak endif ifneq ($(CONFIGURATION),) include $(CONFIGURATION:%=$(EST)/config/configs/%.mak) endif ########################################################################### ## ## Any settings you need to describe how your system differs from the ## assumed defaults should go below. See config/ReadMe for a description ## of the most common things you might need. # COMPILERLIBS = speech_tools/config/vc_config_make_rules-dist0000644000076400007640000000140611461104305020152 0ustar awbawb ###################################################################### # # # Configuration variable make settings for MicroCruft Visual C++ # # # ###################################################################### MODULEFLAGS=/DSUPPORT_EDITLINE=1 AUDIOFLAGS=/DSUPPORT_MPLAYER=1 /DSUPPORT_WIN32AUDIO=1 DEBUGFLAGS= /Zi LINKDEBUGFLAGS = /debug OPTFLAGS= /EHsc /wd4675 INCLUDEFLAGS= /I$(TOP)/include $(LOCAL_INCLUDES) LINKFLAGS=$(LINKDEBUGFLAGS) LIB_DIR=lib ESTLIBS = $(TOP)\lib\libestools.lib $(TOP)\lib\libestbase.lib $(TOP)\lib\libeststring.lib WINLIBS = wsock32.lib winmm.lib !ifndef VCLIBS VCLIBS = $(ESTLIBS) !endif speech_tools/config/project.mak0000644000076400007640000001223711461353050015271 0ustar awbawb#########################################################-*-mode:Makefile-*- ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Things specific to the Speech Tools. ## ## ## ########################################################################### PROJECT_NAME = Edinburgh Speech Tools Library PROJECT_PREFIX = EST PROJECT_VERSION = 2.1 PROJECT_DATE = November 2010 PROJECT_STATE = release # Speech tools knows where speech_tools is. Probably. EST=$(TOP) # Where the main RCS tree is, probably only used within CSTR CENTRAL_DIR = $(LOCAL_REPOSITORY)/speech_tools # Place to find the optional modules for this project. MODULE_DIRECTORY = $(TOP) # List of all known modules DISTRIBUTED_MODULES = \ NAS_AUDIO ESD_AUDIO NATIVE_AUDIO MPLAYER_AUDIO \ EDITLINE \ SIOD WAGON SCFG WFST OLS \ JAVA JAVA_CPP JAVA_MEDIA \ TCL RXP DEVELOPMENT_MODULES = \ ASR UTILITY_MODULES = \ EFENCE DMALLOC DEBUGGING ALL_REAL_MODULES = \ $(DISTRIBUTED_MODULES) \ $(DEVELOPMENT_MODULES) ALL_MODULES = \ $(ALL_REAL_MODULES) \ $(UTILITY_MODULES) # Place where programs are compiled PROJECT_MAIN_DIR=$(TOP)/main PROJECT_SCRIPTS_DIR=$(TOP)/scripts PROJECT_LIB_DIR = $(TOP)/lib # Libraries defined in this project PROJECT_LIBRARIES = estools estbase eststring PROJECT_LIBRARIES_JAVA = estjava PROJECT_LIBRARY_DIR = lib PROJECT_LIBRARY_DIR_estools = $(TOP)/lib PROJECT_LIBRARY_DIR_estbase = $(TOP)/lib PROJECT_LIBRARY_DIR_eststring = $(TOP)/lib PROJECT_LIBRARY_DIR_estjava = $(TOP)/lib PROJECT_LIBRARY_USES_estbase = eststring PROJECT_LIBRARY_USES_estjava = estbase eststring PROJECT_LIBRARY_VERSION_estools = $(PROJECT_VERSION).1 PROJECT_LIBRARY_VERSION_estbase = $(PROJECT_VERSION).1 PROJECT_LIBRARY_VERSION_eststring = 1.2 PROJECT_LIBRARY_VERSION_estjava = $(PROJECT_VERSION).1 PROJECT_LIBRARY_NEEDS_SYSLIBS_estjava=1 PROJECT_DEFAULT_LIBRARY = estools PROJECT_SHARED_LIBRARIES = eststring estbase PROJECT_ALL_LIBRARIES = eststring estbase estools JAVA_CLASS_LIBRARY = $(LOCAL_JAVA_CLASS_LIBRARY) JAVA_CLASSPATH=$(LOCAL_JAVA_CLASSPATH):$(SYSTEM_JAVA_CLASSPATH) PROJECT_JAVA_ROOT=$(LOCAL_JAVA_ROOT) # Libraries used from other projects REQUIRED_LIBRARIES = # Includes for this and related projects PROJECT_INCLUDES = -I$(TOP)/include PROJECT_TEMPLATE_DIRS = include audio utils \ base_class base_class/string base_class/templ_inst \ ling_class speech_class sigpr stats grammar PROJECT_TEMPLATE_DBS = $(TOP) # Places to look for documentation DOCXX_DIRS = $(TOP)/include $(TOP)/testsuite speech_tools/config/system.sh0000644000076400007640000001165607603117136015023 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Guess what kind of system we are on. ## ## ## ########################################################################### # Where the Makefile fragments live SYSTEMS=$1 # Drop and _xxx from the end OSTYPE=`uname -s | sed -e '/^\([^_]*\).*/s//\1/' -e '/\//s///g'` # CPU, downcased, /s and some uninteresting details eliminated MACHINETYPE=`{ mach || uname -m || echo unknown ; } 2>/dev/null | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ/ abcdefghijklmnopqrstuvwxyz_ | sed -e 's/i[0-9]86/ix86/' \ -e 's/sun4/sparc/' \ -e 's/ip[0-9]*/ip/'\ -e 's/ /_/g'\ -e 's/9000_7../hp9000/' ` # OR revision, only take first two numbers. OSREV=`{ uname -r || echo ""; } 2> /dev/null | sed -e 's/^\([^.]*\)\(\.[^-. ]*\).*/\1\2/'` # Sort out various flavours of Linux if [ "$OSTYPE" = Linux ] then if [ -f "/etc/redhat-release" ] then OSTYPE=RedHatLinux OSREV=`cat /etc/redhat-release | sed -e 's/[^0-9]*\([0-9.]*\).*/\1/'` elif [ -f "/etc/debian_version" ] then OSTYPE=DebianGNULinux OSREV=`cat /etc/debian_version` else # Generic unknown GNU/Linux system. OSTYPE=Linux fi fi # Make sure we actually have a .mak file for it, otherwise fall back # to sensible defaults (for example, kernel version and architecture # are completely irrelevant on Linux) if [ ! -f "${SYSTEMS}/${MACHINETYPE}_${OSTYPE}${OSREV}.mak" ]; then if [ -f "${SYSTEMS}/${OSTYPE}${OSREV}.mak" ]; then MACHINETYPE=unknown elif [ -f "${SYSTEMS}/${MACHINETYPE}_${OSTYPE}.mak" ]; then OSREV= elif [ -f "${SYSTEMS}/unknown_${OSTYPE}.mak" ]; then MACHINETYPE=unknown OSREV= elif [ "$OSTYPE" = "RedHatLinux" -o "$OSTYPE" = "DebianGNULinux" ]; then MACHINETYPE=unknown OSTYPE=Linux OSREV= elif [ "$OSTYPE" = "Darwin" ]; then OSREV= else OSTYPE=unknown OSREV= fi fi echo ' ###########################################################################' echo ' ## This file is created automatically from your config file.' echo ' ## Do not hand edit.' echo ' ## Created:'`date` echo ' ###########################################################################' echo '' echo "OSTYPE:=$OSTYPE" echo "MACHINETYPE:=$MACHINETYPE" echo "OSREV:=$OSREV" echo "SYSTEM_LOADED:=1" exit 0 speech_tools/config/make_system.mak0000644000076400007640000000606407262616577016171 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Guess what kind of system we are on. ## ## ## ########################################################################### system.mak : config @echo Check system type >&2 @/bin/sh $(TOP)/config/system.sh $(TOP)/config/systems > system.mak speech_tools/config/systems/Makefile0000644000076400007640000001056411363127725016312 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### TOP=../.. DIRNAME=config/systems SYSTEMS = \ Linux.mak \ RedHatLinux.mak \ DebianGNULinux.mak \ alpha_Linux.mak \ alpha_OSF1V4.0.mak \ alpha_RedHatLinux.mak \ hp9000_HP-UX.mak \ hp9000_HP-UXB.10.mak \ ip_IRIX.mak \ ip_IRIX5.3.mak \ ip_IRIX6.3.mak \ ip_IRIX6.4.mak \ ip_IRIX646.4.mak \ ix86_CYGWIN1.0.mak \ ix86_CYGWIN1.1.mak \ ix86_CYGWIN1.3.mak \ ix86_CYGWIN1.4.mak \ ix86_CYGWIN1.5.mak \ ix86_CYGWIN1.7.mak \ ix86_CYGWIN20.1.mak \ ix86_CYGWIN32.mak \ ix86_CYGWIN324.0.mak \ ix86_Darwin.mak \ ix86_FreeBSD.mak \ ix86_FreeBSD2.1.mak \ ix86_FreeBSD2.2.mak \ ix86_FreeBSD3.0.mak \ ix86_FreeBSD3.1.mak \ ix86_FreeBSD3.2.mak \ ix86_FreeBSD3.3.mak \ ix86_FreeBSD4.0.mak \ ix86_OS22.mak \ ix86_RedHatLinux4.0.mak \ ix86_RedHatLinux4.1.mak \ ix86_RedHatLinux4.2.mak \ ix86_RedHatLinux5.0.mak \ ix86_RedHatLinux5.1.mak \ ix86_RedHatLinux5.2.mak \ ix86_RedHatLinux6.0.mak \ ix86_RedHatLinux6.1.mak \ ix86_RedHatLinux6.2.mak \ ix86_RedHatLinux7.0.mak \ ix86_SunOS5.5.mak \ ix86_SunOS5.6.mak \ ix86_SunOS5.7.mak \ ix86_SunOS5.8.mak \ ix86_SunOS5.mak \ rs6000_AIX4.1.mak \ sparc_SunOS4.1.mak \ sparc_SunOS4.mak \ sparc_SunOS5.5.mak \ sparc_SunOS5.6.mak \ sparc_SunOS5.7.mak \ sparc_SunOS5.8.mak \ sparc_SunOS5.9.mak \ sparc_SunOS5.mak \ sparc_unknown.mak \ unknown_DebianGNULinux.mak \ unknown_Linux.mak \ unknown_RedHatLinux.mak \ power_macintosh_Darwin.mak \ unknown_unknown.mak \ x86_64_Darwin.mak FILES = Makefile default.mak $(SYSTEMS) include $(TOP)/config/common_make_rules speech_tools/config/systems/default.mak0000644000076400007640000001264310266453751016772 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Very common settings to avoid repetition. ## ## ## ########################################################################### ########################################################################### ## Installation directories INSTALL_PREFIX=/usr/local BINDIR=$(INSTALL_PREFIX)/bin LIBDIR=$(INSTALL_PREFIX)/lib INCDIR=$(INSTALL_PREFIX)/include MANDIR=$(INSTALL_PREFIX)/man ########################################################################### ## Where the central RCS masters are stored. ## ## Used for development at CSTR, you can probably ignore it. LOCAL_REPOSITORY = ########################################################################### ## Where to find Network Audio NAS_INCLUDE = /usr/X11R6/include NAS_LIB = /usr/X11R6/lib ########################################################################### ## Where to find Enlightenment Speech Demon ESD_INCLUDE = /usr/local/include ESD_LIB = /usr/local/lib ########################################################################### ## Where to find X11 X11_INCLUDE = /usr/X11R6/include X11_LIB = /usr/X11R6/lib ########################################################################### ## TCL support TCL_INCLUDE = /usr/local/include TCL_LIB = /usr/local/lib TCL_LIBRARY = -ltcl7.6 ########################################################################### ## Efence library for malloc debugging EFENCE_LIB = /usr/local/lib ########################################################################### ## Commands. ## Must support -nt GNUTEST = gnutest ## INSTALL_PROG = install ## Used to index libraries RANLIB = ranlib ## echo without a newline ECHO_N = echo -n ## make depend for when we haven't specified a compiler MAKE_DEPEND_C = makedepend $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) MAKE_DEPEND_CXX = makedepend $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) ## Generic library building BUILD_LIB =$(AR) cruv ## generic library indexing INDEX_LIB = $(RANLIB) ## shrink executables STRIP = strip ## Useful sloth DO_NOTHING = true DO_NOTHING_ARGS = : ## different types of awk. For our purposes gawk can be used for nawk AWK = awk NAWK = nawk ## Perl. Not used in build, but we have some perl scripts. PERL=/usr/bin/perl ## Just in case someone has a broken test TEST = test ## Must understand -nt GNUTEST = gnutest ## Avoid clever RMs people may have on their path RM = /bin/rm ########################################################################### ## Arguments for DOC++ for creating documentation DOCXX = doc++ DOCXX_ARGS = -a -f -B banner.inc -M sane -D 'SYSTEM "$(EST_HOME)/doc/sane.dtd"' COMPILER_VERSION_COMMAND=true JAVA_COMPILER_VERSION_COMMAND=true JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include/genunix speech_tools/config/systems/Linux.mak0000644000076400007640000000652007262605664016446 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for Linux. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak DEFAULT_JAVA_HOME=/usr/lib/jdk-1.1.6 JAVA=/usr/bin/java JAVAC=/usr/bin/javac JAVAH=/usr/bin/javah TCL_LIBRARY = -ltcl OS_LIBS = -ldl ## the native audio module for this type of system NATIVE_AUDIO_MODULE = LINUX16 ## echo -n doesn't work ECHO_N = /usr/bin/printf "%s" GNUTEST=test ## awk is gawk, so it does all we could desire and then more. NAWK=awk speech_tools/config/systems/RedHatLinux.mak0000644000076400007640000000556207262605664017543 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux distributions. ## ## ## ########################################################################### speech_tools/config/systems/DebianGNULinux.mak0000644000076400007640000000564607262616577020140 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: David Huggins-Daines ## ## -------------------------------------------------------------------- ## ## Settings for Debian GNU/Linux distributions. ## ## ## ########################################################################### # Debian does not use termcap OS_LIBS = -ldl -lncurses speech_tools/config/systems/alpha_Linux.mak0000644000076400007640000000565507262616577017630 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux distributions. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak CFLAGS += -mieee speech_tools/config/systems/alpha_OSF1V4.0.mak0000644000076400007640000000606507262605664017600 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Sat Oct 18 1997 ## ## -------------------------------------------------------------------- ## ## Settings for DEC Alpha OSF1 V4.0 ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## echo -n doesn't work (well only sometimes ?) ECHO_N = /bin/printf "%s" speech_tools/config/systems/alpha_RedHatLinux.mak0000644000076400007640000000572707262616577020720 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux on Alpha. ## ## ## ########################################################################### include $(EST)/config/systems/alpha_Linux.mak ifndef GCC GCC=egcs endif EGCS_CC=gcc EGCS_CXX=g++ speech_tools/config/systems/hp9000_HP-UX.mak0000644000076400007640000000651707262605664017216 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## HP 9000 series. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## Just guesses for what people are likely to have GCC=gcc27 ## Libraries needed for sockets based programs. OS_LIBS = -lsocket -lnsl ## the native audio module for this type of system NATIVE_AUDIO_MODULE = ## Official location for java DEFAULT_JAVA_HOME=/usr/java1.1 GCC_SYSTEM_OPTIONS = ## specific java files JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include/SOMETHING_HP_HERE ## echo -n doesn't work ECHO_N = /bin/printf "%s" speech_tools/config/systems/hp9000_HP-UXB.10.mak0000644000076400007640000000563707262605664017541 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Specifics for this version of HP-UX. ## ## ## ########################################################################### include $(EST)/config/systems/hp9000_HP-UX.mak speech_tools/config/systems/ip_IRIX.mak0000644000076400007640000000634107262605664016613 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh,UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## Date: Nov 1997 ## ########################################################################### ## Settings for Irix ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = IRIX ## echo -n doesn't work (well only sometimes ?) ECHO_N = /bin/printf "%s" ## Doesn't have or need RANLIB RANLIB = true ## IRIX specific java include files. JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include/irix speech_tools/config/systems/ip_IRIX5.3.mak0000644000076400007640000000602207262605664017035 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh,UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## Date: Nov 1997 ## ########################################################################### ## Settings for Irix 5.3. ## ## ## ########################################################################### include $(EST)/config/systems/ip_IRIX.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = IRIX53 speech_tools/config/systems/ip_IRIX6.3.mak0000644000076400007640000000570207262605664017042 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh,UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## Date: Nov 1997 ## ########################################################################### ## Settings for Irix 6.3. ## ## ## ########################################################################### include $(EST)/config/systems/ip_IRIX.mak speech_tools/config/systems/ip_IRIX6.4.mak0000644000076400007640000000570207262605664017043 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh,UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## Date: Nov 1997 ## ########################################################################### ## Settings for Irix 6.4. ## ## ## ########################################################################### include $(EST)/config/systems/ip_IRIX.mak speech_tools/config/systems/ip_IRIX646.4.mak0000644000076400007640000000570207262605664017215 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh,UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black ## ## Date: Nov 1997 ## ########################################################################### ## Settings for Irix 6.4. ## ## ## ########################################################################### include $(EST)/config/systems/ip_IRIX.mak speech_tools/config/systems/ix86_CYGWIN1.0.mak0000644000076400007640000000571407262616577017455 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin1.0 ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak ## Cygwin version of egcs has optimisatin problems with some files. HONOUR_NOOPT=1 speech_tools/config/systems/ix86_CYGWIN1.1.mak0000644000076400007640000000571407262616577017456 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin1.1 ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak ## Cygwin version of egcs has optimisatin problems with some files. HONOUR_NOOPT=1 speech_tools/config/systems/ix86_CYGWIN1.3.mak0000644000076400007640000000571207327525100017435 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin1.3 ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak ## Cygwin version of egcs has optimisatin problems with some files. HONOUR_NOOPT=1 speech_tools/config/systems/ix86_CYGWIN1.4.mak0000644000076400007640000000564307262605664017455 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin32 v 4.0 (b19). ## ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak speech_tools/config/systems/ix86_CYGWIN1.5.mak0000644000076400007640000000564307262605664017456 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin32 v 4.0 (b19). ## ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak speech_tools/config/systems/ix86_CYGWIN1.7.mak0000644000076400007640000000564311342760226017446 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin32 v 4.0 (b19). ## ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak speech_tools/config/systems/ix86_CYGWIN20.1.mak0000644000076400007640000000576707262605664017542 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin32 v 4.0 (b19). ## ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak ## Cygwin version of egcs has optimisatin problems with some files. HONOUR_NOOPT=1 speech_tools/config/systems/ix86_CYGWIN32.mak0000644000076400007640000000630607262605664017374 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygwin32. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak DEFAULT_JAVA_HOME=/usr/lib/jdk-1.1.6 gcc=gcc27 ## the native audio module for this type of system NATIVE_AUDIO_MODULE = WIN32 GNUTEST=test RM=rm ## awk is gawk, so it does all we could desire and then more. NAWK=awk ## EGCS installs as gcc EGCS_CC=gcc EGCS_CXX=gcc OS_LIBS = -lwinmm -luser32 speech_tools/config/systems/ix86_CYGWIN324.0.mak0000644000076400007640000000564307262605664017621 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Cygnus gnuwin32 v 4.0 (b19). ## ## ## ########################################################################### include $(EST)/config/systems/ix86_CYGWIN32.mak speech_tools/config/systems/ix86_Darwin.mak0000644000076400007640000000643011332265736017444 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Aug 3 2006 ## ## -------------------------------------------------------------------- ## ## Settings for Apple Darwin. ## ## Thanks to Brian West ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = MACOSX ## echo -n doesn't work (well only sometimes ?) ECHO_N = /usr/bin/printf "%s" NAWK=awk GCC295=cc CXX=g++ GCC_MAKE_SHARED_LIB = g++ -dynamiclib -undefined dynamic_lookup -o XXX LD_LIBRARY_PATH_VARIABLE = DYLD_LIBRARY_PATHspeech_tools/config/systems/ix86_FreeBSD.mak0000644000076400007640000000654307262616577017451 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Fri Oct 3 1997 ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = FREEBSD16 ## echo -n doesn't work (well only sometimes ?) ECHO_N = /usr/bin/printf "%s" NAWK=awk # GCC_MAKE_SHARED_LIB = ld -Bshareable -x -o XXX DEFAULT_JAVA_HOME=/usr/local/jdk JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v speech_tools/config/systems/ix86_FreeBSD2.1.mak0000644000076400007640000000577207262605664017670 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Sat Oct 11 1997 ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 2.2 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_FreeBSD.mak GCC=gcc26 speech_tools/config/systems/ix86_FreeBSD2.2.mak0000644000076400007640000000577207262605664017671 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Sat Oct 11 1997 ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 2.2 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_FreeBSD.mak GCC=gcc27 speech_tools/config/systems/ix86_FreeBSD3.0.mak0000644000076400007640000000631207262605664017657 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Wed Mar 10 1999 ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 3.0 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_FreeBSD.mak GCC=gcc27 JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/freebsd GCC=gcc27 JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v speech_tools/config/systems/ix86_FreeBSD3.1.mak0000644000076400007640000000645407262605664017667 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Wed Mar 10 1999 ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 3.1 ## ## ## ########################################################################### # They went to ELF at this point, but everything seems fine as is include $(EST)/config/systems/ix86_FreeBSD.mak JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/freebsd GCC=gcc27 JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v GCC_MAKE_SHARED_LIB = gcc -shared -o XXX speech_tools/config/systems/ix86_FreeBSD3.2.mak0000644000076400007640000000575007262605664017666 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 3.2 ## ## ## ########################################################################### # They went to ELF at this point, but everything seems fine as is include $(EST)/config/systems/ix86_FreeBSD3.1.mak speech_tools/config/systems/ix86_FreeBSD3.3.mak0000644000076400007640000000575007262605664017667 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 3.3 ## ## ## ########################################################################### # They went to ELF at this point, but everything seems fine as is include $(EST)/config/systems/ix86_FreeBSD3.1.mak speech_tools/config/systems/ix86_FreeBSD4.0.mak0000644000076400007640000000607507262605664017666 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for FreeBSD 4.0 (not actually checked yet) ## ## ## ########################################################################### # They went to ELF at this point, but everything seems fine as is include $(EST)/config/systems/ix86_FreeBSD.mak JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/freebsd GCC=gcc27 speech_tools/config/systems/ix86_OS22.mak0000644000076400007640000000672707262605664016723 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Samuel Audet ## ## Date: Sat Aug 1 1998 ## ## -------------------------------------------------------------------- ## ## Settings for OS/2 Warp 3 and 4 using EMX/GCC ## ## ## ########################################################################### include $(TOP)/config/systems/default.mak ## custom settings needed GCC=gcc27emx ## Libraries needed for sockets based programs. OS_LIBS = -lsocket ## uses the path RM = rm ## the native audio module for this type of system NATIVE_AUDIO_MODULE = OS2 ## Must support -nt GNUTEST = test ## echo -n doesn't work (well only sometimes ?) ECHO_N = echo -n ## awk is gawk, so it does all we could desire and then more. NAWK=awk ## Used to index libraries RANLIB = ar s  speech_tools/config/systems/ix86_RedHatLinux4.0.mak0000644000076400007640000000572307262616577020647 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 4.0. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak GCC=gcc27 speech_tools/config/systems/ix86_RedHatLinux4.1.mak0000644000076400007640000000572307262616577020650 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 4.1. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak GCC=gcc27 speech_tools/config/systems/ix86_RedHatLinux4.2.mak0000644000076400007640000000572307262616577020651 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 4.1. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak GCC=gcc27 speech_tools/config/systems/ix86_RedHatLinux5.0.mak0000644000076400007640000000572307262616577020650 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 5.1. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak GCC=gcc27 speech_tools/config/systems/ix86_RedHatLinux5.1.mak0000644000076400007640000000577107262616577020654 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 5.1. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak ifndef GCC GCC=egcs endif EGCS_CC=gcc EGCS_CXX=g++ speech_tools/config/systems/ix86_RedHatLinux5.2.mak0000644000076400007640000000610507262605664020640 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 5.1. ## ## ## ########################################################################### include $(EST)/config/systems/ix86_RedHatLinux5.1.mak DEFAULT_JAVA_HOME=/usr/local/jdk-1.1.6 JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v speech_tools/config/systems/ix86_RedHatLinux6.0.mak0000644000076400007640000000623007262616577020643 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 6.0. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak ifndef GCC GCC=egcs endif EGCS_CC=gcc EGCS_CXX=g++ DEFAULT_JAVA_HOME=/usr/local/jdk1.1.6 JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v speech_tools/config/systems/ix86_RedHatLinux6.1.mak0000644000076400007640000000623107262616577020645 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 6.1. (guess) ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak ifndef GCC GCC=egcs endif EGCS_CC=gcc EGCS_CXX=g++ DEFAULT_JAVA_HOME=/usr/local/jdk1.1.6 JAVA=$(JAVA_HOME)/bin/java JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah -jni JAR=$(JAVA_HOME)/bin/jar cf0v speech_tools/config/systems/ix86_RedHatLinux6.2.mak0000644000076400007640000000564607262605664020652 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 6.2. (guess) ## ## ## ########################################################################### include $(EST)/config/systems/ix86_RedHatLinux6.1.mak speech_tools/config/systems/ix86_RedHatLinux7.0.mak0000644000076400007640000000566207262616577020654 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Red Hat Linux 7.0. (guess) ## ## ## ########################################################################### include $(EST)/config/systems/ix86_RedHatLinux6.1.mak GCC=gcc296 speech_tools/config/systems/ix86_SunOS5.5.mak0000644000076400007640000000564007262605664017466 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Settings for i386 SunOS 5.5 ## ## ## ## Like sparc except no mv8 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_SunOS5.mak speech_tools/config/systems/ix86_SunOS5.6.mak0000644000076400007640000000564007262605664017467 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Settings for i386 SunOS 5.6 ## ## ## ## Like sparc but no mv8 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_SunOS5.mak speech_tools/config/systems/ix86_SunOS5.7.mak0000644000076400007640000000564007262605664017470 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Settings for i386 SunOS 5.7 ## ## ## ## Like sparc but no mv8 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_SunOS5.mak speech_tools/config/systems/ix86_SunOS5.8.mak0000644000076400007640000000563607624146645017477 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.8 ## ## ## ########################################################################### include $(EST)/config/systems/ix86_SunOS5.mak speech_tools/config/systems/ix86_SunOS5.mak0000644000076400007640000000644607262605664017330 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5 on Intel platform. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak DEFAULT_JAVA_HOME=/usr/java1.1 ## Libraries needed for sockets based programs. OS_LIBS = -lsocket -lnsl ## the native audio module for this type of system NATIVE_AUDIO_MODULE = SUN16 ## echo -n doesn't work (well only sometimes ?) ECHO_N = /bin/printf "%s" SYSTEM_JAVA_INCLUDES = -I$(JAVA_HOME)/include/solaris speech_tools/config/systems/rs6000_AIX4.1.mak0000644000076400007640000000566407262605664017235 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## -------------------------------------------------------------------- ## ## For AIX 4.1 (from Stan Chen) ## ## ## ########################################################################### include $(EST)/config/systems/default.mak LINKFLAGS += -Wl,-bbigtoc speech_tools/config/systems/sparc_SunOS4.1.mak0000644000076400007640000000575607262605664020003 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 4.1 ## ## ## ########################################################################### include $(EST)/config/systems/sparc_SunOS4.mak speech_tools/config/systems/sparc_SunOS4.mak0000644000076400007640000000607007262605664017632 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 4. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = SUN16 speech_tools/config/systems/sparc_SunOS5.5.mak0000644000076400007640000000602107306754313017765 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.5 ## ## ## ########################################################################### CC_OTHER_FLAGS += -Dolder_solaris include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/sparc_SunOS5.6.mak0000644000076400007640000000601707306754326017777 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Tue Nov 4 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.6 ## ## ## ########################################################################### CC_OTHER_FLAGS += -Dolder_solaris include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/sparc_SunOS5.7.mak0000644000076400007640000000563707262605664020010 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.7 ## ## ## ########################################################################### include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/sparc_SunOS5.8.mak0000644000076400007640000000563707304232764020003 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.8 ## ## ## ########################################################################### include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/sparc_SunOS5.9.mak0000644000076400007640000000563707304232764020004 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.8 ## ## ## ########################################################################### include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/sparc_SunOS5.mak0000644000076400007640000000676207262605664017643 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.* (aka Solaris 2, aka 'Solaris') ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## Just guesses for what people are likely to have GCC=gcc27 SUNCC=suncc40 ## Libraries needed for sockets based programs. OS_LIBS = -lsocket -lnsl ## the native audio module for this type of system NATIVE_AUDIO_MODULE = SUN16 ## Official location for java DEFAULT_JAVA_HOME=/usr/java1.1 ## Tell gcc we are a v8 sparc or better. Any legacy machines lose. GCC_SYSTEM_OPTIONS = -mv8 ## echo -n doesn't work ECHO_N = /bin/printf "%s" JAVA_SYSTEM_INCLUDES = -I$(JAVA_HOME)/include/solaris ## Force use of nawk AWK=nawk speech_tools/config/systems/sparc_unknown.mak0000644000076400007640000000563707304232764020240 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for SunOS 5.8 ## ## ## ########################################################################### include $(EST)/config/systems/sparc_SunOS5.mak speech_tools/config/systems/unknown_DebianGNULinux.mak0000644000076400007640000000571007262616577021707 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: David Huggins-Daines ## ## -------------------------------------------------------------------- ## ## Settings for generic/unknown Debian GNU/Linux systems ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/DebianGNULinux.mak speech_tools/config/systems/unknown_Linux.mak0000644000076400007640000000562707262616577020241 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Linux v2. ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak speech_tools/config/systems/unknown_RedHatLinux.mak0000644000076400007640000000570607262616577021327 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Robert Clark (robert@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for unknown Red Hat Linux versions ## ## ## ########################################################################### include $(EST)/config/systems/Linux.mak include $(EST)/config/systems/RedHatLinux.mak speech_tools/config/systems/power_macintosh_Darwin.mak0000644000076400007640000000631710075606451022047 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Fri Oct 3 1997 ## ## -------------------------------------------------------------------- ## ## Settings for Apple Darwin. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = MACOSX ## echo -n doesn't work (well only sometimes ?) ECHO_N = /usr/bin/printf "%s" NAWK=awk GCC295=cc # GCC_MAKE_SHARED_LIB = ld -Bshareable -x -o XXX speech_tools/config/systems/unknown_unknown.mak0000644000076400007640000000612307262605664020624 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Tue Oct 7 1997 ## ## -------------------------------------------------------------------- ## ## A default description used to bootstrap. ## ## ## ########################################################################### include $(EST)/config/systems/default.mak ## Must support -nt GNUTEST = gnutest ## echo -n doesn't work (well only sometimes ?) ECHO_N = echo speech_tools/config/systems/x86_64_Darwin.mak0000644000076400007640000000643011350672152017576 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Aug 3 2006 ## ## -------------------------------------------------------------------- ## ## Settings for Apple Darwin. ## ## Thanks to Brian West ## ########################################################################### include $(EST)/config/systems/default.mak ## the native audio module for this type of system NATIVE_AUDIO_MODULE = MACOSX ## echo -n doesn't work (well only sometimes ?) ECHO_N = /usr/bin/printf "%s" NAWK=awk GCC295=cc CXX=g++ GCC_MAKE_SHARED_LIB = g++ -dynamiclib -undefined dynamic_lookup -o XXX LD_LIBRARY_PATH_VARIABLE = DYLD_LIBRARY_PATHspeech_tools/config/compilers/Makefile0000644000076400007640000000610110067557464016577 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### TOP=../.. DIRNAME=config/compilers COMPILERS = gcc.mak gcc27.mak gcc28.mak gcc295.mak \ egcs.mak gcc27emx.mak intel80.mak \ suncc.mak suncc40.mak \ jolt.mak jdk.mak jdk12.mak none.mak \ jikes.mak gcc296.mak gcc30.mak gcc31.mak gcc32.mak FILES = Makefile $(COMPILERS) gcc_defaults.mak suncc_defaults.mak jdk_defaults.mak jikes_defaults.mak include $(TOP)/config/common_make_rules speech_tools/config/compilers/gcc.mak0000644000076400007640000000605507262605664016374 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for GCC. ## ## ## ########################################################################### ifdef GCC include $(EST)/config/compilers/$(GCC).mak else include $(EST)/config/compilers/gcc_defaults.mak endif speech_tools/config/compilers/gcc27.mak0000644000076400007640000000611507262605664016542 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for GCC version 2.7. ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=FSF gcc2.7 ifndef GCC27 GCC27 = gcc endif CC= $(GCC27) CXX = $(GCC27) speech_tools/config/compilers/gcc28.mak0000644000076400007640000000637507262605664016553 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Fri Jan 16 1998 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-2.8.1. ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak ifndef GCC28 GCC28 = gcc endif CC= $(GCC28) CXX = $(GCC28) COMPILER_DESC=FSF gcc2.8 CXXFLAGS += -fguiding-decls STATIC_LINKFLAGS = -Dstatic # gcc-2.8.1 has problems in optimizing some files HONOUR_NOOPT=1 COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/gcc295.mak0000644000076400007640000000627607603340700016623 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## Date: Thu Sept 2 1999 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-2.95.1 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=FSF gcc2.95.1 ifndef GCC295 GCC295 = gcc endif CC= $(GCC295) CXX = $(GCC295) CXXFLAGS += -fguiding-decls STATIC_LINKFLAGS = -Dstatic COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/egcs.mak0000644000076400007640000000643307262605664016561 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: December 1997 ## ## -------------------------------------------------------------------- ## ## Settings for egcs-1.0 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc28.mak COMPILER_DESC=egcs ifndef EGCS_CC EGCS_CC = egcs endif ifndef EGCS_CXX EGCS_CXX = egcs endif CC=$(EGCS_CC) CXX=$(EGCS_CXX) ifndef EGCS_MAKE_SHARED_LIB MAKE_SHARED_LIB = gcc -shared -fno-shared-data -o XXX -Xlinker -h -Xlinker XXX else MAKE_SHARED_LIB = $(GCC_MAKE_SHARED_LIB) endif speech_tools/config/compilers/gcc27emx.mak0000644000076400007640000000655707262605664017266 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## Author: Samuel Audet ## ## Date: Sat Aug 1 1998 ## ## -------------------------------------------------------------------- ## ## Settings for GCC version 2.7 with EMX. ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=FSF gcc2.7 EMX CC = gcc CXX = gcc COMPILERLIBS = $(COMPILER_LIBS_DIR:%=-L%) -lstdcpp LINKFLAGS += -Zexe -Zmtd CFLAGS += -Zexe -Zmtd CXXFLAGS += -Zexe -Zmtd speech_tools/config/compilers/intel80.mak0000644000076400007640000001012410060106713017070 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Rob Clark ## ## Date: Feb 2004 ## ## -------------------------------------------------------------------- ## ## Settings for intec cc 8.0 ## ## ## ########################################################################### CC=icc CXX=icpc COMPILER_DESC=Intel 8.0 COMPILER_VERSION_COMMAND=$(CXX) -v 2>&1 | tail -1 | sed -e 's/^Version.//' CFLAGS = $(CC_OTHER_FLAGS) CXXFLAGS = $(CC_OTHER_FLAGS) DEBUG_CCFLAGS = -g DEBUG_CXXFLAGS = -g DEBUG_LINKFLAGS = -g WARN_CCFLAGS = -Wall WARN_CXXFLAGS = -Wall WARN_LINKFLAGS = -Wall OPTIMISE_CCFLAGS = -O$(OPTIMISE) OPTIMISE_CXXFLAGS = -O$(OPTIMISE) OPTIMISE_LINKFLAGS = -O$(OPTIMISE) PROFILE_DEFAULT = gprof PROFILE_prof_CCFLAGS = -p PROFILE_prof_CXXFLAGS = -p PROFILE_prof_LINKFLAGS = -p PROFILE_gprof_CCFLAGS = -pg PROFILE_gprof_CXXFLAGS = -pg PROFILE_gprof_LINKFLAGS = -pg SHARED_CCFLAGS = -fpic SHARED_CXXFLAGS = -fPIC SHARED_LINKFLAGS = MAKE_SHARED_LIB = $(CXX) -shared -o XXX #-shared -R$(MAIN_LIBRARY_DIR) STATIC_CCFLAGS = STATIC_CXXFLAGS = STATIC_LINKFLAGS = -Dstatic TEMPLATE_SPECIFIC = -DINSTANTIATE_TEMPLATES TEMPLATE_ARGS = BUILD_LIB = $(AR) cruv INDEX_LIB = $(RANLIB) WARN_CXXFLAGS += MAKE_DEPEND_C = $(CC) -MM $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) MAKE_DEPEND_CXX = $(CC) -MM $(INCLUDES) $(WARN_CXXFLAGS) $(TEMPLATES) $(TEMPLATE_SPECIFIC) COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) speech_tools/config/compilers/suncc.mak0000644000076400007640000000606307262605664016752 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for unbundled sun compiler. ## ## ## ########################################################################### ifdef SUNCC include $(EST)/config/compilers/$(SUNCC).mak else include $(EST)/config/compilers/suncc_defaults.mak endif speech_tools/config/compilers/suncc40.mak0000644000076400007640000000627407262605664017122 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for Sun CC 4.0 ## ## ## ########################################################################### include $(EST)/config/compilers/suncc_defaults.mak COMPILER_DESC=Sun CC 4.0 ifndef SUNCC40_CXX SUNCC40_CXX=/opt/SUNWspro/bin/CC endif ifndef SUNCC40_CC SUNCC40_CC=/opt/SUNWspro/bin/cc endif CC= $(SUNCC40_CC) CXX = $(SUNCC40_CXX) MATH_LIBRARY= -L/lib -lm COMPILERLIBS=-lC SYSTEM_LD_LIBRARY_PATH=/opt/SUNWspro/lib speech_tools/config/compilers/jolt.mak0000644000076400007640000000640307262605664016605 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Fri Feb 27th 1998 ## ## -------------------------------------------------------------------- ## ## Descriptin of Sun's JDK 1.1.* ## ## ## ########################################################################### JAVAC = javac DEBUG_JAVAC = javac JAVAH = javah -jni DEBUG_JAVAH = javah -jni JAR = jar JAVAFLAGS = DEBUG_JAVAFLAGS = -g WARN_JAVAFLAGS = -deprecation VERBOSE_JAVAFLAGS = -verbose OPTIMISE_JAVAFLAGS = -O JAVAC_COMMAND = CLASSPATH='$(PROJECT_JAVA_ROOT):$(JAVA_CLASSPATH)' $(JAVAC) $(JAVAFLAGS) speech_tools/config/compilers/jdk.mak0000644000076400007640000000657307262605664016415 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Fri Feb 27th 1998 ## ## -------------------------------------------------------------------- ## ## Descriptin of Sun's JDK 1.1.* ## ## ## ########################################################################### include $(EST)/config/compilers/jdk_defaults.mak JAVA_COMPILER_DESC=Sun jdk JAVA_COMPILER_VERSION_COMMAND=$(JAVA) -version 2>&1 | sed -e 's/^.....//' ifndef SYSTEM_JAVA_CLASSPATH ifdef CLASSPATH SYSTEM_JAVA_CLASSPATH = $(CLASSPATH) else SYSTEM_JAVA_CLASSPATH = $(JAVA_HOME)/lib/classes.zip endif endif JAVAFLAGS = -depend DEBUG_JAVAFLAGS = -g WARN_JAVAFLAGS = -deprecation VERBOSE_JAVAFLAGS = -verbose OPTIMISE_JAVAFLAGS = -O speech_tools/config/compilers/jdk12.mak0000644000076400007640000000657007262605664016555 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Fri Feb 27th 1998 ## ## -------------------------------------------------------------------- ## ## Descriptin of Sun's JDK 1.2.* ## ## ## ########################################################################### include $(EST)/config/compilers/jdk_defaults.mak JAVA_COMPILER_DESC=Sun jdk 1.2.X JAVA_COMPILER_VERSION_COMMAND=$(JAVA) -version 2>&1 | sed -e 's/^.....//' ifndef SYSTEM_JAVA_CLASSPATH ifdef CLASSPATH SYSTEM_JAVA_CLASSPATH = $(CLASSPATH) else SYSTEM_JAVA_CLASSPATH = $(JAVA_HOME)/jre/lib/rt.jar endif endif JAVAFLAGS = DEBUG_JAVAFLAGS = -g WARN_JAVAFLAGS = -deprecation VERBOSE_JAVAFLAGS = -verbose OPTIMISE_JAVAFLAGS = -O speech_tools/config/compilers/none.mak0000644000076400007640000000572107262605664016576 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Jul 15 1998 ## ## -------------------------------------------------------------------- ## ## Null compiler, just as a place holder. ## ## ## ########################################################################### COMPILER_DESC_none= speech_tools/config/compilers/jikes.mak0000644000076400007640000000665007262616577016753 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Fri Feb 27th 1998 ## ## -------------------------------------------------------------------- ## ## Descriptin of Sun's JDK 1.1.* ## ## ## ########################################################################### include $(EST)/config/compilers/jikes_defaults.mak JAVA_COMPILER_DESC=Jikes JAVA_COMPILER_VERSION_COMMAND=$(JAVAC) 2>&1 | sed -n '/^\(Version.*)\).*/{s//\1/;p;}' ifndef SYSTEM_JAVA_CLASSPATH ifdef CLASSPATH SYSTEM_JAVA_CLASSPATH = $(CLASSPATH) else SYSTEM_JAVA_CLASSPATH = $(JAVA_HOME)/lib/classes.zip endif endif JAVAFLAGS = -depend DEBUG_JAVAFLAGS = -g WARN_JAVAFLAGS = -deprecation +P NOWARN_JAVAFLAGS = -nowarn VERBOSE_JAVAFLAGS = -verbose OPTIMISE_JAVAFLAGS = -O speech_tools/config/compilers/gcc296.mak0000644000076400007640000000631507262616577016641 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## Date: Thu Sept 2 1999 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-2.95.1 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=RH gcc2.96 ifndef GCC296 GCC296 = gcc endif CC= $(GCC296) CXX = $(GCC296) WARN_CXXFLAGS += -Wno-non-template-friend STATIC_LINKFLAGS = -Dstatic COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/gcc30.mak0000644000076400007640000000630607313436571016532 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## Date: Mon Jun 18 2001 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-3.0 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=gcc-3.0 ifndef GCC30 GCC30 = gcc endif CC= $(GCC30) CXX = $(GCC30) WARN_CXXFLAGS += -Wno-non-template-friend STATIC_LINKFLAGS = -Dstatic COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/gcc31.mak0000644000076400007640000000630607532252461016530 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## Date: Sun Aug 25 2002 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-3.1 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=gcc-3.1 ifndef GCC31 GCC31 = gcc endif CC= $(GCC31) CXX = $(GCC31) WARN_CXXFLAGS += -Wno-non-template-friend STATIC_LINKFLAGS = -Dstatic COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/gcc32.mak0000644000076400007640000000655010127000720016511 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cs.cmu.edu) ## ## Date: Sun Aug 25 2002 ## ## -------------------------------------------------------------------- ## ## Settings for GCC-3.2 ## ## ## ########################################################################### include $(EST)/config/compilers/gcc_defaults.mak COMPILER_DESC=gcc-3.[23] ifndef GCC32 GCC32 = gcc endif CC= $(GCC32) CXX = g++ WARN_CXXFLAGS += -Wno-non-template-friend STATIC_LINKFLAGS = -Dstatic MAKE_DEPEND_C = $(CC) -MM $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) MAKE_DEPEND_CXX = $(CC) -MM $(INCLUDES) $(WARN_CXXFLAGS) $(TEMPLATES) $(TEMPLATE_SPECIFIC) COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ speech_tools/config/compilers/gcc_defaults.mak0000644000076400007640000001074311332265736020255 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for GCC. ## ## ## ########################################################################### CC=gcc CXX=gcc ifeq ($(OSTYPE),Darwin) CXX=g++ endif COMPILER_DESC=FSF gcc COMPILER_VERSION_COMMAND=$(CXX) -v 2>&1 | tail -1 | sed -e 's/^....//' CFLAGS = $(GCC_SYSTEM_OPTIONS) $(CC_OTHER_FLAGS) CXXFLAGS = $(GCC_SYSTEM_OPTIONS) -fno-implicit-templates $(CC_OTHER_FLAGS) DEBUG_CCFLAGS = -g DEBUG_CXXFLAGS = -g DEBUG_LINKFLAGS = -g WARN_CCFLAGS = -Wall WARN_CXXFLAGS = -Wall WARN_LINKFLAGS = -Wall VERBOSE_CCFLAGS = VERBOSE_CXXFLAGS = VERBOSE_LINKFLAGS = OPTIMISE_CCFLAGS = -O$(OPTIMISE) OPTIMISE_CXXFLAGS = -O$(OPTIMISE) OPTIMISE_LINKFLAGS = -O$(OPTIMISE) PROFILE_DEFAULT = gprof PROFILE_prof_CCFLAGS = -p PROFILE_prof_CXXFLAGS = -p PROFILE_prof_LINKFLAGS = -p PROFILE_gprof_CCFLAGS = -pg PROFILE_gprof_CXXFLAGS = -pg PROFILE_gprof_LINKFLAGS = -pg SHARED_CCFLAGS = -fPIC SHARED_CXXFLAGS = -fPIC SHARED_LINKFLAGS = ifndef GCC_MAKE_SHARED_LIB MAKE_SHARED_LIB = $(CXX) -shared -fno-shared-data -o XXX else MAKE_SHARED_LIB = $(GCC_MAKE_SHARED_LIB) endif #-shared -R$(MAIN_LIBRARY_DIR) STATIC_CCFLAGS = STATIC_CXXFLAGS = STATIC_LINKFLAGS = -static TEMPLATE_SPECIFIC = -DINSTANTIATE_TEMPLATES TEMPLATE_ARGS = ## The -lgcc here is redundant - gcc does this anyway - but it ## helps java know what needs to be loaded. COMPILERLIBS= $(COMPILER_LIBS_DIR:%=-L%) -lstdc++ -lgcc ## special ways of doing things, blank means default MAKE_DEPEND_C = $(CC) -MM $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) MAKE_DEPEND_CXX = $(CC) -MM $(INCLUDES) $(TEMPLATES) $(TEMPLATE_SPECIFIC) BUILD_LIB = $(AR) cruv INDEX_LIB = $(RANLIB) speech_tools/config/compilers/suncc_defaults.mak0000644000076400007640000001026210006570362020617 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Settings for unbundled sun compiler. ## ## ## ########################################################################### CC = cc CXX = CC COMPILER_DESC=Sun CC COMPILER_VERSION_COMMAND=$(CXX) -V 2>&1 | sed -e '/CC: /{s///;q;}' CFLAGS =$(suncc_system_options) $(CC_OTHER_FLAGS) CXXFLAGS = $(suncc_system_options) -D__svr4__ $(CC_OTHER_FLAGS) DEBUG_CCFLAGS = -g DEBUG_CXXFLAGS = -g DEBUG_LINKFLAGS = -g WARN_CCFLAGS = +w +w2 WARN_CXXFLAGS = +w +w2 WARN_LINKFLAGS = +w +w2 VERBOSE_CCFLAGS = VERBOSE_CXXFLAGS = -ptv VERBOSE_LINKFLAGS = -ptv OPTIMISE_CCFLAGS = -xO$(OPTIMISE) OPTIMISE_CXXFLAGS = -O$(OPTIMISE) OPTIMISE_LINKFLAGS = -O$(OPTIMISE) PROFILE_DEFAULT = gprof PROFILE_prof_CCFLAGS = -p PROFILE_prof_CXXFLAGS = -p PROFILE_prof_LINKFLAGS = -p PROFILE_gprof_CCFLAGS = -pg PROFILE_gprof_CXXFLAGS = -pg PROFILE_gprof_LINKFLAGS = -pg SHARED_CCFLAGS = -KPIC SHARED_CXXFLAGS = -KPIC ifndef SUNCC_MAKE_SHARED_LIB MAKE_SHARED_LIB = $(CXX) $(TEMPLATES) -G -o XXX else MAKE_SHARED_LIB = $(SUNCC_MAKE_SHARED_LIB) endif TEMPLATE_SPECIFIC = TEMPLATE_ARGS = $(TEMPLATE_DIRS:%=-pti%) $(PROJECT_TEMPLATE_DBS:%=-ptr%) ## special ways of doing things, blank means default MAKE_DEPEND_C = $(CC) $(INCLUDES) $(TEMPLATES) -xM1 MAKE_DEPEND_CXX = $(CXX) $(INCLUDES) $(TEMPLATES) -xM1 BUILD_LIB = $(CXX) $(TEMPLATES) -xar -o INDEX_LIB = $(DO_NOTHING_ARGS) COMPILERLIBS= speech_tools/config/compilers/jdk_defaults.mak0000644000076400007640000000723610667555352020302 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Common definitions for JDK versions ## ## ## ########################################################################### ifndef JAVA_HOME JAVA_HOME = $(DEFAULT_JAVA_HOME) endif export JAVA_HOME ifndef JMF_HOME JMF_HOME = $(DEFAULT_JMF_HOME) endif export JMF_HOME ifndef JSAPI_HOME JSAPI_HOME = $(DEFAULT_JSAPI_HOME) endif export JSAPI_HOME ifdef JMF_HOME SYSTEM_JAVA_MEDIA_CLASSPATH = $(JMF_HOME)/lib/jmf.jar SYSTEM_JAVA_MEDIA_LIBRARY = $(JMF_HOME)/lib else SYSTEM_JAVA_MEDIA_CLASSPATH = SYSTEM_JAVA_MEDIA_LIBRARY = endif ifndef JAVA_INCLUDES JAVA_INCLUDES = -I$(JAVA_HOME)/include $(JAVA_SYSTEM_INCLUDES) endif ifndef JAVAC JAVAC = javac endif ifndef JAVA JAVA = java endif ifndef DEBUG_JAVAC DEBUG_JAVAC = $(JAVAC) endif ifndef JAVAH JAVAH = javah -jni endif ifndef DEBUG_JAVAH DEBUG_JAVAH = $(JAVAH) endif ifndef JAR JAR = jar cf0v endif speech_tools/config/compilers/jikes_defaults.mak0000644000076400007640000000571610667555404020636 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Common definitions for Jikes versions ## ## ## ########################################################################### ifndef JAVAC JAVAC = jikes endif include $(EST)/config/compilers/jdk_defaults.mak speech_tools/config/rules/Makefile0000644000076400007640000000621607262605664015742 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### DIRNAME=config/rules TOP=../.. RULESETS = compile_options.mak defaults.mak library.mak make_depend.mak \ rcs.mak rules.mak targets.mak modules.mak \ config_errors.mak visual_c.mak c.mak java.mak \ bin_process.mak install.mak top_level.mak doc.mak \ common_make_rules.mak test_make_rules.mak cvs.mak \ build_dir.mak SCRIPTS = script_process.awk make_depend.awk modules.sh build_tree.sh FILES = Makefile $(SCRIPTS) $(RULESETS) include $(TOP)/config/common_make_rules speech_tools/config/rules/script_process.awk0000644000076400007640000000231111332265736020033 0ustar awbawb/^#__SHARED_SETUP__/ { if (shared != "" ) { system("cat " sharedsetup); } else { print "# NOT SHARED"; } next; } /__TOP__/ { sub(/__TOP__/, topdir); } /__PROGRAM__/ { sub(/__PROGRAM__/, scriptname); } /__PROJECT__/ { sub(/__PROJECT__/, project); } /__VERSION__/ { sub(/__VERSION__/, version); } /__SYSTEM__/ { sub(/__SYSTEM__/, systemtype); } /__EST__/ { sub(/__EST__/, est); } /__MAIN__/ { sub(/__MAIN__/, main); } /__LIB__/ { sub(/__LIB__/, lib); } /__PERL__/ { sub(/__PERL__/, perl); } /__CLASSPATH__/ { sub(/__CLASSPATH__/, classpath); } /__JAVA__/ { sub(/__JAVA__/, java); } /__JAVAC__/ { sub(/__JAVAC__/, javac); } /__JAVA_VERSION__/ { sub(/__JAVA_VERSION__/, java_version); } /__JAVA_HOME__/ { sub(/__JAVA_HOME__/, javahome); } /__LDPATH__/ { sub(/__LDPATH__/, ldpath); } /__LDVAR__/ { sub(/__LDVAR__/, ldvar); } /__LIBS__/ { sub(/__LIBS__/, libs); } /__INCLUDES__/ { sub(/__INCLUDES__/, includes); } /__DEFINES__/ { sub(/__DEFINES__/, defines); } /__LINK_COMMAND__/ { sub(/__LINK_COMMAND__/, linkcommand); } /__CXX_COMMAND__/ { sub(/__CXX_COMMAND__/, cxxcommand); } /__CC_COMMAND__/ { sub(/__CC_COMMAND__/, cccommand); } {print} speech_tools/config/rules/make_depend.awk0000644000076400007640000000037107262605664017236 0ustar awbawbBEGIN {s=0} s==0 && $1=="#" && $2==name {s=1;next} s==1 && NF==0 {s=2; next} s==2 && NF==0 {s=3; next} (s==0 || s==3) && NF==1 && $1=="NEW" { printf("\n# %s %s\n\n", name, date); s=4; next; } s==0 || s==3 || s==4 {print} speech_tools/config/rules/modules.sh0000644000076400007640000001264110065562643016277 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Look for module definitions. ## ## ## ########################################################################### if [ -f $TOP/config/modules/descriptions ] then . $TOP/config/modules/descriptions fi if [ -z "$MODULE_DIRECTORY" ] then MODULE_DIRECTORY="$TOP/" fi MOD_DIR_TRIMMED=`expr "$MODULE_DIRECTORY" : "$TOP/\(.*\)$"` if [ -z "$MOD_DIR_TRIMMED" ] then MOD_DIR_TRIMMED="." fi echo ' ###########################################################################' echo ' ## This file is created automatically from your config file.' echo ' ## Do not hand edit.' echo ' ## Created:'`date` echo ' ###########################################################################' echo '' for M in $* do echo " $M" >&2 m=`echo "$M" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` fl=false eval "listed_desc=\"\$desc_$m\"" if [ -n "$listed_desc" ] then echo "MOD_DESC_${M}=$listed_desc" echo "INCLUDE_${M}=1" if [ -d "$MODULE_DIRECTORY/$M" ] then echo "ifeq (\$(DIRNAME),$MOD_DIR_TRIMMED)" echo ' EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) ' $M echo "endif" f="$MODULE_DIRECTORY/$M" elif [ -d "$MODULE_DIRECTORY/$m" ] then echo "ifeq (\$(DIRNAME),$MOD_DIR_TRIMMED)" echo ' EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) ' $m echo "endif" f="$MODULE_DIRECTORY/$m" else f="ok" fi fl=true fi $fl || for f in $TOP/config/modules/$M.mak \ $TOP/config/modules/$m.mak \ $MODULE_DIRECTORY/$M/$M.mak \ $MODULE_DIRECTORY/$M/$m.mak \ $MODULE_DIRECTORY/$m/$M.mak \ $MODULE_DIRECTORY/$m/$m.mak do if [ -f "$f" ] then f1=`expr "$f" : "$TOP/\(.*\)$"` echo "include \$(TOP)/$f1" fl=true f=$f1 break fi done $fl || for f in \ `find $MODULE_DIRECTORY \( -name CVS -prune \) -o \( -name "$M.mak" -o -name "$m.mak" \) -print -follow` do if [ -f "$f" ] then f1=`expr "$f" : "$TOP/\(.*\)$"` echo "include \$(TOP)/$f1" fl=true f=$f1 break fi done $fl || for n in $M $m do if [ -d "$MODULE_DIRECTORY/$n" ] then [ -n "$listed_desc" ] || { echo "MOD_DESC_${M}=Unknown Module" echo "INCLUDE_${M}=1" } echo "ifeq (\$(DIRNAME),$MOD_DIR_TRIMMED)" echo ' EXTRA_LIB_BUILD_DIRS := $(EXTRA_LIB_BUILD_DIRS) ' $n echo "endif" fl=true f="unknown module in $MOD_DIR_TRIMMED/$n" break; fi done if $fl then echo " $f" >&2 else echo " NOT FOUND" >&2 echo "MOD_DESC_${M}='!! MISSING MODULE !!'" echo "ifndef MADE_FROM_ABOVE" echo "ifneq (\$(shell echo No definition for module $m >&2),xxx)" echo "foo:bar"; echo "endif" echo endif fi done speech_tools/config/rules/build_tree.sh0000755000076400007640000000712007262605664016752 0ustar awbawb#!/bin/sh ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Create a build tree shadowing a number of source trees. ## ## ## ########################################################################### rm=/bin/rm new=false if [ "$1" = "-new" ] then new=true shift fi build=${1:?'Build Tree Name Needed'} shift build_below() { ( root=$1 build=$2 source=$3 [ -d $build ] || mkdir $build for s in $source/* do n=`basename $s` case "$n" in *~ ) : ;; #* ) : ;; make.* ) : ;; CVS ) : ;; * ) if [ -f $s ] then if [ -h $build/$n ] then $new && [ $n != Makefile ] && echo "$s used" $rm $build/$n fi ln -s $root/$s $build/$n elif [ -d $s ] then build_below ../$root $build/$n $source/$n fi;; esac done ) } $new && $rm -rf "$build" [ -d $build ] || new=true root=.. for source in "$@" do build_below $root "$build" "$source" done exit 0; speech_tools/config/rules/compile_options.mak0000644000076400007640000001342607262616577020205 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## ## ## Extend the compiler options depending on the behaviour requested. ## ## ## ########################################################################### ########################################################################### ## Look for directory specific options DIRNAME_AS_FILE := $(subst /,_,$(DIRNAME)) ifneq ($(origin OPTIMISE_$(DIRNAME_AS_FILE)),undefined) OPTIMISE := $(OPTIMISE_$(DIRNAME_AS_FILE)) endif ifneq ($(origin WARN_$(DIRNAME_AS_FILE)),undefined) WARN := $(WARN_$(DIRNAME_AS_FILE)) endif ifneq ($(origin VERBOSE_$(DIRNAME_AS_FILE)),undefined) VERBOSE := $(VERBOSE_$(DIRNAME_AS_FILE)) endif ifneq ($(origin DEBUG_$(DIRNAME_AS_FILE)),undefined) DEBUG := $(DEBUG_$(DIRNAME_AS_FILE)) endif ifneq ($(origin PROFILE_$(DIRNAME_AS_FILE)),undefined) PROFILE := $(PROFILE_$(DIRNAME_AS_FILE)) endif ifneq ($(origin SHARED_$(DIRNAME_AS_FILE)),undefined) SHARED := $(SHARED_$(DIRNAME_AS_FILE)) endif ifneq ($(origin STATIC_$(DIRNAME_AS_FILE)),undefined) STATIC := $(STATIC_$(DIRNAME_AS_FILE)) endif ########################################################################### ## Normalise ifndef WARN WARN = 0 endif ifndef DEBUG DEBUG = 0 endif ifndef PROFILE PROFILE = 0 endif ifndef OPTIMISE OPTIMISE = 0 endif ifndef SHARED SHARED = 0 endif ifndef STATIC STATIC = 0 endif ifndef VERBOSE VERBOSE = 0 endif ########################################################################### ## Now set the compile options as requested ifneq ($(DEBUG),0) ifneq ($(OPTIMISE),4) CFLAGS += $(DEBUG_CCFLAGS) CXXFLAGS += $(DEBUG_CXXFLAGS) JAVAFLAGS += $(DEBUG_JAVAFLAGS) JAVAC := $(DEBUG_JAVAC) JAVAH := $(DEBUG_JAVAH) LINKFLAGS += $(DEBUG_LINKFLAGS) endif endif ifneq ($(PROFILE),0) ifndef PROFILE_$(PROFILE)_CCFLAGS PROFILE := $(PROFILE_DEFAULT) endif CFLAGS += $(PROFILE_$(PROFILE)_CCFLAGS) CXXFLAGS += $(PROFILE_$(PROFILE)_CXXFLAGS) LINKFLAGS += $(PROFILE_$(PROFILE)_LINKFLAGS) endif ifneq ($(OPTIMISE),0) CFLAGS += $(OPTIMISE_CCFLAGS) CXXFLAGS += $(OPTIMISE_CXXFLAGS) JAVAFLAGS += $(OPTIMISE_JAVAFLAGS) LINKFLAGS += $(OPTIMISE_LINKFLAGS) endif ifneq ($(SHARED),0) CFLAGS += $(SHARED_CCFLAGS) CXXFLAGS += $(SHARED_CXXFLAGS) LINKFLAGS += $(SHARED_LINKFLAGS) CXXDLFLAGS = else CXXDLFLAGS += $(SHARED_CXXFLAGS) endif ifneq ($(WARN),0) CFLAGS += $(WARN_CCFLAGS) CXXFLAGS += $(WARN_CXXFLAGS) JAVAFLAGS += $(WARN_JAVAFLAGS) LINKFLAGS += $(WARN_LINKFLAGS) else CFLAGS += $(NOWARN_CCFLAGS) CXXFLAGS += $(NOWARN_CXXFLAGS) JAVAFLAGS += $(NOWARN_JAVAFLAGS) LINKFLAGS += $(NOWARN_LINKFLAGS) endif ifneq ($(VERBOSE),0) CFLAGS += $(VERBOSE_CCFLAGS) CXXFLAGS += $(VERBOSE_CXXFLAGS) JAVAFLAGS += $(VERBOSE_JAVAFLAGS) LINKFLAGS += $(VERBOSE_LINKFLAGS) endif ifneq ($(STATIC),0) CFLAGS += $(STATIC_CCFLAGS) CXXFLAGS += $(STATIC_CXXFLAGS) LINKFLAGS += $(STATIC_LINKFLAGS) endif speech_tools/config/rules/defaults.mak0000644000076400007640000001642507262605664016606 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Default values for the things which system, compiler and local ## ## configurations can reset. ## ## ## ########################################################################### ########################################################################### ## Some things we often want to do ifndef ENSURE_EMPTY_DIR ENSURE_EMPTY_DIR=if [ ! -d 'DIR' ] ; then mkdir 'DIR' ; else $(RM) -rf 'DIR'/* ; fi endif ifndef ENSURE_DIR ENSURE_DIR=if [ ! -d 'DIR' ] ; then mkdir 'DIR' ; fi endif ########################################################################### ## default names for make related files ifndef DEPEND DEPEND=make.depend endif ifndef MAKE_INCLUDE MAKE_INCLUDE=make.include endif ifndef INLIB INLIB = $(MAIN_LIBRARY) endif ifdef N MADE_FROM_ABOVE:=$(N) endif ifndef PROJECT_LIBDEPS PROJECT_LIBDEPS = $(foreach l,$(PROJECT_LIBRARIES),$(PROJECT_LIBRARY_DIR_$(l))/lib$(l).a) endif ifndef PROJECT_LIBS PROJECT_LIBS = $(foreach l,$(PROJECT_LIBRARIES),-L$(PROJECT_LIBRARY_DIR_$(l)) -l$(l)) endif ifndef REQUIRED_LIBDEPS REQUIRED_LIBDEPS = $(foreach l,$(REQUIRED_LIBRARIES),$(REQUIRED_LIBRARY_DIR_$(l))/lib$(l).a) endif ifndef REQUIRED_LIBS REQUIRED_LIBS = $(foreach l,$(REQUIRED_LIBRARIES),-L$(REQUIRED_LIBRARY_DIR_$(l)) -l$(l)) endif ifndef LIBRARIES LIBRARIES = $(PROJECT_LIBRARIES) $(LOCAL_LIBRARIES) endif ifndef LIBDEPS LIBDEPS = $(PROJECT_LIBDEPS) $(REQUIRED_LIBDEPS) $(LOCAL_LIBDEPS) endif ifndef LOCAL_DEFAULT_LIBRARY LOCAL_DEFAULT_LIBRARY = $(PROJECT_DEFAULT_LIBRARY) endif ## if not set the main lirary gets all object files ifndef OBJS_$(LOCAL_DEFAULT_LIBRARY) OBJS_$(LOCAL_DEFAULT_LIBRARY) := $(OBJS) endif ## If we haven't given an explicit list, gather together all ## the object files ifndef OBJS OBJS := $(foreach lib,$(LIBRARIES),$(OBJS_$(lib))) endif ########################################################################### ## Collections of arguments ## All the defines for a normal file to be compiled ifndef DEFINES DEFINES = $(CONFIG_DEFINES) $(DEBUG_DEFINES) $(LOCAL_DEFINES) $(MODULE_DEFINES) $(PROJECT_DEFINES) $(OS_DEFINES) endif ## All the includes for a normal file to be compiled ifndef INCLUDES INCLUDES = $(CONFIG_INCLUDES) $(LOCAL_INCLUDES) $(MODULE_INCLUDES) $(PROJECT_INCLUDES) $(OS_INCLUDES) endif ## Places to look for templates. # ifndef TEMPLATE_DIRS TEMPLATE_DIRS = $(CONFIG_TEMPLATE_DIRS) $(LOCAL_TEMPLATE_DIRS) $(MODULE_TEMPLATE_DIRS) $(PROJECT_TEMPLATE_DIRS:%=$(TOP)/%) $(foreach library,$(REQUIRED_LIBRARIES),$(LIBRARY_TEMPLATE_DIRS_$(library))) $(OS_TEMPLATE_DIRS) # endif ifndef TEMPLATES TEMPLATES= $(CONFIG_TEMPLATES) $(LOCAL_TEMPLATES) $(TEMPLATE_ARGS) endif ifndef DEPEND_FLAGS DEPEND_FLAGS=$(DEFINES) endif ## Libraries to link a major program of this project ifndef MATH_LIBRARY MATH_LIBRARY= -lm endif ifndef LIBS LIBS = $(CONFIG_LIBS) $(LOCAL_LIBS) $(PROJECT_LIBS) $(REQUIRED_LIBS) $(MODULE_LIBS) $(MODULE_EXTRA_LIBS) $(DEBUG_LIBS) $(OS_LIBS) $(MATH_LIBRARY) $(COMPILERLIBS) endif ## Libraries to link utility programs -- doesn't use this project's libraries ifndef NON_PROJECT_LIBS NON_PROJECT_LIBS = $(CONFIG_LIBS) $(LOCAL_LIBS) $(REQUIRED_LIBS) \ $(SYSTEM_LD_LIBRARY_PATH:%=-L%) \ $(MODULE_LIBS) $(MODULE_EXTRA_LIBS) $(DEBUG_LIBS) $(OS_LIBS) $(MATH_LIBRARY) $(COMPILERLIBS) # reduced list for linking with java code. JAVA_PROJECT_LIBS = $(CONFIG_LIBS) $(LOCAL_LIBS) $(REQUIRED_LIBS) \ $(SYSTEM_LD_LIBRARY_PATH:%=-L%) \ $(MODULE_LIBS) $(DEBUG_LIBS) $(OS_LIBS) $(MATH_LIBRARY) $(COMPILERLIBS) endif ## Default C Compilation ifndef CC_COMMAND CC_COMMAND = $(CC) -c $(CFLAGS) $(COMPILE_CCFLAGS) $(DEFINES) $(INCLUDES) endif ## Default C++ Compilation ifndef CXX_COMMAND CXX_COMMAND = $(CXX) -c $(CXXFLAGS) $(COMPILE_CXXFLAGS) $(DEFINES) $(INCLUDES) $(TEMPLATES) endif ## C++ for dynamic loading ifndef CXX_COMMAND_DL CXX_COMMAND_DL = $(CXX) -c $(CXXFLAGS) $(CXXDLFLAGS) $(COMPILE_CXXFLAGS) $(DEFINES) $(INCLUDES) $(TEMPLATES) endif ifndef CXX_COMMAND_NOOPT ifdef HONOUR_NOOPT CXX_COMMAND_NOOPT = $(subst $(OPTIMISE_CXXFLAGS),,$(CXX) -c $(CXXFLAGS) $(COMPILE_CXXFLAGS) $(DEFINES) $(INCLUDES) $(TEMPLATES)) else CXX_COMMAND_NOOPT = $(CXX_COMMAND) endif endif ## C++ with template instantiations ifndef CXX_COMMAND_TEMPLATES CXX_COMMAND_TEMPLATES = $(CXX_COMMAND) $(TEMPLATE_SPECIFIC) endif ## Link a program (not including libraries) ifndef LINK_COMMAND LINK_COMMAND = $(CXX) $(LINKFLAGS) $(TEMPLATES) endif speech_tools/config/rules/library.mak0000644000076400007640000001577007262605664016445 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Library maintenance rules. ## ## ## ########################################################################### ########################################################################### ## ## ## Rules for the lib directory itself ## ## ## ########################################################################### # if we are in that directory, make sure it's up to date ifndef MADE_FROM_ABOVE .libraries: make_library # .build_shared : make_library endif # if we requested a shared library, build it ifdef SHARED ifneq ($(SHARED),0) ifndef MAKE_SHARED_LIB .config_error:: FORCE @echo "+-----------------------------------------------------" @echo "| Can't make shared libraries for compiler $(COMPILER) @echo "+-----------------------------------------------------" @exit 1 endif ifeq ($(SHARED),2) PROJECT_SHARED_LIBRARIES:=$(PROJECT_ALL_LIBRARIES) endif .libraries: .build_shared .build_shared : $(PROJECT_SHARED_LIBRARIES:%=lib%.so) endif endif .libraries: @$(DO_NOTHING) # Make the libraries make_library: @ $(MAKE) --no-print-directory -C $(TOP) JUST_LIB=YES ########################################################################### ## ## ## If we are in a sub directory which explicitly says something ## ## depends on the library, check it is OK. ## ## ## ########################################################################### ifndef MADE_FROM_ABOVE $(PROJECT_LIBRARY_DIR_$(PROJECT_DEFAULT_LIBRARY))/lib$(PROJECT_DEFAULT_LIBRARY).a : FORCE @ echo remake libraries $@ @ $(MAKE) --no-print-directory -C $(TOP) JUST_LIB=YES endif ########################################################################### ## ## ## Shared library rule. Expand the normal library and link the ## ## bits together. ## ## ## ########################################################################### lib%.so : lib%.a @echo Make Shared Library $* @if [ ! -d shared_space ] ; then mkdir shared_space ; else $(RM) -f shared_space/*.o ; fi @(cd shared_space ; $(AR) x ../$< ) @echo Link Shared Library $* if [ -n "$(PROJECT_LIBRARY_NEEDS_SYSLIBS_$*)" ] ; then libs='$(JAVA_PROJECT_LIBS)' ; fi ;\ $(subst XXX,$@.$(PROJECT_LIBRARY_VERSION_$*),$(MAKE_SHARED_LIB)) shared_space/*.o $(PROJECT_LIBRARY_USES_$*:%=-L. -l%) $$libs @$(RM) -f shared_space/*.o $@ @ln -s $@.$(PROJECT_LIBRARY_VERSION_$*) $@ ########################################################################### ## ## ## Rules for normal source directories. ## ## ## ########################################################################### .PHONY:: .buildlib .buildlibs ## synonym .buildlib: .buildlibs ## update libraries .buildlibs: $(foreach lib,$(LIBRARIES),.buildlib_$(lib)) .buildlib_% : $(OBJS) @echo look at library $* $(OBJS_$*); @if [ -n '$(OBJS_$*)' ] ; then \ echo Update library $* $(OBJS_$*);\ $(BUILD_LIB) $(PROJECT_LIBRARY_DIR_$*)/lib$*.a $(OBJS_$*) ;\ $(INDEX_LIB) $(PROJECT_LIBRARY_DIR_$*)/lib$*.a ;\ fi @$(RM) -f .buildlib_$*; touch .buildlib_$* .copy_libs: FORCE @$(ECHO_N) "Install static libraries '$(PROJECT_LIBRARIES)':" @for l in $(PROJECT_LIBRARIES:%=lib%.a) ;\ do \ $(ECHO_N) " $$l" ;\ cp $$l $(LIB)/ ;\ $(INDEX_LIB) $(LIB)/$$l ;\ done @echo @echo ifdef SHARED ifneq (,$(PROJECT_SHARED_LIBRARIES)) @$(ECHO_N) "Install shared libraries '$(PROJECT_SHARED_LIBRARIES)':" @for l in $(PROJECT_SHARED_LIBRARIES:%=lib%.so) ;\ do \ $(ECHO_N) " $$l" ;\ cp $$l.* $(LIB)/ ;\ $(RM) -f $(LIB)/$$l ;\ ln -s $$l.* $(LIB)/$$l ;\ done @echo @echo endif endif speech_tools/config/rules/make_depend.mak0000644000076400007640000001025710006570362017212 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Rules to make the dependency lists for a directory. ## ## ## ########################################################################### ifndef ALL_DEPEND ALL_DEPEND = $(SRCS) $(CPPSRCS) $(CSRCS) $(JAVA_CLASSES:%=%.java) endif $(DEPEND): $(ALL_DEPEND) @if [ ! -f "$(DEPEND)" ] ;\ then \ { \ echo ' ######################################################################' ;\ echo ' # ' ;\ echo ' # Dependencies created for inclusion in $(DIRNAME)/Makefile.' ;\ echo " # `date`" ;\ echo ' # ' ;\ echo ' ######################################################################' ;\ echo '' ;\ } > $(DEPEND) ;\ fi ifneq ($(ALL_DEPEND),) @$(ECHO_N) "making dependencies -- " @chmod +w $(DEPEND) @date=`date` ;\ for i in $? ;\ do \ $(ECHO_N) "$$i " ;\ basename=`expr "$$i" : '\(.*\)\..*'` ;\ ext=`expr "$$i" : '.*\.\(.*\)'` ;\ { \ case "$$ext" in \ c) $(MAKE_DEPEND_C) $(DEPEND_FLAGS) "$$i";;\ cc) $(MAKE_DEPEND_CXX) $(DEPEND_FLAGS) "$$i";;\ java) echo "$$basename.class : $$basename.java";;\ *) echo "# Can't make depend for extension $$ext";;\ esac ;\ }|\ $(AWK) -f $(EST)/config/rules/make_depend.awk \ name="$$i" \ basename="$$basename" \ ext="$$ext" \ date="$$date" \ $(DEPEND) - > '#xxxx';\ mv '#xxxx' $(DEPEND);\ done @echo endif @chmod +w $(DEPEND) @echo 'INCLUDED_MAKE_DEPEND=1' >> $(DEPEND) @chmod -w $(DEPEND) speech_tools/config/rules/rcs.mak0000644000076400007640000001214007262605664015554 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Make rules dealing with RCS. ## ## ## ########################################################################### # Pass down an argument which says who we are LOCKED_FILTER=-l$(USER),$(LOGNAME) ifndef CI_ARGS CI_ARGS=-u endif ifdef LOCAL_REPOSITORY MAKE_RCSED_DIR = ( cd XXX ; ln -s $(CENTRAL_DIR)/$(DIRNAME)/XXX/RCS ; co Makefile ) else MAKE_RCSED_DIR = mkdir XXX/RCS endif # make sure we have the latest of everything update: @ echo "Updating in directory $(DIRNAME) ..." @if $(GNUTEST) RCS/Makefile,v -nt Makefile ; then \ co Makefile ;\ $(MAKE) update ;\ else \ for i in $(FILES) ; \ do \ $(GNUTEST) -f "$$i" -a "$$i" -nt "RCS/$$i,v" || co "$$i" ;\ done ;\ fi ifdef ALL_DIRS @for i in $(ALL_DIRS) ; \ do \ if [ ! -f $$i/Makefile ] ;\ then \ echo "Makeing new directory $(DIRNAME)/$$i" ;\ mkdir $$i ;\ $(subst XXX,$$i,$(MAKE_RCSED_DIR)) ;\ fi ;\ $(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $$i update ; \ done endif new_update: @$(MAKE) --no-print-directory INCLUDE_RCS_DEPEND=1 MADE_FROM_ABOVE=1 -k do_new_update ifdef INCLUDE_RCS_DEPEND do_new_update: do_new_update_message $(FILES) FORCE @$(DO_NOTHING) ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory INCLUDE_RCS_DEPEND=1 -C $$i do_new_update ; \ done endif do_new_update_message: FORCE @ echo "Updating in directory $(DIRNAME) ..." $(FILES) : % : RCS/%,v co $< endif # check in writable files checkin: @ echo "Checking in directory $(DIRNAME) ..." @for i in $(FILES) ; \ do \ if $(TEST) -w $$i ; then \ ci $(CI_ARGS) $$i; \ fi; \ done ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i checkin ; \ done endif # Look for locked files locked: @locked=`rlog -L -R $(LOCKED_FILTER) $(FILES)` ;\ if $(TEST) -n "$$locked" ; then \ echo "Locked in directory $(DIRNAME) ..."; \ for i in $$locked ; \ do \ rlog -h $$i | awk '$$1 == "Working" {f=$$3} $$1=="locks:" {n=1;next} n==1 {w=$$1;n=0} END {print w "\t" f}' - ;\ done ;\ else \ echo "Nothing in $(DIRNAME) ..." ;\ fi ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i locked ; \ done endif # look for locked by anyone all_locked: @$(MAKE) --no-print-directory LOCKED_FILTER= locked speech_tools/config/rules/rules.mak0000644000076400007640000000643607262605664016132 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Pattern rules for compileing various kinds of thing. ## ## ## ########################################################################### ## NOTE: The $(strip ...) is just to crush out excess spaces to ## keep the commands printed out readable. # Things which instantiate templates $(TSRCS:.cc=.o) dummy_template_target.o : %.o : %.cc $(strip $(CXX_COMMAND_TEMPLATES) $< ) # Normal C++ files %.o : %.cc $(strip $(CXX_COMMAND) $< ) # C files %.o : %.c $(strip $(CC_COMMAND) $< ) speech_tools/config/rules/targets.mak0000644000076400007640000001543111223435650016430 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Main make targets. ## ## ## ########################################################################### ########################################################################### ## utility targets nothing: @$(DO_NOTHING) FORCE: ########################################################################### ## Main make rule for building .sub_directories: $(SUBDIRECTORIES) ${SUBDIRECTORIES} dummy_dir_name: FORCE @if [ ! -f $@/Makefile ] ;\ then \ echo "Makeing new directory $(DIRNAME)/$@" ;\ mkdir $@ ;\ : $(subst XXX,$@,$(MAKE_RCSED_DIR)) ;\ $(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $@ update ; \ fi @ echo "Making in directory $(DIRNAME)/$@ ..." @ ${MAKE} --no-print-directory -C $@ MADE_FROM_ABOVE=yes ########################################################################### ## Clean up junk clean: $(RM) -fr $(OBJS) $(JAVA_CLASSES_CLASS) $(ALL_EXECS) $(ALL_EXECS:%=%.mak) $(ALL_LIBS) $(LOCAL_CLEAN) make.depend .buildlib* *~ ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ echo "clean in $(DIRNAME)/$$i" ;\ $(MAKE) --no-print-directory -C $$i clean ; \ done endif ifdef EXTRA_LIB_BUILD_DIRS @ for i in $(EXTRA_LIB_BUILD_DIRS) ; \ do \ echo "clean in $(DIRNAME)/$$i" ;\ $(MAKE) --no-print-directory -C $$i clean ; \ done endif ########################################################################### ## strip executables strip: FORCE @echo "strip in $(DIRNAME)" ifdef ALL_EXECS @ for i in $(ALL_EXECS) ; \ do \ $(STRIP) $$i ; \ done else @ echo > /dev/null endif ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i strip ; \ done endif ########################################################################### ## Force remake of dependencies ifndef DEPEND_DIRS DEPEND_DIRS:=$(ALL_DIRS) endif depend: FORCE @echo "depend in $(DIRNAME)" @ $(RM) -f $(DEPEND) @ # a little hack to get it to remake make.depend @ $(MAKE) --no-print-directory nothing ifeq ($(DEPEND_DIRS),) else @ for i in $(DEPEND_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i depend ; \ done endif ########################################################################### ## make a list of all files file-list : FORCE ifndef MADE_FROM_ABOVE @$(RM) -f FileList endif ifdef FILES @for i in $(FILES) ; \ do \ echo $(DIRNAME)/$$i ; \ done >>$(TOP)/FileList endif ifdef ALL_DIRS @for i in $(ALL_DIRS) ; \ do \ echo "file-list in $(DIRNAME)/$$i" ;\ $(MAKE) --no-print-directory -C $$i MADE_FROM_ABOVE=1 NO_DEPEND=1 file-list ; \ done endif FileList: file-list ########################################################################### ## list things which doc++ should process doc++files : FORCE @echo "doc++files in $(DIRNAME)" ifdef H @for i in $(H) ; \ do \ echo $(DIRNAME)/$$i ; \ done >>$(TOP)/Doc++Files endif ifdef DOCXX_FILES @for i in $(DOCXX_FILES) ; \ do \ echo $(DIRNAME)/$$i ; \ done >>$(TOP)/Doc++Files endif ifdef ALL_DIRS @for i in $(ALL_DIRS) ; \ do \ $(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $$i doc++files ; \ done endif ########################################################################### ## Instalation rules install_all: $(INSTALL) nothing ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i install_all ; \ done endif ########################################################################### ## Target for directories which should never be entered on a normal build. not_a_build_dir: FORCE @echo "+--------------------------------------------------" @echo "| This is not a build directory @echo "| plain make should never be run here @echo "+--------------------------------------------------" @exit 1 ########################################################################### ## make info info: ifeq ($(TOP),.) @$(RM) -f $(TOP)/config/modincludes* $(TOP)/config/system.mak @$(MAKE) -C $(TOP) --no-print-directory real-info .config_error else @$(MAKE) -C $(TOP) --no-print-directory info endif speech_tools/config/rules/modules.mak0000644000076400007640000001332007262605664016436 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Amend the compilation options to reflect the selected modules. ## ## ## ########################################################################### ########################################################################### ## Override the usual module selection, used for testing. ifneq ($(INCLUDE_EVERYTHING),) ifeq ($(INCLUDE_EVERYTHING),ALL) INCLUDE_MODULES = $(ALL_MODULES) MODINCLUDES_DEPEND = config $(PROJECT_OTHER_CONFIGS) MODINCLUDES_FILE = modincludes_absolutely_everything.inc else INCLUDE_MODULES += $(ALL_REAL_MODULES) MODINCLUDES_DEPEND = config $(PROJECT_OTHER_CONFIGS) MODINCLUDES_FILE = modincludes_everything.inc endif else MODINCLUDES_DEPEND = config $(PROJECT_OTHER_CONFIGS) MODINCLUDES_FILE = modincludes.inc endif ########################################################################### ## The extra command line flags are divided into bunches so they can be ## used in just the necessary places. This is only for prettyness during ## compilation and the division is somewhat arbitrary. ## User interface things UI_DEFINES = UI_INCLUDES = ## Audio AUDIO_DEFINES = AUDIO_INCLUDES = ## To do with the core of festival FESTIVAL_DEFINES = FESTIVAL_INCLUDES = ## Stuff for the old diphone code. MODULE_DIPHONE_DEFINES = ## Anything else -- gets included everywhere. MODULE_DEFINES = MODULE_INCLUDES = ## These are the extra libraries needed because of all these modules. DEBUG_LIBS = MODULE_LIBS = INCLUDE_MODULES += $(ALSO_INCLUDE) ifneq ($(findstring NATIVE_AUDIO,$(INCLUDE_MODULES)),) ifdef NATIVE_AUDIO_MODULE INCLUDE_MODULES += $(NATIVE_AUDIO_MODULE)_AUDIO else .config_error:: FORCE @echo "+--------------------------------------------------" @echo "| No Native Audio method for this type of system." @echo "+--------------------------------------------------" @exit 1 endif endif ########################################################################### ## ## ## Abandon hope... This next bit is shell and make magic to deal with ## ## adding modules. ## ## ## ########################################################################### ifdef MODINCLUDES $(MODINCLUDES_FILE) : $(MODINCLUDES_DEPEND) @echo Remake $(MODINCLUDES_FILE) >&2 @TOP='$(TOP)' MODULE_DIRECTORY='$(MODULE_DIRECTORY)' \ /bin/sh $(EST)/config/rules/modules.sh $(INCLUDE_MODULES) > $@ else ifndef MADE_FROM_ABOVE modules_dummy: $(shell $(MAKE) --no-print-directory -C $(TOP)/config INCLUDE_EVERYTHING='$(INCLUDE_EVERYTHING)' MODINCLUDES=1 $(MODINCLUDES_FILE) >/dev/null ) $(EST)/config/$(MODINCLUDES_FILE) : $(MAKE) --no-print-directory -C $(TOP)/config MADE_FROM_ABOVE=1 MODINCLUDES=1 INCLUDE_EVERYTHING='$(INCLUDE_EVERYTHING)' $(MODINCLUDES_FILE) endif include $(TOP)/config/$(MODINCLUDES_FILE) endif speech_tools/config/rules/config_errors.mak0000644000076400007640000000646207262605664017640 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## ## ## Rules which check for the configuration choices the user has made ## ## being consistant with each other ## ## ## ########################################################################### ifdef NEED_JAVA ifndef INCLUDE_JAVA .config_error:: FORCE @echo "+------------------------------------------------------" @echo "| This system requires java support in the speech tools" @echo "+------------------------------------------------------" @exit 1 endif endif .config_error:: FORCE speech_tools/config/rules/visual_c.mak0000644000076400007640000001476207262605664016606 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Support for Visual C++ by creating makefiles. This can probably be ## ## modularised in some way. ## ## ## ########################################################################### vc_make.depend: make.depend @echo Creating vc_make.depend for $(DIRNAME) @sed -e '/\.o/s//.obj/g' -e 's/[ ]\/[^ ]*/ /g' -e 's/\//\\/g' make.depend > vc_make.depend ifdef VC_IGNORE VCMakefile: FORCE @echo "No VC++ Support For $(DIRNAME)" else VCMakefile: FORCE @echo Creating VCMakefile for $(DIRNAME) @{ \ echo ;\ echo '# Makefile for MicroCruft Visual C++' ;\ echo ;\ echo TOP=$(subst /,\\,$(TOP)) ;\ echo ;\ echo DIRNAME=$(subst /,\\,$(DIRNAME)) ;\ echo ;\ echo todo: default_target ;\ echo ;\ } > VCMakefile ifdef OBJS @{ \ echo OBJS = $(subst _unix,_win32,$(OBJS:%.o=%.obj));\ echo ;\ } >> VCMakefile endif ifdef AUX_OBJS @{ \ echo 'AUX_OBJS = $(subst /,\,$(subst .o,.obj,$(AUX_OBJS)))' ;\ echo ;\ } >> VCMakefile endif ifdef ABSTRACT_TYPES @{ \ echo 'ABSTRACT_TYPES=$(ABSTRACT_TYPES)' ;\ echo ;\ } >> VCMakefile endif ifdef BUILD_DIRS @{ \ echo DIRS = $(EXTRA_LIB_BUILD_DIRS) $(BUILD_DIRS);\ echo ;\ } >> VCMakefile endif ifdef LOCAL_INCLUDES @{ \ echo LOCAL_INCLUDES = $(subst -I,/I,$(subst /,\\,$(LOCAL_INCLUDES)));\ echo ;\ } >> VCMakefile endif ifdef WIN_CFLAGS @{ \ echo 'CFLAGS = $(WIN_CFLAGS)';\ echo ;\ } >> VCMakefile else @{ \ echo 'CFLAGS = $$(DEBUGFLAGS) $$(OPTFLAGS) $$(INCLUDEFLAGS) $(VC_LOCAL_DEFINES)' ;\ echo ;\ } >> VCMakefile endif ifdef LOCAL_DEFAULT_LIBRARY @echo 'INLIB = $(subst /,\,$(subst .a,.lib,$(TOP)/$$(LIB_DIR)/lib$(LOCAL_DEFAULT_LIBRARY).a))' >> VCMakefile else @echo 'INLIB = $$(TOP)\$$(LIB_DIR)\$(DEFAULT_LIBRARY).lib' >> VCMakefile endif ifdef VCLIBS @echo 'VCLIBS = $(subst /,\,$(subst .a,.lib,$(VCLIBS)))' >> VCMakefile endif ifdef TOADD @echo 'TOADD = $(subst /,\,$(subst .o,.obj,$(TOADD)))' >> VCMakefile endif ifdef ADDLIB @echo 'ADDLIB = $(subst /,\,$(subst .a,.lib,$(ADDLIB)))' >> VCMakefile endif ifdef ALL_EXECS @{ \ echo ;\ PROG_NAMES=`echo '$(ALL_EXECS)' | sed -e 's%[^ ]*/%%g'` ;\ echo PROGS = `echo "$$PROG_NAMES" | sed -e 's%\([^ ][^ ]*\)%\1.exe%g'` ;\ echo ;\ echo 'ALL = $$(PROGS)' ;\ } >> VCMakefile else ifdef DOCXXFILES @{ \ echo ;\ echo ALL = .process_docs;\ } >> VCMakefile else ifdef SCRIPTS @{ \ echo ;\ echo ALL = .process_scripts;\ } >> VCMakefile else @{ \ echo ;\ echo ALL =$(subst .o,.obj,$(subst .add_to_lib,.vc_add_to_lib, $(subst .buildlib,.vcbuildlib,$(ALL)))) ;\ } >> VCMakefile endif endif endif @{ \ echo '!include $$(TOP)\config\vc_common_make_rules';\ echo ;\ } >> VCMakefile ifeq (yes,$(shell test -f make.depend && echo yes)) @$(MAKE) --no-print-directory vc_make.depend @{ \ echo '!include vc_make.depend' ;\ echo ;\ } >> VCMakefile endif ifdef ALL_EXECS @{ \ PROG_NAMES=`echo '$(ALL_EXECS)' | sed -e 's%[^ ]*/%%g'` ;\ echo ;\ for ex in $$PROG_NAMES ; do \ if [ -f $${ex}_main.cc ] ;\ then \ echo "$${ex}.exe : $${ex}_main.obj \$$(AUX_OBJS) \$$(VCLIBS)" ;\ echo " link/nologo \$$(LINKFLAGS) /out:$${ex}.exe $${ex}_main.obj \$$(AUX_OBJS) \$$(VCLIBS) \$$(WINLIBS)" ;\ else \ echo "$${ex}.exe : $${ex}.obj \$$(AUX_OBJS) \$$(VCLIBS)" ;\ echo " link/nologo \$$(LINKFLAGS) /out:$${ex}.exe $${ex}.obj \$$(AUX_OBJS) \$$(VCLIBS) \$$(WINLIBS)" ;\ fi ;\ echo ;\ done ;\ echo ;\ } >> VCMakefile endif @if [ -f VCLocalRules ] ;\ then \ cat VCLocalRules >> VCMakefile;\ fi ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i VCMakefile ; \ done endif endif VCclean: @echo clean in $(DIRNAME) $(RM) -f *.obj *.exe *.lib ifdef ALL_DIRS @ for i in $(ALL_DIRS) ; \ do \ $(MAKE) --no-print-directory -C $$i VCclean ; \ done endif speech_tools/config/rules/c.mak0000644000076400007640000000703007532254625015206 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Pattern rules for compileing various kinds of thing. ## ## ## ########################################################################### ## NOTE: The $(strip ...) is just to crush out excess spaces to ## keep the commands printed out readable. # Things which instantiate templates $(TSRCS:.cc=.o) dummy_template_target.o : %.o : %.cc $(strip $(CXX_COMMAND_TEMPLATES) $< ) # Things which may be dynamically loaded $(DLSRCS:.cc=.o) dummy_dl_target.o : %.o : %.cc $(strip $(CXX_COMMAND_DL) $< ) # Things which may be dynamically loaded $(NOOPTSRCS:.cc=.o) dummy_no_target.o : %.o : %.cc $(strip $(CXX_COMMAND_NOOPT) $< ) # Normal C++ files %.o : %.cc $(strip $(CXX_COMMAND) $< ) # C files %.o : %.c $(strip $(CC_COMMAND) $< ) speech_tools/config/rules/java.mak0000644000076400007640000001057707262605664015722 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Fri Feb 27th 1998 ## ## -------------------------------------------------------------------- ## ## Rules for java. ## ## ## ########################################################################### ifndef JAVA_TOP JAVA_TOP = $(PROJECT_JAVA_ROOT) endif JAVA_PACKAGE = $(shell echo $(DIRNAME)| sed -e 's%.*/\($(JAVA_TOP_PACK)/.*\)%\1%' -e s%/%.%g) JAVA_CLASSES_CLASS = $(JAVA_CLASSES:%=%.class) JAVA_CLASSES_JAVA = $(JAVA_CLASSES:%=%.java) java_root.mak: FORCE @{ \ echo 'LOCAL_JAVA_CLASS_LIBRARY=$(TOP)/lib/$(JAVA_CODE_VERSION).jar' ;\ echo 'LOCAL_JAVA_CLASSPATH=$($(PROJECT_PREFIX)_HOME)/lib/$(JAVA_CODE_VERSION).jar' ;\ echo 'LOCAL_JAVA_ROOT=$(DIRNAME)' ;\ } > java_root.mak ifdef JAVA_NATIVE_CLASSES JAVA_CLASSES_O = $(JAVA_NATIVE_CLASSES:%=%.o) jni_%.h : %.class @$(RM) -f jni_$*.h $(JAVAH) -classpath '$(PROJECT_JAVA_ROOT):$(JAVA_CLASSPATH)' -o jni_$*.h $(JAVA_PACKAGE).$* INCLUDES += $(JAVA_INCLUDES) .java : $(JAVA_CLASSES_CLASS) $(JAVA_NATIVE_CLASSES:%=jni_%.h) else .java : $(JAVA_CLASSES_CLASS) endif .javalib: FORCE @if [ -f $(JAVA_TOP)/.java_updates ] ;\ then \ $(MAKE) .java_class_list ;\ echo Create Java Library $(JAVA_CLASS_LIBRARY) ;\ $(JAR) $(JAVA_CLASS_LIBRARY) `cat .java_class_list` ;\ $(RM) $(JAVA_TOP)/.java_updates ;\ fi .java_class_list: FORCE @echo Finding classes @find . -follow \( -name RCS -prune \) -o -name '*.class' -print | sed -e '/^\.\//s///' > .java_class_list ifndef JAVAC_COMMAND JAVAC_COMMAND = $(JAVAC) $(JAVAFLAGS) -classpath '$(PROJECT_JAVA_ROOT):$(JAVA_CLASSPATH)' endif %.class : %.java $(strip $(JAVAC_COMMAND) $*.java) @$(ECHO_N) $*.class >> $(JAVA_TOP)/.java_updates speech_tools/config/rules/bin_process.mak0000644000076400007640000001440011332265736017267 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Mar 4 1998 ## ## -------------------------------------------------------------------- ## ## Rules for creating the bin directory from scripts and main. ## ## ## ########################################################################### S=_static ifdef SHARED ifneq ($(SHARED),0) S = _shared endif endif ifndef LD_LIBRARY_PATH_VARIABLE LD_LIBRARY_PATH_VARIABLE = LD_LIBRARY_PATH endif .remove_links: FORCE @echo @$(ECHO_N) "Remove Links:" @for i in * ;\ do \ case "$$i" in \ Makefile ) : ;; \ VCLocalRules ) : ;; \ RCS|CVS ) : ;; \ * ) $(ECHO_N) " $$i"; $(RM) -f "$$i";; \ esac \ done @echo .copy_main: FORCE @echo @$(ECHO_N) "Install Executables:" @main=`pwd` ;\ for i in $(ALL_EXECS) ;\ do \ b=`basename "$$i"`;\ $(ECHO_N) " $$b";\ $(INSTALL_PROG) -s "$$main/$$i" "$(subst TOP,$(TOP),$(BIN))/$$b";\ done @echo .link_main: @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C '$(PROJECT_MAIN_DIR)' BIN=TOP/$(DIRNAME) LIBDIR=MAIN/TOP/$(PROJECT_LIBRARY_DIR) MAIN='$($(PROJECT_PREFIX)_HOME)' .link_main$(S) .link_main_static: FORCE @echo @$(ECHO_N) "Main Links:" @for i in $(ALL_EXECS) ;\ do \ b=`basename "$$i"`;\ $(ECHO_N) " $$b";\ ln -s "$(MAIN)/$(DIRNAME)/$$i" "$(subst TOP,$(TOP),$(BIN))/$$b";\ done @echo .link_main_shared: FORCE @echo @$(ECHO_N) "Main Scripts:" @for i in $(ALL_EXECS) ;\ do \ b=`basename "$$i"`;\ $(ECHO_N) " $$b"; \ $(NAWK) -f "$(EST)/config/rules/script_process.awk" \ scriptname="$$b" \ project="$(PROJECT_NAME)" \ version="$(PROJECT_VERSION)" \ systemtype="$(MACHINETYPE)_$(OSTYPE)$(OSREV)" \ topdir="$($(PROJECT_PREFIX)_HOME)" \ main="$(MAIN)/$(DIRNAME)" \ lib="$($(PROJECT_PREFIX)_HOME)/$(PROJECT_LIBRARY_DIR)" \ est="'$(EST_HOME)'" \ classpath="$(SYSTEM_JAVA_CLASSPATH)" \ perl="$(PERL)" \ javahome="$(JAVA_HOME)" \ java="$(JAVA)" \ javac="$(JAVAC)" \ java_version="$(EST_JAVA_VERSION)" \ ldpath="$(SYSTEM_LD_LIBRARY_PATH)" \ ldvar="$(LD_LIBRARY_PATH_VARIABLE)" \ $(PROJECT_SCRIPTS_DIR)/shared_script > "$(subst TOP,$(TOP),$(BIN))/$$b" ;\ chmod +x "$(subst TOP,$(TOP),$(BIN))/$$b" ;\ done @echo .process_scripts: @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C '$(PROJECT_SCRIPTS_DIR)' BIN=TOP/$(DIRNAME) BIN_TOP='$(TOP)' .process_scripts_real .process_scripts_real: FORCE @echo @$(ECHO_N) "Scripts:" @for ex in sh prl ;\ do \ $(ECHO_N) " ($$ex)" ;\ $(NAWK) -f "$(EST)/config/rules/script_process.awk" \ topdir="$($(PROJECT_PREFIX)_HOME)" \ est="$(EST_HOME)" \ ldpath="$(SYSTEM_LD_LIBRARY_PATH)" \ "$(PROJECT_SCRIPTS_DIR)"/shared_setup_$$ex > /tmp/$$$$.$$ex ;\ done ;\ for script in alwaysone $(SCRIPTS) ;\ do \ if [ $$script != alwaysone ] ;\ then \ ex=`expr "$$script" : '.*\.\([^.]*\)$$'` ;\ b=`basename "$$script" .$$ex`;\ $(ECHO_N) " $$b"; \ $(NAWK) -f "$(EST)/config/rules/script_process.awk" \ project="$(PROJECT_NAME)" \ version="$(PROJECT_VERSION)" \ systemtype="$(MACHINETYPE)_$(OSTYPE)$(OSREV)" \ shared="$(S)" \ sharedsetup="/tmp/$$$$.$$ex" \ ext="$$ex" \ scriptname="$$b" \ topdir="$($(PROJECT_PREFIX)_HOME)" \ est="'$(EST_HOME)'" \ perl="$(PERL)" \ javahome=$(JAVA_HOME) \ java_version="$(EST_JAVA_VERSION)" \ java=$(JAVA) \ javac=$(JAVAC) \ classpath=$(SYSTEM_JAVA_CLASSPATH) \ ldpath="$(SYSTEM_LD_LIBRARY_PATH)" \ ldvar="$(LD_LIBRARY_PATH_VARIABLE)" \ "$$script" > "$(subst TOP,$(TOP),$(BIN))/$$b" ;\ chmod +x "$(subst TOP,$(TOP),$(BIN))/$$b";\ fi ;\ done ;\ $(RM) -f /tmp/$$$$.* @echo speech_tools/config/rules/install.mak0000644000076400007640000001152107262605664016435 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Rules for installing a project. ## ## ## ########################################################################### PROJECT_HOME_PATH := $(shell mkdir -p $($(PROJECT_PREFIX)_HOME); cd $($(PROJECT_PREFIX)_HOME); pwd) PROJECT_TOP_PATH := $(shell (cd $(TOP); pwd)) S = _static ifdef SHARED ifneq ($(SHARED),0) S = _shared endif endif ifeq ($(PROJECT_HOME_PATH), $(PROJECT_TOP_PATH)) TO_INSTALL=make_bin else TO_INSTALL= \ make_installed_exec$(S) \ make_installed_bin$(S) \ make_installed_lib$(S) INSTALLED_LIB=$(shell (cd $($(PROJECT_PREFIX)_HOME); pwd))/lib INSTALLED_PRIVATE_LIB=$(INSTALLED_LIB)/$(shell echo $(PROJECT_PREFIX)| tr A-Z a-z) INSTALLED_BIN=$(shell (cd $($(PROJECT_PREFIX)_HOME); pwd))/bin endif install: $(TO_INSTALL) make_bin: @echo Making in bin @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(TOP)/bin make_installed_exec_static: @: nothing make_installed_exec_shared: ifdef PROJECT_MAIN_DIR mkdir -p $(INSTALLED_PRIVATE_LIB) $(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_MAIN_DIR) BIN=$(INSTALLED_PRIVATE_LIB) BIN_TOP=$(TOP) .copy_main else @: endif make_installed_bin_static: @mkdir -p $(INSTALLED_BIN) @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_SCRIPTS_DIR) BIN=$(INSTALLED_BIN) LIBDIR=$(INSTALLED_LIB) MAIN=$(INSTALLED_PRIVATE_LIB) .process_scripts_real @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_MAIN_DIR) BIN=$(INSTALLED_BIN) BIN_TOP=$(TOP) .copy_main make_installed_bin_shared: @mkdir -p $(INSTALLED_BIN) @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_SCRIPTS_DIR) BIN=$(INSTALLED_BIN) LIBDIR=$(INSTALLED_LIB) MAIN=$(INSTALLED_PRIVATE_LIB) .process_scripts_real ifdef PROJECT_MAIN_DIR @mkdir -p $(INSTALLED_BIN) @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_MAIN_DIR) BIN=$(INSTALLED_BIN) LIBDIR=$(INSTALLED_LIB) MAIN=$(INSTALLED_PRIVATE_LIB) .link_main$(S) else @: endif make_installed_lib_static: @: nothing make_installed_lib_shared: @mkdir -p $(INSTALLED_LIB) @$(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $(PROJECT_LIB_DIR) LIB=$(INSTALLED_LIB) .copy_libs speech_tools/config/rules/top_level.mak0000644000076400007640000001140207262605664016756 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### CENTER_COMMAND = $(AWK) '{n=(80-length($$0))/2; f=sprintf("%%%ds\n", n+length($$0)); printf(f, $$0);}' UNDERLINE_COMMAND = sed -e '{p;s/./=/g;}' INDENT_COMMAND = sed -e 's/^/ /' KV_COMMAND = $(AWK) 'NF>1 {printf("%" ind "s%s%s\n", $$1, sep, $$2==""?"":$$2);next;}{print}' real-info: @{ \ echo '---------------------------------------------------------------' ;\ echo '' ;\ echo '$(PROJECT_NAME) v$(PROJECT_VERSION) Configuration' | $(UNDERLINE_COMMAND) | $(CENTER_COMMAND);\ echo '' ;\ echo '$(PROJECT_PREFIX)_HOME:=:$($(PROJECT_PREFIX)_HOME)' ;\ if [ '$(PROJECT_PREFIX)' != EST ] ;\ then \ echo 'EST:=:$(EST)' ;\ echo 'EST_HOME:=:$(EST_HOME)' ;\ fi ;\ echo 'SYSTEM_TYPE:=:$(SYSTEM_TYPE)' ;\ echo 'COMPILER:=:$(COMPILER_DESC) '`$(COMPILER_VERSION_COMMAND)` ;\ if [ '$(JAVA_COMPILER)' != none ] ;\ then \ echo 'JAVA_COMPILER:=:$(JAVA_COMPILER_DESC) '`$(JAVA_COMPILER_VERSION_COMMAND)` ;\ echo 'JAVA_HOME:=:$(JAVA_HOME)' ;\ echo 'JMF_HOME:=:$(JMF_HOME)' ;\ echo 'JSAPI_HOME:=:$(JSAPI_HOME)' ;\ fi ;\ echo 'CONFIGURATION:=:$(CONFIGURATION)' ;\ if [ -n '$(LOCAL_REPOSITORY)' ] ;\ then \ echo '' ;\ echo 'CENTRAL_DIR:=:$(CENTRAL_DIR)' ;\ fi ;\ echo '' ;\ echo 'NATIVE_AUDIO_MODULE:=:$(NATIVE_AUDIO_MODULE)' ;\ if [ -n '$(INCLUDE_MODULES)' ] ;\ then \ echo 'INCLUDE_MODULES:=: ' ;\ { : ; $(foreach I,$(sort $(INCLUDE_MODULES)),echo '$(I):$(subst ',,$(MOD_DESC_$(I)))';) }| $(KV_COMMAND) FS=: sep=' ' ind=28 ;\ fi ;\ echo '' ;\ echo 'INCLUDES:=:$(INCLUDES)' ;\ echo 'TEMPLATES:=:$(TEMPLATES)' ;\ echo 'DEFINES:=:$(DEFINES)' ;\ echo 'LIBS:=:$(LIBS)' ;\ if [ '$(JAVA_COMPILER)' != none ] ;\ then \ echo 'JAVA_CLASSPATH:=:$(JAVA_CLASSPATH)' ;\ fi ;\ echo '' ;\ echo '---------------------------------------------------------------' ;\ } | $(KV_COMMAND) FS=':=:' sep=' = ' ind=22 ifndef REAL_MODULES modules: @$(MAKE) --no-print-dir REAL_MODULES=1 INCLUDE_EVERYTHING=ALL modules else modules: @{ \ echo '---------------------------------------------------------------' ;\ echo '' ;\ echo 'Available $(PROJECT_NAME) Modules'|$(UNDERLINE_COMMAND)|$(CENTER_COMMAND) ;\ echo '' ;\ { $(foreach I,$(sort $(ALL_MODULES)),echo '$(I):$(subst ',,$(MOD_DESC_$(I)))';) } |$(KV_COMMAND) FS=: sep=' ' ind=20 ;\ echo '' ;\ echo '---------------------------------------------------------------' ;\ } endif .config_error:: @: nothing speech_tools/config/rules/doc.mak0000644000076400007640000002723707262605664015547 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Rules for creating documentation. ## ## ## ########################################################################### MANUALS_GEN=manuals_gen EXAMPLES_GEN=examples_gen IMAGES_GEN=images_gen DOCXX_GEN=doc++ HTML_DIR=$(DOCNAME) ########################################################################### ## User Visable doc++ rule # This strange idiom is for expensive operations. something dependednt # on .doc++_made will make doc++ initially, but then not remake it. It # will notice if doc++ is remade. Something dependent on doc++ will # remake it every time. The manual pages and examples are also done # this way. .doc++file_list_made : @if [ ! -f .doc++file_list_made ] ; then $(MAKE) -C $(TOP)/doc --no-print-directory doc++file_list ; fi doc++file_list : FORCE @echo "Building doc++ files" @echo "empty $(TOP)/Doc++Files" @$(RM) -f $(TOP)/Doc++Files @$(ECHO_N) > $(TOP)/Doc++Files ifdef DOCXX_DIRS @for d in $(DOCXX_DIRS) ; do \ $(MAKE) -C $$d --no-print-directory doc++files ;\ done endif @date > .doc++file_list_made .doc++_made: @if [ ! -f .doc++_made ] ; then $(MAKE) -C $(TOP)/doc --no-print-directory doc++ ; fi doc++: FORCE @$(MAKE) -C $(TOP)/doc --no-print-directory doc++file_list doc++process sane_to_docbook @date > .doc++_made doc++process : FORCE @echo Clear out doc++ directory @$(subst DIR,$(DOCXX_GEN),$(ENSURE_EMPTY_DIR)) @$(RM) -f .tex_done ifdef DOCXX_DIRS @echo DOC++ @$(DOCXX) $(DOCXX_ARGS) -d $(DOCXX_GEN) $(shell sed -e 's/^/$(TOP)\//' $(TOP)/Doc++Files) $(DOCXX_EXTRA_FILES) @cp -p $(DOCXXIMAGES) $(DOCXX_GEN) endif sane_to_docbook: FORCE @$(ECHO_N) 'Convert to Docbook: ' @$(RM) -f $(DOCXX_GEN)/declare_entities.sgml $(DOCXX_GEN)/include_entities.sgml ifdef DOCXX_DIRS @$(MAKE) -C $(TOP)/doc --no-print-directory $(subst sane,db,$(wildcard $(DOCXX_GEN)/*.sane)) endif @echo " :done" $(DOCXX_GEN)/%.db: FORCE @{ \ name=`basename $@ .db` ;\ idname=`echo "docpp-$$name"|sed -e 's/[^a-zA-Z0-9][^a-zA-Z0-9]*/-/g'` ;\ sane="$(DOCXX_GEN)/$$name.sane" ;\ db="$(DOCXX_GEN)/$$name.db" ;\ $(ECHO_N) "$$name " ;\ jade -E 2000 -d $(DSSL_SANE_DB) -t sgml $$sane > $$db 2>>$(DOCXX_GEN)/jade_trace ;\ echo "" >&3 ;\ echo "&$$idname;" >&4 ;\ for inc in 2 3 4 ;\ do \ perl -pe '$$inc='$$inc';s%<(/)?sect([0-9]+)%"<".$$1."sect".($$2+$$inc-1)%ge;' $$db > $$db-$$inc ;\ echo "" >&3 ;\ echo "&$$idname-$$inc;" >&4 ;\ done ;\ } 3>>$(DOCXX_GEN)/declare_entities.sgml 4>>$(DOCXX_GEN)/include_entities.sgml ########################################################################### ## Create example sections from testsuite code .examples_made : @if [ ! -f .examples_made ] ; then $(MAKE) -C $(TOP)/doc --no-print-directory examples ; fi examples : FORCE @$(ECHO_N) 'Building examples:' @$(subst DIR,$(EXAMPLES_GEN),$(ENSURE_EMPTY_DIR)) @$(ECHO_N) '' > $(EXAMPLES_GEN)/declare_entities.sgml @$(ECHO_N) '' > $(EXAMPLES_GEN)/include_entities.sgml @for e in $(EXAMPLE_TO_DOCUMENT) XXXX ;\ do \ if [ $$e = XXXX ] ; then break ; fi ;\ $(ECHO_N) " $$e" ;\ sect=$(EXAMPLES_GEN)/$${e}_example_section.sgml ;\ ent=`echo "$${e}examplesection"| tr -dc '[a-z]'` ;\ $(EST_HOME)/bin/cxx_to_docbook -s 1 $(TOP)/testsuite/$${e}_example.cc >$$sect 2>$(EXAMPLES_GEN)/$${e}_trace;\ echo "" >> $(EXAMPLES_GEN)/declare_entities.sgml ;\ echo "&$${ent};" >> $(EXAMPLES_GEN)/include_entities.sgml ;\ done @echo " :done" @date > .examples_made ########################################################################### ## Create example sections from mainlines .manuals_made : @if [ ! -f .manuals_made ] ; then $(MAKE) -C $(TOP)/doc --no-print-directory manuals ; fi manuals : FORCE @$(ECHO_N) 'Building manuals:' @$(subst DIR,$(MANUALS_GEN),$(ENSURE_EMPTY_DIR)) @$(ECHO_N) '' > $(MANUALS_GEN)/declare_entities.sgml @$(ECHO_N) '' > $(MANUALS_GEN)/include_entities.sgml @for m in $(MAIN_TO_DOCUMENT) XXXX ;\ do \ if [ "$$m" = XXXX ] ; then break ; fi ;\ $(ECHO_N) " $$m" ;\ sect="$(MANUALS_GEN)/$${m}_manual_section.sgml" ;\ ent=`echo "$${m}manualsection"| tr -dc '[a-z]'` ;\ $(EST_HOME)/bin/cxx_to_docbook -s 1 \ -special @options '' "$(EST_HOME)/bin/$$m -sgml_options" '' \ -special @synopsis '' "$(EST_HOME)/bin/$$m -sgml_synopsis" '' \ $(TOP)/main/$${m}_main.cc > $$sect 2>$(MANUALS_GEN)/$${m}_trace ;\ echo "" >> $(MANUALS_GEN)/declare_entities.sgml ;\ echo "&$${ent};" >> $(MANUALS_GEN)/include_entities.sgml ;\ done @echo " :done" @date > .manuals_made ########################################################################### ## Index building index.sgml: index_html.jade @echo 'Creating Index' $(EST_HOME)/bin/build_docbook_index -m html -t 'INDEX' index_html.jade index.sgml ensure_index_input: @if [ ! -f index_html.jade ] ; then echo "CREATING EMPTY INDEX" ; touch index_html.jade ; fi ########################################################################### ## Process things through LaTeX into gifs tex_conversion : .tex_done @: .tex_done: tex_stuff.jade @echo 'Converting LaTeX' @$(subst DIR,$(HTML_DIR)/$(IMAGES_GEN),$(ENSURE_EMPTY_DIR)) @$(EST_HOME)/bin/tex_to_images -s $(TEX_SCALE) -d $(HTML_DIR) tex_stuff.jade @date >.tex_done ensure_tex_input: @if [ ! -f tex_stuff.jade ] ; then echo "CREATING EMPTY LaTeX input" ; touch tex_stuff.jade ; fi ########################################################################### ## Include and exclude file building INCLUDE_ONLY-full: $(DOCNAME).sgml @echo "Rebuild INCLUDE_ONLY-full" @$(RM) -f INCLUDE_ONLY-full INCLUDE_ONLY-min @{ \ echo "" ;\ sed -n -e '/.*%\(include-[a-zA-Z0-9]*\);.*/{;s///;p;}' $(DOCNAME).sgml ;\ } > INCLUDE_ONLY-full @sed -e '/INCLUDE/s//IGNORE/' INCLUDE_ONLY-full > INCLUDE_ONLY-min @chmod -w INCLUDE_ONLY-full INCLUDE_ONLY-min sections.dtd: $(DOCNAME).sgml @echo "Rebuild sections.dtd" @$(RM) -f sections.dtd @{ \ echo "" ;\ sed -n -e '/.*%include-.*&\([a-z0-9]*\)doc;.*/{;s///;p;}' $(DOCNAME).sgml ;\ echo '' ;\ } > sections.dtd @chmod -w sections.dtd INCLUDE_ONLY: INCLUDE_ONLY-full @[ -f INCLUDE_ONLY ] || { cp INCLUDE_ONLY-full INCLUDE_ONLY ; echo INCLUDE_ONLY created from INCLUDE_ONLY-full ; } @chmod +w INCLUDE_ONLY copy_requirements: FORCE ifdef HTML_REQUIREMENTS @for r in $(HTML_REQUIREMENTS) ;\ do \ $(RM) -rf "$(HTML_DIR)/$$r";\ cp -r "$$r" $(HTML_DIR) ;\ done endif ########################################################################### ## Make sure things get done in the right order prepare_doc: doc++ manuals examples @: prepare_doc_quick: .doc++_made .manuals_made .examples_made @: .$(DOCNAME)_html : $(DOCNAME).sgml $(SGMLFILES) INCLUDE_ONLY $(DSSSL) .doc++_made .manuals_made .examples_made index.sgml tex_stuff.jade .$(DOCNAME)_ps : $(DOCNAME).sgml $(SGMLFILES) INCLUDE_ONLY $(DSSSL) .doc++_made .manuals_made .examples_made new_doc: INCLUDE_ONLY sections.dtd ensure_index_input ensure_tex_input prepare_doc new_doc_x copy_requirements new_doc_x: @i=x; until $(MAKE) -q .$(DOCNAME)_html ;\ do \ if [ "$$i" = xxxx ] ; then break ; fi ;\ i="x$$i"; \ $(MAKE) --no-print-directory .$(DOCNAME)_html ;\ $(MAKE) --no-print-directory tex_conversion ;\ done new_quick_doc: INCLUDE_ONLY sections.dtd ensure_index_input ensure_tex_input prepare_doc_quick .$(DOCNAME)_html copy_requirements quick_doc quick_new_doc: new_quick_doc @: ########################################################################### ## Actual Docbook=> output rules .%_html: %.sgml sgmltools -b html -s $(DSSSL_HTML) $*.sgml date > .$*_html if cmp $(HTML_DIR)/HTML.index index_html.jade ; then : ; else cp $(HTML_DIR)/HTML.index index_html.jade ; fi if cmp $(HTML_DIR)/TeX.formulae tex_stuff.jade ; then : ; else cp $(HTML_DIR)/TeX.formulae tex_stuff.jade ; fi .%_ps: %.sgml sgmltools -b ps $*.sgml @date > .$*_ps .%_txt: %.sgml sgmltools -b txt -s $(DSSSL_HTML) $*.sgml ########################################################################### ## Some help with what the targets are. new_doc_help: FORCE @echo '\ ;\ ;To do a complete rebuild of the documentation do: \ ; gnumake new_doc ;\ ;\ ;To just remake the documentation without doing all the\ ;analysis of header files and so on, do:\ ; gnumake quick_new_doc\ ;\ ;You can force rebuilding of just some of the supporting \ ;information using the following targets:\ ;\ ; doc++file_list \ ; - Check for new files which doc++ needs to analyse. \ ; doc++ - analysis of headers and conversion to sgml. \ ; manuals - Extraction of manuals from executables. \ ; examples - Extraction of example code. \ ;\ ;For instance, to rebuild the manual pages and then process: \ ; gnumake manuals quick_new_doc \ ;\ ;\ ' | tr ';' '\012' speech_tools/config/rules/common_make_rules.mak0000644000076400007640000001124307262605664020467 0ustar awbawb ########################################################-*-mode:Makefile-*- ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Various People ## ## : Reorganised (and probably broken) ## ## : by Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: June 1997 ## ## --------------------------------------------------------------------- ## ## Default Makefile rules includede everywhere. ## ## ## ########################################################################### # Map selected modules to how to include them. include $(EST)/config/rules/modules.mak ifdef REQUIRED_MAKE_INCLUDE -include $(REQUIRED_MAKE_INCLUDE) endif -include $(TOP)/config/project_config_check.mak # Places to find templates, needed by Sun CC # export TEMPLATE_DIRS export CI_ARGS ifdef JAVA_CLASSES NEED_JAVA=1 endif # Various subsets of directories ifndef ALL_DIRS ifdef BUILD_DIRS ALL_DIRS = $(BUILD_DIRS) endif endif ifdef JAVA_COMMON_DIRS JUST_BUILD_DIRS := $(JUST_BUILD_DIRS) $(notdir $(JAVA_COMMON_DIRS)) endif ifdef JUST_LIB SUBDIRECTORIES = ${JUST_BUILD_DIRS} ${LIB_BUILD_DIRS} ${EXTRA_LIB_BUILD_DIRS} else SUBDIRECTORIES = ${JUST_BUILD_DIRS} ${EXTRA_LIB_BUILD_DIRS} ${BUILD_DIRS} ${EXTRA_BUILD_DIRS} endif # now include various rule-sets include $(EST)/config/rules/defaults.mak include $(EST)/config/rules/compile_options.mak include $(EST)/config/rules/make_depend.mak include $(EST)/config/rules/library.mak include $(EST)/config/rules/targets.mak include $(EST)/config/rules/visual_c.mak include $(EST)/config/rules/cvs.mak include $(EST)/config/rules/c.mak ifdef NEED_JAVA include $(EST)/config/rules/java.mak endif include $(EST)/config/rules/config_errors.mak # keep track of the places we put templates. Used for compiling things # which depend on this ifndef MADE_FROM_ABOVE all: $(MAKE_INCLUDE) $(MAKE_INCLUDE) : FORCE @echo "LIBRARY_TEMPLATE_DIRS=$(TEMPLATE_DIRS)" > $(MAKE_INCLUDE) endif # Finally, here are the automatically updated dependencies ifndef NO_DEPEND ifdef SRCS -include $(DEPEND) endif endif echo: @echo $(VAR)='$($(VAR))' speech_tools/config/rules/test_make_rules.mak0000644000076400007640000001216710005563043020143 0ustar awbawb ########################################################-*-mode:Makefile-*- ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996,1997 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### # Makefile rules for testing things # ########################################################################### TEST_PROGRAMS = $(TEST_MODULES:%=%_example) $(TEST_MODULES:%=%_regression) TSRCS = $(TEST_PROGRAMS:%=%.cc) SRCS = $(TSRCS) OBJS = $(SRCS:%.cc=%.o) SCRIPTS = $(TEST_SCRIPTS:%=%.sh) FILES = Makefile \ $(SRCS) \ $(SCRIPTS) \ $(OTHERS) LOCAL_DEFINES += -DDATA="\"$(DATA)\"" include $(TOP)/config/common_make_rules test_scripts: $(TEST_SCRIPTS:%=%_script_test) test_modules: $(PROJECT_LIBDEPS) $(TEST_MODULES:%=%_module_build_and_test) just_test_scripts: test_scripts just_test_modules: $(TEST_MODULES:%=%_module_test) $(TEST_MODULES:%=%_module_build_and_test) : %_module_build_and_test : %_module_rebuild %_module_test $(TEST_MODULES:%=%_module_rebuild) : %_module_rebuild : @echo 'build $* (module)' @$(RM) -f $(OBJS) @if $(MAKE) --no-print-directory PROJECT_LIBDEPS= OPTIMISE=$(TEST_OPTIMISE) WARN=1 $*_example $*_regression ;\ then \ : ;\ else \ echo $* example status: FAILED ; exit 1 ;\ fi $(TEST_MODULES:%=%_module_test) : %_module_test : correct/%_example.out correct/%_regression.out @echo 'test $* (module)' @LD_LIBRARY_PATH='$(TOP)/lib:$(LD_LIBRARY_PATH)' ; export LD_LIBRARY_PATH;\ if ./$*_example $($(*:=_example_args)) > $*_example.out ;\ then \ echo $*_example completed ;\ if [ ! -f $*_example.out ] || diff correct/$*_example.out $*_example.out ;\ then \ echo $* example status: CORRECT ;\ else \ echo $* example status: INCORRECT ;\ fi ;\ else \ echo $* example status: FAILED ;\ fi ;\ if ./$*_regression $($(*:=_regression_args)) > $*_regression.out ;\ then \ echo $*_regression completed ;\ if [ ! -f $*_regression.out ] || diff correct/$*_regression.out $*_regression.out ;\ then \ echo $* regression status: CORRECT ;\ else \ echo $* regression status: INCORRECT ;\ fi ;\ else \ echo $* regression status: FAILED ;\ fi @echo @echo $(TEST_SCRIPTS:%=%_script_test) : %_script_test : %.sh correct/%_script.out @echo 'test $* (script)' @OUTPUT='$*_script.out' ;\ TOP='$(TOP)' ;\ DATA='$(DATA)' ;\ export TOP OUTPUT DATA ;\ LD_LIBRARY_PATH='$(TOP)/lib:$(LD_LIBRARY_PATH)' ; export LD_LIBRARY_PATH;\ if /bin/sh $*.sh $($(*:=_script_args)) ;\ then \ echo $* script completed ;\ if [ ! -f $*_script.out ] || diff correct/$*_script.out $*_script.out ;\ then \ echo $* script status: CORRECT ;\ else \ echo $* script status: INCORRECT ;\ fi ;\ else \ echo $* script status: FAILED ;\ fi @echo @echo $(SRCS:%.cc=%.o) : %.o : %.cc TEMPS = $(wildcard *_temp.cc) $(TEMPS:%.cc=%.o) : %.o : %.cc % : %.o $(PROJECT_LIBDEPS) $(CXX) $(CXXFLAGS) $(TEMPLATES) -o $@ $@.o $($(@:=_LIBS)) $(LIBS) speech_tools/config/rules/cvs.mak0000644000076400007640000001044707262616577015575 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Oct 1 1997 ## ## -------------------------------------------------------------------- ## ## Make rules dealing with RCS. ## ## ## ########################################################################### ifdef S SUBDIRARG=-R else SUBDIRARG=-l endif ifndef CVS CVS=cvs endif # make sure we have the latest of everything update: @ echo "Updating in directory $(DIRNAME) ..." $(CVS) update -d # check in writable files checkin_add: @if [ -d CVS ] ; then \ echo "Registering new files in $(DIRNAME) ..." ;\ for f in $(FILES) ; do \ if fgrep -q "/$$f/" CVS/Entries ;\ then \ : ;\ else \ echo Adding "$$f" ;\ $(CVS) add "$$f" ;\ fi ;\ done ;\ echo "Registering new directories in $(DIRNAME) ..." ;\ fi ifdef ALL_DIRS @if [ -d CVS ] ; then \ for d in $(ALL_DIRS) ; do \ if egrep -q "^D/$$d/" CVS/Entries ;\ then \ : ;\ else \ echo Adding "$$d" ;\ $(CVS) add "$$d" ;\ fi ;\ done ;\ fi @for i in $(ALL_DIRS) ; \ do \ $(MAKE) MADE_FROM_ABOVE=1 --no-print-directory -C $$i checkin_add ; \ done endif checkin: checkin_add commit ifeq ($(TOP),.) @echo Make sure file watching is turned on everywhere @$(CVS) watch on . endif @: commit: @ echo "Committing in directory $(DIRNAME) ..." @$(CVS) commit # Look for locked files locked: @ echo "Looking for files you are editing ..." @$(CVS) editors $(SUBDIRARG) | egrep $${USER-$$LOGNAME} || true editors: @ echo "Looking for files anyone are editing ..." @$(CVS) editors $(SUBDIRARG) # look for locked by anyone all_locked: editors @: speech_tools/config/rules/build_dir.mak0000644000076400007640000000606307262605664016731 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Make rules for compiling in a build tree. ## ## ## ########################################################################### create_%_build : @ echo "Check Build Tree for $*" @sh $(EST)/config/rules/build_tree.sh $*_build $(build_$*_from) %_build : FORCE @echo @echo "Build $*" @$(MAKE) --no-print-dir -C $*_build speech_tools/config/configs/Makefile0000644000076400007640000000650007262605664016234 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### TOP=../.. DIRNAME=config/configs ########################################################################### ## ## Configurations: ## ## egcs_as_gcc.mak Egcs is installed as gcc/g++ ## ## cstr.mak Setup on cstr Solaris machines ## ## ellipsis Setup on cstr linux machine ## ## kellogg Setup on cstr machine with different java location ## ## v_java Special setup for a with-java compilation at cstr ## ## rjc Weird things in rjc's setup. CONFIGURATIONS = \ egcs_as_gcc.mak \ cstr.mak \ ellipsis.mak \ kellogg.mak \ v_java.mak \ rjc.mak \ cstr_jdk1.2.mak FILES = Makefile $(CONFIGURATIONS) include $(TOP)/config/common_make_rules speech_tools/config/configs/egcs_as_gcc.mak0000644000076400007640000000600107262605664017502 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: Jun 24 1998 ## ## -------------------------------------------------------------------- ## ## For systems where egcs is installed disguised as gcc. ## ## ## ########################################################################### include $(EST)/config/compilers/egcs.mak EGCS_CC=gcc EGCS_CXX =g++ speech_tools/config/configs/cstr.mak0000644000076400007640000000504607262616577016252 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ifeq ($(OSTYPE),SunOS) include $(EST)/config/configs/cstr_suns.mak else include $(EST)/config/configs/cstr_linux.mak endif speech_tools/config/configs/ellipsis.mak0000644000076400007640000000607507262605664017121 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Description of directory structure weirdnesses on ellipsis. ## ## ## ########################################################################### ########################################################################### ## Include -lXt beause libaudio needs it. X11_LIB = /usr/X11/lib -lXt NAS_INCLUDE = /cstr/include NAS_LIB = /usr/X11/lib speech_tools/config/configs/kellogg.mak0000644000076400007640000000475207262605664016721 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### JAVA_HOME=/usr/java1.1 JAVAC=/bin/javac JAVAH=/bin/javah JAVA=/bin/java speech_tools/config/configs/v_java.mak0000644000076400007640000000646107262616577016547 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Settings for compilation in ~festival/versions/v_java ## ## ## ########################################################################### include $(EST)/config/configs/cstr.mak ########################################################################### ## Run time settings. SYSTEM_LD_LIBRARY_PATH:=/projects/festival/versions/v_java/lib CONFIG_LIBS = -L/projects/festival/versions/v_java/lib NAS_LIB = /projects/festival/versions/v_java/lib ########################################################################### ## make sure we get the correct java JAVA=$(JAVA_HOME)/bin/java speech_tools/config/configs/rjc.mak0000644000076400007640000000626007262605664016047 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Thu Oct 2 1997 ## ## -------------------------------------------------------------------- ## ## Rjc's personal settings. Used to compile against special versions ## ## of libraries. ## ## ## ########################################################################### include $(EST)/config/configs/cstr.mak DMALLOC_LIB = /home/rjc/usr.local/lib DMALLOC_INCLUDE = /home/rjc/usr.local/include CONFIG_LIBS = -L/home/rjc/usr.local/lib speech_tools/config/configs/cstr_jdk1.2.mak0000644000076400007640000000601607262605664017314 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Tells it where JDK 1.2.X is at cstr ## ## ## ########################################################################### DEFAULT_JAVA_HOME = /cstr/external/jdk1.2 DEFAULT_JMF_HOME = /cstr/external/jmf JAVAC=$(JAVA_HOME)/bin/javac JAVAH=$(JAVA_HOME)/bin/javah JAVA=$(JAVA_HOME)/bin/java speech_tools/config/modules/Makefile0000644000076400007640000000603210075606451016243 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Makefile for config directory ## ## ## ########################################################################### TOP=../.. DIRNAME=config/modules RULESETS = efence.mak dmalloc.mak debugging.mak \ psola_tm.mak editline.mak tcl.mak \ freebsd16_audio.mak irix_audio.mak linux16_audio.mak \ sun16_audio.mak win32_audio.mak macosx_audio.mak \ mplayer_audio.mak nas_audio.mak esd_audio.mak FILES = Makefile descriptions $(RULESETS) include $(TOP)/config/common_make_rules speech_tools/config/modules/descriptions0000644000076400007640000000545407262605664017254 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Descriptions of uninteresting modules. ## ## ## ########################################################################### desc_dummy="A dummy module" desc_native_audio="Native audio module for your system" speech_tools/config/modules/efence.mak0000644000076400007640000000607207262605664016537 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for whan compiling with efence. ## ## ## ########################################################################### INCLUDE_EFENCE=1 MOD_DESC_EFENCE=Compile with efence memory error detection package DEBUG_LIBS += -L$(EFENCE_LIB) -lefence speech_tools/config/modules/dmalloc.mak0000644000076400007640000000635107262605664016725 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed Jun 3 1998 ## ## -------------------------------------------------------------------- ## ## Link in the dmalloc library and include the header. ## ## ## ########################################################################### ifndef INCLUDE_DMALLOC INCLUDE_DMALLOC=1 endif MOD_DESC_DMALLOC=Compile with debugging malloc library ifdef DMALLOC_LIB DEBUG_LIBS += -L$(DMALLOC_LIB) endif DEBUG_LIBS += -ldmalloc ifdef DMALLOC_INCLUDE DEBUG_DEFINES += -I$(DMALLOC_INCLUDE) endif DEBUG_DEFINES += -DINCLUDE_DMALLOC speech_tools/config/modules/debugging.mak0000644000076400007640000000600407262605664017240 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## -------------------------------------------------------------------- ## ## Turn on various debugging facilities. ## ## ## ########################################################################### ifndef INCLUDE_DEBUGGING INCLUDE_DEBUGGING=1 endif MOD_DESC_DEBUGGING=Compile in some debugging facilities MODULE_DEFINES += -DEST_DEBUGGING speech_tools/config/modules/psola_tm.mak0000644000076400007640000000614007262605664017124 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for psola(tm) audio support. ## ## ## ########################################################################### INCLUDE_PSOLA_TM=1 MOD_DESC_PSOLA_TM=Include PSOLA(tm) synthesis code. MODULE_DIPHONE_DEFINES += -DSUPPORT_PSOLA_TM $(MODULE_PSOLA_TM_OPTIONS:%=-DPSOLA_TM_%) speech_tools/config/modules/editline.mak0000644000076400007640000000633507517106761017106 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Alan W Black (awb@cstr.ed.ac.uk) ## ## Date: December 1998 ## ## -------------------------------------------------------------------- ## ## Command line editor based on editline ## ## ## ########################################################################### INCLUDE_EDITLINE=1 MOD_DESC_EDITLINE=Use editline for command line editing and history IO_DEFINES += -DSUPPORT_EDITLINE $(MODULE_EDITLINE_OPTIONS:%=-DEDITLINE_%) MODULE_LIBS += $(TERMCAPLIB) ifeq ($(DIRNAME),siod) CSRCS := $(CSRCS) el_complete.c editline.c el_sys_unix.c endif speech_tools/config/modules/tcl.mak0000644000076400007640000000615307262605664016074 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for TCL audio support. ## ## ## ########################################################################### INCLUDE_TCL=1 MOD_DESC_TCL=Include TCL interface FESTIVAL_DEFINES += -DSUPPORT_TCL FESTIVAL_INCLUDES += -I$(TCL_INCLUDE) MODULE_LIBS += -L$(TCL_LIB) $(TCL_LIBRARY) speech_tools/config/modules/freebsd16_audio.mak0000644000076400007640000000624207262616577020260 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Freebsd 16 bit audio support. ## ## ## ########################################################################### INCLUDE_FREEBSD16_AUDIO=1 MOD_DESC_FREEBSD16_AUDIO=Native audio module for FreeBSD systems AUDIO_DEFINES += -DSUPPORT_FREEBSD16 #ifdef INCLUDE_JAVA_CPP # AUDIO_DEFINES += -DTHREAD_SAFETY # MODULE_LIBS += -lpthread #endif speech_tools/config/modules/irix_audio.mak0000644000076400007640000000612107262605664017441 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Irix audio support. ## ## ## ########################################################################### INCLUDE_IRIX_AUDIO=1 MOD_DESC_IRIX_AUDIO=Native audio module for Irix systems AUDIO_DEFINES += -DSUPPORT_IRIX MODULE_LIBS += -L/usr/lib32 -laudio speech_tools/config/modules/linux16_audio.mak0000644000076400007640000000644011101667327017767 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Linux 16 bit audio support. ## ## ## ########################################################################### INCLUDE_LINUX16_AUDIO=1 MOD_DESC_LINUX16_AUDIO=Native audio module for Linux systems ifeq ($(LINUXAUDIO),alsa) AUDIO_DEFINES += -DSUPPORT_ALSALINUX MODULE_LIBS += -lasound endif ifeq ($(LINUXAUDIO),none) AUDIO_DEFINES += -DSUPPORT_VOXWARE endif ifdef INCLUDE_JAVA_CPP AUDIO_DEFINES += -DTHREAD_SAFETY MODULE_LIBS += -lpthread endif speech_tools/config/modules/sun16_audio.mak0000644000076400007640000000606307262605664017447 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Sun 16 bit audio support. ## ## ## ########################################################################### INCLUDE_SUN16_AUDIO=1 MOD_DESC_SUN16_AUDIO=Native audio module for Solaris systems AUDIO_DEFINES += -DSUPPORT_SUN16 speech_tools/config/modules/win32_audio.mak0000644000076400007640000000611107262605664017427 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Win32 audio support. ## ## ## ########################################################################### INCLUDE_WIN32_AUDIO=1 MOD_DESC_WIN32_AUDIO=Native audio module for Win32 (Win95 and WinNT) systems AUDIO_DEFINES += -DSUPPORT_WIN32AUDIO speech_tools/config/modules/macosx_audio.mak0000644000076400007640000000151611332265736017756 0ustar awbawb ########################################################################### ## ## ## Author: Brian Foley (bfoley@compsoc.nuigalway.ie) ## ## Date: Wed Feb 17 2004 ## ## -------------------------------------------------------------------- ## ## Definitions for MacOS X audio support. ## ## ## ########################################################################### INCLUDE_MACOSX_AUDIO=1 MOD_DESC_MACOSX_AUDIO=CoreAudio audio module for MacOS X systems AUDIO_DEFINES += -DSUPPORT_MACOSX_AUDIO MODULE_LIBS += -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework Cocoa speech_tools/config/modules/mplayer_audio.mak0000644000076400007640000000607207262605664020144 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for Mplayer audio support. ## ## ## ########################################################################### INCLUDE_MPLAYER_AUDIO=1 MOD_DESC_MPLAYER_AUDIO=Audio module for calling windows mplayer AUDIO_DEFINES += -DSUPPORT_MPLAYER speech_tools/config/modules/nas_audio.mak0000644000076400007640000000621507262605664017253 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for NAS audio support. ## ## ## ########################################################################### INCLUDE_NAS_AUDIO=1 MOD_DESC_NAS_AUDIO=Use Network Audio AUDIO_DEFINES += -DSUPPORT_NAS AUDIO_INCLUDES += -I$(NAS_INCLUDE) MODULE_LIBS += -L$(NAS_LIB) -laudio MODULE_EXTRA_LIBS += -L$(X11_LIB) -lX11 -lXt speech_tools/config/modules/esd_audio.mak0000644000076400007640000000624307262605664017246 0ustar awbawb ########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## ## ## Author: Richard Caley (rjc@cstr.ed.ac.uk) ## ## Date: Wed May 27 1998 ## ## -------------------------------------------------------------------- ## ## Defenitions for ESD audio support. ## ## ## ########################################################################### INCLUDE_ESD_AUDIO=1 MOD_DESC_ESD_AUDIO=Use Enlightenment Speech Demon AUDIO_DEFINES += -DSUPPORT_ESD AUDIO_INCLUDES += -I$(ESD_INCLUDE) MODULE_LIBS += -L$(ESD_LIB) -lesd -laudiofile MODULE_EXTRA_LIBS += -L$(X11_LIB) -lX11 -lXt speech_tools/doc/classHeader.inc0000644000076400007640000000053207262605664015354 0ustar awbawb

speech_tools/doc/hierHeader.inc0000644000076400007640000000103507262605664015175 0ustar awbawb EST Class Hierachy

Edinburgh Speech Tools
V1.1.0 August 1998


speech_tools/doc/indexHeader.inc0000644000076400007640000000107607262605664015362 0ustar awbawb Edinburgh Speech Tools Index

Edinburgh Speech Tools
V1.1.0 August 1998



speech_tools/doc/banner.inc0000644000076400007640000000067707262605664014415 0ustar awbawb

This page is part of the Edinburgh Speech Tools Library documentation
Copyright University of Edinburgh 1997
Contact: speech_tools@cstr.ed.ac.uk


speech_tools/doc/edcrest.gif0000644000076400007640000000711307262605664014565 0ustar awbawbGIF89aqsU>U,LQQixj&qv8{Z/5???)'&^ S9B97.UH/kkl5PkُQVQ>!SzQ ҳvP...n2obS|Ơf((@!/,qspH,d 0~@ tJZI%K.qQAAzگRL%$hEsvuoB zIQG!%f jEFyG CU _FE np/E,pDFzxF eH vZBkwDL  SD^؃y^3X B0]3,h,@>PػJ@JB0cʜYLA%%AieH` @)&L\I#D%B.h hӪ]l]$dE!e˷ LP*@6#'`**\V\/C,aڽ9 y@i9G֚HLȦMܯ[@>^zSYb!"[7T(1SO<|-[QŸ?2",ЇD_!۸0K)}6RK5ef VPd<k(,/^@o @)DiA~v xP ѱ \fV—_~!E&<@ioQ&p)dSHD!DUwe"L`衈@ 2 ,`.@.@4h # *)ۀC6&5h&JAJB 0i& "ZꝮvrNL{Zl f餕𫵟;R'w{!FRyZҎk @Bګ2 䚚9zIPAQci %{^zo/ hNz"DI8к# l |i rȪA!P/AC[p%]ZרAy`oY -%2 i@ ][$O@T؋PB+`&ca 5(ꮨWP<Н4o>B"ls;v @e; #OyA8?@ 3x_UzԀVOrArDM٠*׼k#>V*,_tm.0X & !x G8( `0± u#88 54ؓ"p` =UC8*e@(SJ h VdAPKB (,x'"S`E+1[B@%)]``"j%-T  J8*NIx%S#0O1rb_j9&tBV˴#W2*Ѐ 9S t HCƵv BUR@Lis4=9:/36^H-U+e:̊fՐ h"_U/$kR0xiLUpP ba]Z5LJw dE@Yy( 3N֟ f+960[T0lS~|!^C[1u5d(}r=nX&[*܄;fٶ[x)a3B;^|paIp^rqMT䲥mX*67Z zTA/3$B l>bT, V4݀*`fuvUlMmqW"R .& iJtwYUFT-܂R:Ϩ>uS$fs0Oջw5`0v]dG lҋB)u 8lMl[bhshAfF-85aF )\`k7{P! 6Er'Yjqysm>^[pyu Ga  j~0B-j}ԜĴNHq0 x ;7Nq'[>9Iv}shTwIPaz5WiO# v5$lb_1^Z]^RliyKۥ^{@6^ݛ_0 ^d4 }~-|NgqJ,_n} ";}37xW~ ly GOm0I kO#O0Lj$s6!l(  [5:kg|p[7.w08BH fp{7BW+eї tW>o(@ nw\0-fU| _e+:FsCVTagw+%W2Uxp)pdrMG;؀WP%S"_{X `h}0PjC2Gϲ _GSag&Y%W _eqrY=EVSvSq6Z{|DyPWP$E>рJS 7j| VUK6|RKzgR(@WI[$ivE$ U}NjXKPlS?Q zXq$jX1eQVjAg>UK0y{KQf)&P$X؍SRf`7(.Ga&vg}bRGOMQ PPKG?uN6$sB>xqAvb[wtp2dqz1(1Uy[q3jH&Fh3 bIN>-cp=hKqB+?9!tI y!0g >p ?~SQۓ*dxGQ!oMP9f^ iܷ mt` n2"sM:,}g7 a@ }0uiqD 9; Z1ӗF N١W$I`GP3% 4j 0T٣WE$@`H4ءA;speech_tools/doc/cstr.gif0000644000076400007640000000132407262605664014105 0ustar awbawbGIF87a|?,|? ؋޼x BgL Ģ1P)ULǦ)<6jUi܊ǽbJl)|fG~`hԇVxuhWRItxy虩6:4!*sPs;s*k3Qgtz z[% C, Y=ʨ\[[NȘ|-E̥Hpvn\;Sw@4Qo8hjc.8XG7BN|$L^i\fGVHZrZI}"m©N%arhϘLK"wXD4*ԈdWD~hlm,[ J0Ybys^>`W.UCJ+0yݧΝ"n&nY&ٗx颾YpŮ~YkrC?H k̯#$6m$x ꛻8U6,SˈG`6ց[늣YkĮ{e].RdίM9ڠw~1TPJ So1*i1y׌ʰ݅PG`(n{#BE0hh\}H*GY*NN)VHسS*&WRv1^iȑ4e@FfctGfҽ gQBg5uQ@ygy'J2l;P;speech_tools/doc/est.jpg0000644000076400007640000001045607262605664013746 0ustar awbawbJFIFICREATOR: XV Version 3.10a Rev: 12/29/94 Quality = 60, Smoothing = 15 C    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( )2((h((h(Ƞ(hy՟cCGd"X's@Er;?_X>AaxoO&X>A`k?O&5_B,@S"a@Eg}yv9ǵ_S@ EPEPEPX>-Ե]7NI4[4(X*[ 43]g]x)ԃQ?X8,pcEQџXT>;Ost?h qn|ytFFFm)~" M?|Vt rhǽUzz[`H 9F"  pGP"PM@5? ^NYVp>g޽79w̭AǾ3Տ*( tPk!qe#?+ƚfEmiwGX\⼋bD)l!R*#C$bD֋"({=\^D9:~Tѭ@Ҧe~\r>ӛg3>=T+ھ }+<+qj7WrG+>Pxs€:-5ٱދ˰َ+Y:(((5-s1SOIN΀t j0BF_IZxz:Eu= NERk<;4 q,CD꺝݃vc {8Hcgo{%9y\rs^M'${{Xө? |k2r>+Դh0<-n>ldO5l[c}SOJ:Q@GZ((iuhY XZNCE2ph^an#3HGp?/#=x&ԼM;J=1&Kc[0oBjx]dXM&ĜV|9K `9ټz& #Q}zy`j|5^}.@I?҆.oBω5)9vCLDy |~g3Vr SV?NG }Mfkn_g k&EFĨ1ZlPfh~ F9`GЏjx|IgĪ0<].}( T6^Qv+N8Zvֹ>{ =~mj9Vr8>vvA4\m .+TAN{W){_ew vv#!RT2A5c&m-I@Q@+85NKiI-Rgp@@{{_{6䏽X8ܓA(s2:Yu)ȍ fBiZiW9gb^TKm'Hι `u :^cAUڿ*:/ GmEҡr^H!럮k06i spobǖ6+Ǝ ndmc*Z^4^W+cM߼p?{lcJGiH-ƼQOaʞfzbv f2ݏZ>U8_.d^du$.WU&*r^OGwn#*ξڼ[Kt+"im.eIm?_j'{u5{+U?<\>.Uwz*c x$b?&Bg$SZGCI9j`WWqjbrZ60n vd?csfz-9=Q{Z}cGex G1Cڹǹ4^RĝE9i8:n]NG. !L㬀c?n3ȁcI&prwMI.[E3*ԈUM1v'D-Ypmd[s֊d@?v>󁚯, 1G3H&m+(g=+r<OZRcq(:0I k]k=;~zӃL8:W"8}+vht"@1Yit If@9;hdbQ('->=+$ۖBpvoZkX>5 +T-"zJ1(yuĵkrנ[a.b -G6~q6lkj~ i? P]^Vqrʧ?ҼS+ $V,A: AqNѤq._ֺX`[! x3-U|ʗ1HtNMi^O֎hQd2&bNk綟XHHd`wM:fG6? l,7o5χ#iFK{ ceöY*hyVN:y [ɦ8*ՄLjuʔm< ]_JOn4j0:{|OqС#d4 u"5EUŒ B/+° DSt D S((speech_tools/doc/est_small.jpg0000644000076400007640000000371707262605664015140 0ustar awbawbJFIFICREATOR: XV Version 3.10a Rev: 12/29/94 Quality = 60, Smoothing = 15 C    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO?d" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( LZC%ń<X+o[i77/`@FH vcY+^sEc;5$F6L^(:TM$}Auk4ˋH l\ } Mrwz_ Z8<8m#`ep/ּÚ: ZD$"=2mvE $[APjΙkQqpwyQu?ֹ }b)RK>r@#cvݢ ;GnMoZ$ddFT5Ӟ ͐1_ daAšX  4w↥vXoiX8>{ט|)c+| "> speech_tools/doc/cstr_defs.dtd0000644000076400007640000000321707262605664015117 0ustar awbawbCenter for Speech Technology Research, University of Edinburgh' > 80 South Bridge Edinburgh Scotland EH1 1HN' > XML"> C++"> Java"> Scheme"> speech tools"> The Edinburgh Speech Tools Library"> the Edinburgh Speech Tools Library"> festival"> Festival"> fringe"> Fringe"> samba'> Cygwin'> Visual C++'> GNU make'> unix$' > C>' > festival>' > speech_tools/doc/speechtools.sgml0000644000076400007640000000471507262605664015666 0ustar awbawb %cstrDefs; %includeOnlyDefs; %sectionDefs; %declareExamples; %declareManuals; %declareDocpp; ]> Edinburgh Speech Tools Library System Documentation Edition &EDITION;, for &VERSION; &UPDATED; Paul Taylor Richard Caley Alan W. Black Simon King 1994-1999 Centre for Speech Technology, University of Edinburgh speech_tools/doc/estbaseclass.sgml0000644000076400007640000003723210045556420015776 0ustar awbawb Basic Classes Classes Container Classes &docpp-HashTables-3; &docpp-EST-IMatrix-3; &docpp-EST-TMatrix-3; &docpp-EST-FMatrix-3; &docpp-EST-TList-3; &docpp-EST-DVector-3; &docpp-EST-FVector-3; &docpp-EST-TSimpleVector-3; &docpp-EST-TVector-3; &docpp-EST-TrieNode-3; &docpp-EST-TDeque-3; &docpp-EST-TKVI-3; &docpp-EST-TKVL-3; &docpp-EST-TList-3; &docpp-EST-TMatrix-3; &docpp-EST-TSimpleVector-3; &docpp-EST-StringTrie-3; String Classes &docpp-EST-String-3; &docpp-EST-Token-3; &docpp-EST-Regex-3; Support Classes &docpp-EST-TStructIterator-3; &docpp-EST-TTI-Entry-3; &docpp-EST-THandle-3; &docpp-EST-Handleable-3; Example Code &listexamplesection; &matrixexamplesection; &kvlexamplesection; Tlist C++ Class TList is a generic template doubly-linked list class. See include/EST_TList.h . The list is made up of a a series of "items" of class Titem. Each of these has a value, val and a next and previous pointer. At present, the list uses a pointer to TBI to interate through the list class. The best way to iterate through the list is to use for loop style syntax. &docpp-EST-TList-2; Instansiation of <function>EST_TList</function> C++ does not have a standard for template instansiation which makes it difficult to arbitrarily define new template types. Within the speech_tools library new EST_TList template classes should be defined as follows. Suppose you have a class called Thing and you wish to make a EST_TList of it. Add to your file the following #if defined(INSTANTIATE_TEMPLATES) #include "../base_class/EST_TList.cc" template class EST_TList; #endif And add the name of that file to the make variable TSRCS in your Makeilfe Future Changes We hope this class has become stable though some more member functions may be added (e.g. sort etc.). KVL C++ Class KVL (short for Key/Value List) is a template class of a list of key/value pairs. There are two specifiable types for the KVL class, the key and the value, e.g. KVL produces a list of string pairs. KVL uses the TList class to actually store its data. KVL has much the same functionality as EST_TList, but has some additional features which make use easier. A crucial difference between a KVL and a normal list is that each key in the KVL is unique. include/KVL.h Member functions of <function>KVL</function> val (K key) This is the basic way of reading from the KVL. You give this function a key of type K and its returns a value. val (EST_TBI *p) You can iterate through the KVL in the same way as you do for TList. This function returns a value given the iteration pointer. val_def (K key, V def) Return "def" if "key" is not found. key (EST_TBI *p) returns the key for a given EST_TBI pointer. present (K k) returns 1 if key "k" is in the KVL, 0 otherwise. Useful for seeing whether a key has been defined. add_item (K k, V v, int ns). Add KV pair k,v to KVL. By default, the list is searched every time for an occurance of k and if k is already defined, its value is overwritten. However, if "ns" is set to 1, no searching of the list is performed, and the key value pair is merely appended. change_item (K k, V v, int ns) Overwrites existing value of k in KVL with v. If k isn't in the list, change_item (EST_TBI *p, V v) Overwrites existing value in KVL, accessed by pointer. In addition, the following overloaded operators are provided: = . Makes a full copy of the KVL and all its members. += . Adds a KVL to the end of an existing KVL. << . Print list. Examples of usage: KVL x; // declare key value list. EST_TBI *p; // declare iteration pointer. // read some values from standard input. while(cin) { cout << "type key then val\n"; cin >> k; cin >> v; x.add_item(k, v); } // is vkey "9" in list? cout << (x.present(9) ? "true" : "false") << endl; for (p = x.list.head(); p != 0; p = next(p)) // iterate through list. cout << x.key(p) << " " << x.val(p); //print out all keys and values in list. Option C++ Class The EST_Option class provides a uniform way to access options in a program. The most obvious source of options are from the command line. The function parse_command_line2(...) takes the C command line variables (argc,argv) and produces an EST_Option class. Specifically it allows options names value tpyes, defaults and documentation for opntions in a program. The EST_Options class is derived from @code{KVL}, so all the KVL member functions also work with EST_Option. It provides some useful extra functionality. Member functions of <function>EST_Option</function> All the options are stored as key value pairs of EST_Strings. However, it if often useful to have other types, e.g. integers. This is possible, but it is the EST_String of the integer that is actually stored. Additional member functions, e.g. add_item() do the conversion automatically. The member functions ival(const EST_String &key) will return the value as an ineger and fval(const EST_String &key) as a float. File i/o It is sometimes convenient to store options in files, and the options class supports a system where there is one. There is one key/value pair per line. Lines can be commented by starting them with the comment character (by default this is ";", but this can be set using the load() function). Each line must start with the key. The remainder, which may appear as a list in the file, is taken as the value. Option files can be included in other option files by using the #include filename directive. If a particular key appears more than once when loading, the value of the last occurance is used. Files are loaded using the load(...) function. The first argument to this is the file name, and the second (optional) argument is the comment character. The load function merely appends to the existing options (while overriding the values of duplicate keys) - if an entirely new set of options are to be loadedcall the clear() member function first. The EST_Option class inherits the member functions of the KVL class. In addition, the following exist: add_prefix(EST_String p) Adds a prefix "p" to all keys in the list. remove_prefix(EST_String p) removes a prefix "p" from all keys in the list. override_val(EST_String key, EST_String val). If val is not empty, add keyval pair to option list. override_ival (EST_String key, int val) If val is not 0, add keyval pair to option list. override_fval (EST_String key, float val) If val is not 0.0, add keyval pair to option list. ival(EST_String rkey) return value of key, cast to an integer. fval(EST_String rkey) return value of key, cast to an float. dval(EST_String rkey) return value of key, cast to an double. add_iitem(EST_String key, int val) add integer value to list. add_fitem(EST_String key, float val) add float value to list. EST_TVector A simple vector class is provided for. Member functions are given in include/EST_TVector.h. EST_TMatrix The EST_TMatrix class allows the creation of standard matrices. See include/EST_TMatrix.h for member functions. There is a derive class EST_FMatrix for floats, the derivation is used rather than a simple template to allow loading and saving to files. EST_Chunk The EST_Chunk classes offers a reference counting system for arbitrary segments of memory. This is primarily used by the EST_String class. EST_String This class was written for a number of reasons. It offers a string class functionally identical to the GNU libg++ String class. We choose to write our own string class rather than use the one provided with GNU G++ for the following reasons. The String class in libg++ is different in different versions and causes lots of confusion when compiling the system with different versions of libg++. If we depended of the GNU String class we must provide libg++ on all platforms we compile the system on. This and the Regex class are the only classes we relied on, by writing our one we all much greater portability. The GNU String class typcially copies string values around while our replacement uses reference counts. Because of the way we use strings in the speech tools and Festival keeping track of reference counting allows a much more efficient implementation of strings. Thus our replacement string class is faster for substantial benchmarks of Festival than the GNU equivalent. The member functions of EST_String follow that of the GNU libg++ String class as closely as possible (we designed it for a drop in replacement of our current use of String). EST_Regex As we wished to remove our dependence on GNU libg++ as described in the previosu section we have provided a regular expression class which for the most part follows that of the GNU libg++ Regex class. This implementation uses the regex functions from BSD4.4-lite (and earlier) written by Henry Spencer. EST_TNamedEnum A class which relates names (EST_String) to enums. EST_StringTrie EST_StringTrie builds a tree index from string keys to arbiitrary objects. Thus objects may be index effciently from strings. The strings must be ascii (the eighth bit is ignored). For example the following builds an index of regular expressions based on their character form so that they need not be recompiled. EST_StringTrie regexes; EST_Regex *make_regex(const char *r) { // Access previously generated Regex or make new one // and add to index EST_Regex *rx; if ((rx = (EST_Regex *)regexes.lookup(r)) == 0) { EST_Regex *nr = new EST_Regex(r); regexes.add(r,(void *)nr); rx = nr; } return rx; } A StringTrie may be explicited clear with the function clear(). The contents of the string tree make cleared by passing a garabage collection function with clear() which will be poassed each item in the trie as a void *. The type of the user provided garbage collection function is void (*deletecontents)(void *n); EST_Token and EST_TokenStream EST_Token with EST_TokenStream provides a method for reading files as whitespace separated tokens. A token consists of four parts, some of which may be empty: a name, the actual token, preceding whitespace, preceding punctuation, the name and succeeding punctuation. The definitions of whitespace and punctuation are user definable. There is also support for single character symbols and quoted tokens. A token stream from which tokens may be gotten, may be a file or a string. For example the follow reads a file and output each toke on a new line EST_TokenStream ts; EST_Token; ts.open("myfile"); while (!ts.eof()) cout << ts.get() << endl; Although token streams support on symbol look ahead via peek() they do support unget. Punctuation (pre and post) may be set after opening a stream. The defaults are empty. Any characters defined as punctuation found around a token are striped and saved in the punctuation fields. Single character symbols will cause a token break when ever they occur (i.e. separating whitespace is not required), again by default these are empty. Whitespace by default is defined as space, horizontal tab, carriage return and line feed. Quoting mode is off by default but may be started by calling set_quotes with a quote character and an escape character (typically " and \). When in quote mode, a token starting with the quote character will continue until next unescaped quote character, including whitespace and punctuation. Although a whole file's contents including all its whitespace may be recorded by tokens from a token stream, any final whitespace after the last real token may be mistakenly omitted unless care is taken. In many cases you'll just require the final whitespace before end of file to set end of file which is the default. In quotes mode all tokens include this last token with an empty name will be returned before eof is set. ]]> speech_tools/doc/estexec.sgml0000644000076400007640000001113010045556420014747 0ustar awbawb Executable Programs General Information Edinburgh Speech Tools provides a set of exectutables, which offer access to speech tools functionality in the form of a stand alone program. As far as possible, the programs follow a common format in terms of assumptions, defaults and processing paradigms. The following are generally true of most speech tools programs. Arguments to functions can be specified in any order on the command line. Most programs can take multiple input files, which by default have no preceding argument. Output by defgault is to standard out. The -o flag can be used to specify an output file. Often programs can read many formats of input file. Wherever possible, this is done automatically. If this can't be done, the -itype flag can be used to specify the input file format. The output file format is specified by -otype Building your own executable programs A simple mechanism is provided for doing all the configuration needed to build a executable program which uses the speech tools library. First, make a directory which will hold your program. To make a program called "do_stuff", type est_program do_stuff if you haven't got the EST bin directory in your path you will have to add the path explicitly, e.g. /speech_tools/bin/est_program do_stuff This will create a Makefile and a .cc file called do_stuff_main.cc, which will look something like this: #include "EST.h" #include "EST_types.h" #include "EST_error.h" int main(int argc, char *argv[]) { EST_StrList files; // the list of input files will go here EST_Option cmd_line; // the parsed list of command line arguments // will go here. // This bit parses the command line args and puts them into // files and cmd_line parse_command_line (argc, argv, EST_String("[OPTIONS] [files...]\n")+ "Summary; DO SOMETHING\n"+ "-o [ofile] Ouptut file\n", files, cmd_line); EST_String out_file; // the name of the output file // If a output file has been specified using -o, put it in out_file if (cmd_line.present("-o")) out_file = cmd_line.val("-o"); else EST_error("No output file specified"); // declare EST_StrList iterator EST_StrList::Entries fs; // iterate through files and do something. for(fs.begin(files); fs; ++fs) { EST_String file = *fs; // Process file } return 0; } You can now add any C++ code to this, and compile by typing make. If you want to create a second program in the same directory, type the same again: /speech_tools/bin/est_program do_more_stuff This time, do_more_stuff_main.cc will be created and the appropriate build commands added to the extisting Makefile. If you wish to add an extra .cc file to particular program, simply edit the Makefile and add it on the line: do_stuff_CXXSRC= do_stuff.cc extra.cc &chwavemanualsection; &chtrackmanualsection; &chlabmanualsection; &tiltanalysismanualsection; &tiltsynthesismanualsection; &sigfvmanualsection; &spectgenmanualsection; &sigfiltermanualsection; &designfiltermanualsection; &pdamanualsection; &pitchmarkmanualsection; &dpmanualsection; &ngrambuildmanualsection; &ngramtestmanualsection; &viterbimanualsection; &naplaymanualsection; &narecordmanualsection; &wagonmanualsection; &olsmanualsection; &olstestmanualsection; &wfstbuildmanualsection; &wfstbuildmanualsection; &wfstrunmanualsection; &scfgmakemanualsection; &scfgtrainmanualsection; &scfgparsemanualsection; &scfgtestmanualsection; &siodmanualsection; &fringe_clientmanualsection; &bcatmanualsection; &xmlparsermanualsection; speech_tools/doc/estgram.sgml0000644000076400007640000005075210045556420014766 0ustar awbawb Grammar Overview To aid speech recognition and general text processing the speech tools library provides an number of techniques to process various types of grammars. These consist of a continuing expanding set of class and related programs. These are at various levels of development but all have fairly stable and working basic features. N-grams Ngram language models are supported by the EST_Ngrammar class, and associated routines and programs. Support is provided for building. tuning, smoothing and running n-gram models. N-grams themselves have been can be internally stored in either a dense or sparse. In the dense case all possible states are represented with probability distributions, while the sparece case only has those possible states for with data is available. Sparse will be much smaller in very large cases. However we consider the dense case to be the most fully developed. Formally n-grams can be views as a special case of weighted finite state machines. Our implementation reflects that where possible (backoff options break this simple view), thus a start state is provided and traversal operation are given. This method of using n-grams is by far the most efficient as only one new piece of information is required at each stage, so no vectors of tokens need be collected (or shifted) and presented to n-gram class. However as this finite state machine view can't always be reasonable used we also support access through a vector of tokens. Building ngram language models The program ngram_build estimates ngram language models from data. The data can be in a number of formats and be saved in both an ascii (easier for humans to read) and binary (quick to load) format. Vocabularies The vocabulary of an ngram must be predefined. This is required to allow efficient internal representation. This implementation supports two vocabularies, one for the n-1 tokens in an ngram and one for the nth token as potentially this "predictee" could be from a different class. We also support the notion of out of vocabulary word, so any token found in the input data that is not in the vocabulary may be mapped to that token. In build n-grams there are options on what to do with n-grams which contain out of vocabulary tokens. They may be mapped to te specifed out of vocabulary word, the ngram can be ignored or the whole sentence containing the out of vocabulary word can be ignored. ngram data input formats The input data can be in a number of formats depending on how much preprocessing you wish to do before building. The most basic form is to submit n-grams. That is n tokens, on each line. For example for a tri-gram model of phones it might look like 0 # a1 # a1 f a1 f r f r i r i k i k aa1 k aa1 n aa1 n @ In this case the data preparation stage most create each n-gram with the sigle stepping through the data at each stage. This format we call ngram_per_line A second format is sentence_per_line where each line of a file is a complete "sentence". Ngrams for each n-tuple will be automatically created and cumulated. In this case the input file might look like a1 f r i k aa1 n @ ei1 b r @ h a m In this mode, ngrams for the tokens at start of the sentence are created by using the token by defining a prev_tag (and if necessary a prev_prev_tag). Thus given the above sentence by line file, a prev_tag of "#" and a prev_prev_tag of "0". The first few tri-grams cumulated are 0 # a1 # a1 f a1 f r If the ngram size requires looking back further the prev_prev_tag is repeat indefinitely. Likewise an end_tag is appended to the end of every sentence too, (i.e. end of every line). A third data input format is sentence_per_file where line breaks are no longer signficant and n-grams are create for all n-tuples in the file. The same special cases are treated for beginning and end of file as are for beginning and end of line in the sentence_per_line case. Smoothing and Backoff We support a number of different techniques to deal with lack of data in a training set. Good Turing smoothing Church and Gale 1991 is supported allowing smoothing on n-grams whose frequency is less than M. We also support backoff where the n-1 grams are (recursively) built to provide an estimation of probability distributions for unseen n-grams. Testing ngram language models ngram_test computes language model entropy/perplexity on test data. The test data may be in any of the formats described above. SCFGs Stochastic context-free grammars are a version of context-free grammars with probabilities on rules. In this implementation we assume SCFGs are always in Chomsky Normal From (CNF) where rules may only be binary or unary branching. When binary, both daughters must be non-terminals and when unary, the daughter must be a terminal. The implementation here is primarily based on Pereira and Schabes 92 thus allowing unsupervised training of SCFGs as well as allowing seeding with a bracketed corpus which can vastly reduce training time, and improve results. Training uses the inside-outside algorithm. The support is split into four parts: making grammars, training grammars, testing grammars and parsing. A grammar file consists of a set of rules. Each rule is a bracketed list of probability, nonterminal, followed by two nonterminals or one terminal. A simple example is (0.5 S A D) (0.5 S C B) (0.79 B S C) (0.21 B a) (0.79 D S A) (0.21 D b) (1 A b) (1 C a) The mother non-terminal in the first rule is the distinguished symbol. Grammars may be constructed by hand, by the program scfg_make or by some other external process. The program scfg_make constructs a full grammar given a list (or number of) terminals and nonterminals. The rules can be assigned equal probabilities or random ones. The "probabilities" may be actual probabilities or log probabilties. For example given a file wp19 with a list of terminals, a grammar suitable for training with 15 non-terminals may be created by the command scfg_make -nonterms 15 -terms wp19 -domain prob \ -values random -o wsj_15_19.gram The non-terminals or terminal names will be automatically generated if a number is given, or will be as specified if a file name is given. In the case of a filename being given, no brackets should be the file just whitespace separated tokens. A corpus consists of a number of sentences, each sentence must be contain within a set of parenthesis. The sentences themselves may additionally contain further bracketing (for training and testing). Each sentence is read by the Lisp reader so comments (semi-colon to end of file) may be included. For example ((((n n) punc ((cd n) j) punc) (md (v (dt n) (in (dt j n)) (n cd))) punc)) (((n n) (v ((n) (in ((n n) punc (dt n v n))))) punc)) ((((n n) punc (((cd n) j) cc ((j n) (in (n n n n)))) punc) (v (v (((dt j n) (in (dt j j n)))))) punc)) ... Training is done by estimating the inside and outside probabilities of the rules based on their current probabilities and a corpus. The corpus may optionally include internal bracketing which is used by the training algorithm to precluded some possible parses hence making the training typically faster (and sometimes more accurate). After each training pass the grammar rule probabilities are updated and the process starts again. Note depending on the number of training sentences training passes may take a very long time. After each passes the cross entropy for the current version of the grammar is printed. This should normally decrease until the the "best" grammar has been found. The program scfg_train takes an initial grammar, and corpus and, by default will train for 100 passes. Because it can take prohibitively long for a desired number of passes an option is available to selection only an N percent chunk of the training set on each pass, cycling through the other N percent chunks of the corpus on each pass Experiments have shown that this not only produces much faster training, but the accuracy of the fully trained grammar is very similar. Given the choice of waiting taking 10 days or 48 hours to parse, it is highly recommended. After each N passes the current state of the grammar may be saved, the number of passes between saving is specified by the -checkpoint option. The grammar is saved in the output file appended with the pass number. Because the partitioned training will select different partitions depending on the pass number you can optionally specify the starting pass number, making it much easier to continue training after some interruption. Testing is done by the program scfg_test it takes a grammar and a corpus. That corpus may be fully bracketed or not. By default the mean cross entropy value from anaylzing these senetences will be printed, also the number sentence sthat fail to parse. Alternatively a bracketing accuracy may be calculated this is the percentage of prhases in a parsed sentence that are compatible with the bracketing in the corpus example. The fourth program provides a mechanism for parsing one or more sentences. The corpus this time should contain no bracketing except around the beginning and end of the sentence itself. Two forms of parses are produced. A full form with start and end points for each phrase, the related non-terminal and the probability, and a simple form where only the bracketing is given. Note only one (or no) parses is given. For any phrase only the best example tree is given though the probability is given as the sum of all possibily derivations of that non-terminal for that phrase. scfg_parse -grammar wsj_15_19.gram -corpus news.data -brackets -o news.out Note the input for must be strings of terminals for the given grammar. For real parsing of real text it is likely the grmmar uses part of speech tags as terminals and the data is avtuall words not part of speech tags. If you want to parse texts then you can use the Festival script festival/examples/scfg_parse_text which takes in arbitrary text, runs the part of speech tagger on it after standard tokenizing rules and parses the output saving the parse to the specified file. WFSTs The speech tools contains a small, but growing library of basic functions for building, and manipulating weighted finite state transducers. Although not complete they already provided many of the basic operations and compilers one needs for using these devices. Given a WFST the following operations are supported: deterimise, minimize, complement. Given two WFSTs the following operations are supported: intersection, union, difference, concatenation and compose. In addition to these operations compiles are provided for a number of basic input formats: regular expressions, regular grammars, context-free grammars (with depth restriction) and Kay/Kaplan/Koksenniemi two-level morphology rules. Still missing are complete treatment of the weights through some basic operations (e.g. minimization doesn't presever weights). Also techniques for learning WFSTs from data, or at least weightign existing FSTs from data will be added in later versions. In general inputing symbols is of the form X or X/Y. When X is given it is (except if using the wfst as a transducer) treated as X/X. Where X/Y is input/output symbols, thus using single symbols will mostly cause the wfst mechanisms to act as if they are finite state machines. The two main programs are wfst_build and wfst_run. wfst_run runs in both recognition and transduction mode. wfst_build builds wfst's from description files or through combination of existing ones. The output may be optionally determinized or determinized and minimized. Kay/Kaplan/Koskenniemi morphological rules One of the major drives in interest in wfst has been through their use in morphology @cite{kaplan94}. Hence we provide a method for compiling Kay/Kaplan/Koskenniemi type (restricted) context sensitive rewrite rules. The exact form is given in the example below. This example covers basic letters to letters but also Epenthesis for e-insertion in words like churches and boxes. (KKrules engmorph (Alphabets ;; Input Alphabet (a b c d e f g h i j k l m n o p q r s t u v w x y z #) ;; Output Alphabet (a b c d e f g h i j k l m n o p q r s t u v w x y z + #) ) (Sets (LET a b c d e f g h i j k l m n o p q r s t u v w x y z) ) (Rules ;; The basic rules ( a => nil --- nil) ( b => nil --- nil) ( c => nil --- nil) ( d => nil --- nil) ( e => nil --- nil) ( f => nil --- nil) ( g => nil --- nil) ( h => nil --- nil) ( i => nil --- nil) ( j => nil --- nil) ( k => nil --- nil) ( l => nil --- nil) ( m => nil --- nil) ( n => nil --- nil) ( o => nil --- nil) ( p => nil --- nil) ( q => nil --- nil) ( r => nil --- nil) ( s => nil --- nil) ( t => nil --- nil) ( u => nil --- nil) ( v => nil --- nil) ( w => nil --- nil) ( x => nil --- nil) ( y => nil --- nil) ( z => nil --- nil) ( # => nil --- nil) ( _epsilon_/+ => (or LET _epsilon_/e) --- nil) ;; Epenthesis ;; churches -> church+s ;; boxes -> box+s (e/+ <=> (or (s h) (or s x z) (i/y) (c h)) --- (s)) ) A substantially larger example of morphographenic rules is distributed with the Festival speech synthesis system in festival/lib/engmorph.scm. This is based on the English description in @cite{ritchie92}. For a definition of the semantics fo the basic types of rule, surface coercion, context restriction and combined rules see @cite{ritchie92}. Note that these rules are run in parallel (the transducers are intersected) making they rule interact in ways that the author might not intend. A good rule debugger is really required in order to write a substantial set of rules in this formalism. The rule compilation method used differs from Kay and Kaplan, and also from @cite{mohri96} and actually follows them method used in @cite{ritchie92} though in this case, unlike @cite{ritchie92}, the technique is followed through to true wfst's. The actual compilation method shold be described somewhere. The above may be compiled into a wfst by the command (assuming it is in the file mm.rules. wfst_build -type kk -o engmorph.wfst -detmin engmorph.scm This rule compiler has also been used in finding equivalent transducers for restricted forms of decision tree (following @cite{sproat96}) and may be view as mostly stable. Regular expressions A simple method for building wfst's from regular expressions is also provided. An example is ((a b c) (a b c) (and a (+ (or b c)) d)) This consists of the input alphabet and the output alphabet followed by a LISP s-expression contains the regex. The supported operators are and, or, +, * and not. Compilation is by the following command wfst_build -type regex -o t1.wfst -detmin t1.regex Regular Grammars A compilation method also exists for regular grammars. These grammars do not need to be a normal form, in fact no chaeck is made that they are regular, if they contain center-embedding the construct algorithm will go into a loop and eventually run out of storage. The correction to that is to add a depth limit which would then allow wfst approximations of context-free grammars, which would be useful. An example regular grammar is (RegularGrammar engsuffixmorphosyntax ;; Sets ( (V a e i o u y) (C b c d f g h j k l m n p q r s t v w x y z) ) ;; Rules ( ;; A word *must* have a suffix to be recognized (Word -> # Syls Suffix ) (Word -> # Syls End ) ;; This matches any string of characters that contains at least one vowel (Syls -> Syl Syls ) (Syls -> Syl ) (Syl -> Cs V Cs ) (Cs -> C Cs ) (Cs -> ) (Suffix -> VerbSuffix ) (Suffix -> NounSuffix ) (Suffix -> AdjSuffix ) (VerbSuffix -> VerbFinal End ) (VerbSuffix -> VerbtoNoun NounSuffix ) (VerbSuffix -> VerbtoNoun End ) (VerbSuffix -> VerbtoAdj AdjSuffix ) (VerbSuffix -> VerbtoAdj End ) (NounSuffix -> NounFinal End ) (NounSuffix -> NountoNoun NounSuffix ) (NounSuffix -> NountoNoun End ) (NounSuffix -> NountoAdj AdjSuffix ) (NounSuffix -> NountoAdj End ) (NounSuffix -> NountoVerb VerbSuffix ) (NounSuffix -> NountoVerb End ) (AdjSuffix -> AdjFinal End ) (AdjSuffix -> AdjtoAdj AdjSuffix) (AdjSuffix -> AdjtoAdj End) (AdjSuffix -> AdjtoAdv End) ;; isn't any Adv to anything (End -> # ) ;; word boundary symbol *always* present (VerbFinal -> + e d) (VerbFinal -> + i n g) (VerbFinal -> + s) (VerbtoNoun -> + e r) (VerbtoNoun -> + e s s) (VerbtoNoun -> + a t i o n) (VerbtoNoun -> + i n g) (VerbtoNoun -> + m e n t) (VerbtoAdj -> + a b l e) (NounFinal -> + s) (NountoNoun -> + i s m) (NountoNoun -> + i s t) (NountoNoun -> + s h i p) (NountoAdj -> + l i k e) (NountoAdj -> + l e s s) (NountoAdj -> + i s h) (NountoAdj -> + o u s) (NountoVerb -> + i f y) (NountoVerb -> + i s e) (NountoVerb -> + i z e) (AdjFinal -> + e r) (AdjFinal -> + e s t) (AdjtoAdj -> + i s h) (AdjtoAdv -> + l y) (AdjtoNoun -> + n e s s) (AdjtoVerb -> + i s e) (AdjtoVerb -> + i z e) ) ) The above is a simple morpho-syntax for English. Programs The following are exectutable programs for grammars <link linkend="scfg-make-manual">scfg_make</link> make a set of rules for a SCFG. <link linkend="scfg-train-manual">scfg_train</link> make a set of rules for a SCFG. <link linkend="scfg-parse-manual">scfg_parse</link> train a set of rules for a SCFG. <link linkend="scfg-test-manual">scfg_test</link> Perform parsing using pre-trained grammar. <link linkend="wfst-build-manual">wfst_build</link> Build a weighted finite state transducer. <link linkend="wfst-run-manual">wfst_run</link> Run a weighted finite state transducer. <link linkend="ngram-build-manual">ngram_build</link> Train a n-gram from text. <link linkend="ngram-test-manual">ngram_test</link> Caldulate the perplexity etc of an n-gram. Classes &docpp-EST-SCFG-2; &docpp-EST-SCFG-Rule-2; &docpp-EST-SCFG-traintest-2; &docpp-EST-bracketed_string-2; &docpp-EST-Ngrammar-2; &docpp-EST-WFST-2; speech_tools/doc/estxml.sgml0000644000076400007640000002354610045556420014641 0ustar awbawb &xml; Support There are three levels of support for &xml; with &est;. Loading as an Utterance A built in &xml; parser allows text marked up according to an &xml; DTD to be read into an EST_Utterance (see ). XML_Parser_Class A &cpp; class XML_Parser_Class (see The documentation for that class) which makes it relatively simple to write specialised &xml; processing code. RXP The RXP XML parser is included and can be used directly(). Reading &xml; Text As An <classname>EST_Utterance</classname> In order to read &xml; marked up text, the &est; code must be told how the &xml; markup should relate to the utterance structure. This is done by annotating the DTD using which the text is processed. There are two possible ways to anotate the DTD. Either a new DTD can be created with the anotations added, or the anotations can be included in the &xml; file. A new DTD To write a new DTD based on an existing one, you should include the existing one as follows: <!-- Extended FooBar DTD for speech tools --> <!-- Include original FooBar DTD --> <!ENTITY % OldFooBarDTD PUBLIC "//Foo//DTD Bar" "http://www.foo.org/dtds/org.dtd"> %OldFooBarDTD; <!-- Your extensions, for instance... --> <!-- syn-node elements are nodes in the Syntax relation --> <!ATTLIST syn-node relationNode CDATA #FIXED "Syntax" > In the &xml; file Extensions to the DTD can be included in the !DOCTYPE declaration in the marked up text. For instance: <?xml version='1.0'?> <!DOCTYPE utterance PUBLIC "//Foo//DTD Bar" "http://www.foo.org/dtds/org.dtd" [ <!-- Item elements are nodes in the Syntax relation --> <!ATTLIST item relationNode CDATA #FIXED "Syntax" > ]> <utterance> <!-- Actual markup starts here --> Summary of DTD Anotations The following attributes may be added to elements in your DTD to describe it's relation to EST_Utterance structures. estUttFeats The value should be a comma separated list of attributes which should be set as features on the utterance. Each attribute can be either a simple identifier, or two identifiers separated by :. A value foo:bar causes the value of the foo attribute of the element to be set as the value of the Utterance feature bar. A simple identifier foo causes the foo attribute of the element to be set as the value of the Utterance feature X_foo where X is the name of the element. estRelationFeat The value should be a comma separated list of attributes which should be set as features on the relation related to this element. It's format and meaning is the same as for estUttFeats. estRelationElementAttr Indicates that this element defines a relation. All elements inside this one will be made nodes in the relation, unless they are explicitly marked to be ignored by estRelationIgnore. The value of the estRelationElementAttr attribute is the name of an attribute which gives the name of the relation. estRelationTypeAttr When an element has a estRelationElementAttr tag to indicate it's content defines a relaion, it may also have the estRelationTypeAttr tag. This gives the name of an attribute which gives the type of relation. Currently only a type of `list' or `linear' gives a lienar relation, anything else gives a tree. estRelationIgnore If this is set to any value on an element which would otherwise be interpreted as an EST_Item in the current relation, the element is passed over. The contents will be processed as if they had been directly inside this element's parent. estRelationNode When placed on an element, indicates that this element is to be interpreted as an item in the relation named in the value of the attribute. estExpansion The value of this attribute defines how ranges in href attributes are expanded for this element. If the value is replace the nodes created during expansion are placed at the same level in the hierachy as the original element. If the value is embed they are created as children of a new node. estContentFeature The value of this attribute is the featre which is set to the contents of the current element. The <classname>XML_Parser_Class</classname> &cpp; Class The &cpp; class XML_Parser_Class (declared in rxp/XML_Parser.h) defines an abstract interface to the &xml; parsing process. By breating a cub-class of XML_Parser_Class you can create code to read &xml; marked up text quite simply. Some Definitions An &xml; parser is an object which can analyse a piece of text marked up according to an &xml; doctype and perform actions based on the markup. One &xml; parser deals with one text. An &xml; parser is represented by an instance of the class XML_Parser. An &xml parser class is an object from which &xml parses can be created. It defines the behaviour of the parsers when they process their assigned text, and also a mapping from &xml; entity IDs to places to look for them. An &xml; parser class is represented by an instance of XML_Parser_Class or a subclass of XML_Parser_Class. Creating An &xml; Processing Procedure In order to create a procedure which will process &xml; marked up text in the manner of your choice you need to do 4 things. Simple examples can be found in testsuite/xml_example.cc and main/xml_parser_main.cc Create a Sub-Class of <classname>XML_Parser_Class</classname> Create a Structure Holding the State of the Parse Decide How Entity IDs Should Be Converted To Filenames Write A Procedure To Start The Parser The <classname>XML_Parser_Class</classname> in Detail</classname> &docpp-XMLParser-3; The <productname>RXP</productname> &xml; Parser Included in the &est; library is a version of the RXP &xml; parser. This version is limited to 8-bit characters for consistency with the rest of &est;. For more details, see the RXP documentation. Insert reference to RXP documentation here. speech_tools/doc/estserver.sgml0000644000076400007640000003460610045556420015346 0ustar awbawb Client-Server Mechanisms The &cpp; class EST_Server provides the core mechanisms required for simple client-server applications. It is currently used to implement the fringe_client program and client-server mechanisms for SIOD. It is planned to use it to re-implement the festival client-server mechanism. Servers have types and names. When a server is started it records it's type, name and location in a `services' file. When a client wishes to connect to a server it looks for it's location in that file by giving a name and type. Once connected a client must present a magic cookie to the server as a simple form of authentication. Once authenticated the client sends requests, consisting of a package name, operation name and a set of arguments, to the server. The server responds with an error report or a sequence of values. An instance of EST_Server embodies each side of the client-server relationship. In the server an instance of EST_Server is created and told how to process requests from clients, a call to the run() method then starts the server. In a client an instance of EST_Server represents the server, and calls to the execute(...) method send requests to the server. The Services Table The first problem which needs to be addressed by any client-server system is how the client finds the server. Servers based on EST_Server handle this problem by writing a record into a file giving their name, type and location. Clients can then look servers up by namd and type. By default the file .estServices is used for this purpose, meaning that each user has their own list of servers. An alternative file could be specified to record public services. The services table also provides a simple authorisation mechanism. Each server records a random string in the table, and clients must send this string before making any requests. Thus people who can't read the services table can't make requests of the server, and the file permissions on the services table can be used to control access to the server. This `magic cookie' authorisation scheme is not very secure. The cookie is sent as plain text over the network and so anyone who can snoop on the network can break the security. A more secure `challange-responce' authorisation scheme should be implemented. The in-file format of the services table is based on the &java; properties file format. A typical file might look as follows: #Services fringe.type=fringe fringe.host=foo.bar.com fringe.cookie=511341634 fringe.port=56362 fringe.address=123.456.789.654 siod.type=siod siod.cookie=492588950 siod.host=foo.bar.com siod.address=123.456.789.654 siod.port=56382 labeling.type=fringe labeling.host=foo.bar.com labeling.cookie=511341634 labeling.port=56362 labeling.address=123.456.789.654 This file lists three services, a fringe server with the default name of fringe, a scheme interpreter running as a server, also with the default name, and a second fringe server named labeling. The programing interface to the services table is provided by the EST_ServiceTable class. &docpp-EST-ServiceTable-2; Writing Clients and Servers If a service type (that is a sub-class of EST_Server) has already been defined for the job you need to do, creating clients and servers is quite straight forward. For this section I will use the EST_SiodServer class, which defines a simple &scheme; execution service service, as an example. A Simple Server To run a siod server we have to read the server table, create the server object and update the table, then start the service running. First we read the default service table. EST_ServiceTable::read(); Now we create the new scheme service called "mySiod". The EST_Server::sm_sequential parameter to the server constructor tells the server todeal with one client at a time. The NULL turns off trace output, replace this with &cout to see what the server is doing. EST_SiodServer *server = new EST_SiodServer(EST_Server::sm_sequential, "mySiod", NULL); Write the table back out so clients can find us. EST_ServiceTable::write(); Create the object which handles the client requests. The handler object actually does the work the client requests. EST_SiodServer provides the obvious default handler (it executes the scheme code and returns the results), so we use that. EST_SiodServer::RequestHandler handler; Finally, start the service. This call never returns. server->run(handler); A Simple Client A client is created by reading the service table, and then asking for a server by name. Again the NULL means `no trace output'. EST_ServiceTable::read(); EST_SiodServer *server = new EST_SiodServer("mySiod", NULL); Now we have a representation of the server we must connect before we can do anything. We can connect and dissconnect a server object any number of times over it's life. This may or may not have some meaning to the server. The return value of the connect operation tells us if we managed to connect. if (server->connect() != connect_ok) EST_sys_error("Error Connecting"); Once we are connected we can send requests to the server. The siod server executes scheme for us, assume that the function get_sexp() returns something we want evaluated. LISP expression = get_sexp(); We pass arguments to requests in an Args structure, a special type of EST_Features. The sod server wants the expression to execute as the value of "sexp". EST_SiodServer::Args args; args.set_val("sexp", est_val(expression)); As in the server, the behaviour of the client is defined by a `handler' object. The handler EST_SiodServer defines for us does nothing with the result, leaving it for us to deal with in the EST_Features structure handler.res. Again this is good enough for us. EST_SiodServer::ResultHandler handler; Finally we are ready to send the request to the server. The siod server provides only one operation, called "eval" in package "scheme", this is the evaluate-expression operation we want. The return value of execute(...) is true of everything goes OK, false for an error. For an error the message is the value of "ERROR". if (!server->execute("scheme", "eval", args, handler)) EST_error("error from siod server '%s'", (const char *)handler.res.String("ERROR")); Now we can get the result of the evaluation, it is returned as the value of "sexp". LISP result = scheme(handler.res.Val("sexp")); Although this may seem a lot of work just to evaluate one expression, once a connection is established, only the three steps set arguments, execute, extract results need to be done for each request. So the following would be the code for a single request: args.set_val("sexp", est_val(expression)); if (!server->execute("scheme", "eval", args, handler)) [handle error] LISP result = scheme(handler.res.Val("sexp")); A Specialised Server If you need to create a server similar to an existing one but which handles requests slightly differently, all you need to do is define your own RequestHandler class. This class has a member function called process() which deos the work. Here is a variant on the siod server which handles a new operation "print" which evaluates an expression and prints the result to standard output as well as retruning it. (In this example some details of error catching and so on necessary for dealing with scheme are omitted so as not to obscure the main points). First we define the handler class. It is a sub-class of the default handler for siod servers. class MyRequestHandler : public EST_SiodServer::RequestHandler { public: virtual EST_String process(void); }; Now, we define the processing method. For any operation other than "print" we call the default siod handler. (leval and lprint are functions provided by the siod interpreter). EST_String MyRequestHandler::process(void) { if (operation == "print") { // Get the expression. LISP sexp = scheme(args.Val("sexp")); // Evaluate it. LISP result = leval(sexp, current_env); // Print it. lprint(result); // Return it. res.set_val("sexp", est_val(result)); return ""; } else // Let the default handler deal with other operations. return EST_SiodServer::RequestHandler::process(); } And now we can start a server which understands the new operation. MyRequestHandler handler; server->run(handler); A Client Which Handles Multiple Results Servers have the option to return more than one value for a single request. This can be used to return the results of a request a piece at a time as they become available, for instance &festival; returns a waveform for each sentence in a piece of text it is given to synthesise. Clearly a simple client of the kind described above which gets the result of a request as a result of the call to execute(...) can't handle multiple results of this kind. This is what the handler object is for. I'll asuume we need a client to deal with a variant on the normal siod sever which returns multiple values, say it evaluates the expression in each of a number of environments and returns each result separately. I'll also assume that the work to be done for each result is defined by the fucntion deal_with_result(). Most of the client will be the same as for the simple client, the exception is that we use our own result handler rather than the default one. class MyResultHandler : public EST_SiodServer::ResultHandler { public: virtual void process(void); }; As for the server's request handler, the beahviour of the result handler is defeined by the process() method of the handler. EST_String MyResultHandler::process(void) { // Get the result. LISP result = scheme(handler.res.Val("sexp")); // And deal with it. deal_with_result(result); } With this definition in place we can make requests to the server as follows. MyResultHandler handler; if (!server->execute("scheme", "multi-eval", args, handler)) [handle errors] The deal_with_result() function will be called on each result which is returned. If anything special needs to be done with the final value, it can be done after the call to execute(...) as in the simple client example. Creating a new Service Commands Results The Network Protocol speech_tools/doc/estjavaapp.sgml0000644000076400007640000001530607262605664015472 0ustar awbawb Shared Libraries and GCC Whys and Wherefores On Solaris, and perhaps some other systems, the GCC distribution does not build or install shared libraries for some C and C++ support code by default. This doesn't cause problems building the speech tools with shared libraries for normal use as the system is capable of running programs built with a combination of shared and non-shared libraries. However, when loading code into Java, all the support needed must be in shared libraries. For our purposes, what is needed is shared versions of libgcc, which is part of the normal gcc distribution, and libstdc++, which is part of the libg++ distribution. You may have a shared version of libstdc++ (called libstdc++.so.SOMETHING) if so ignore the related instructions below. The following steps are those I followed to build these libraries on Solaris 2.5 for use with gcc 2.7.2.1. These instructions should work for other GCC versions, replace 2.7.2 in all cases with the version number for your GCC - you can find this by running &shellprompt; gcc -v and ignoring the last digit of the version. You should probably do the following tasks on the oldest operating system version you want to use. For instance we have Solaris 5.5 and 5.6 machines, so I built my libraries on a 5.5 one. What You Need The gcc distribution. The libg++ distribution I used the GCC distribution version 2.7.2.3 and the libg++ version 2.7.2, these being the most up to date distributions related to gcc 2.7.2 available at the time. Building libgcc.so If you don't already have GCC installed, it's probably best to do a normal GCC compilation and installation before messing about. When you have done this do &shellprompt; make clean in the gcc compilation directory to make sure there are no hang-overs. If you have GCC around already, you need to either find the directory where it was built or unpack the distribution to get a build directory. Configure GCC by typing ./configure then compile with &shellprompt; make CC=gcc CFLAGS='-fPIC -O2' libgcc.a This will build far more than you need, but it's more trouble than it's worth to fiddle about to build just what you want. You now have all the code you need compiled, all that remains is to assemble it into a shared library, the gcc makefile doesn't know how to do this. We do it by unpacking the normal, unshared library into a temporary directory and linking the bits together as follows: &shellprompt; mkdir tmpdir &shellprompt; cd tmpdir &shellprompt; ar x ../libgcc.a &shellprompt; cd .. &shellprompt; gcc -shared -fno-shared-data -o libgcc.so.2.7.2 tmpdir/*.o Building libstdc++.so You can ignore this section if you have a sharable version of libstdc++ available. Unpack the libg++ distribution. in the directory this creates run &shellprompt; ./configure --enable-shared The, to build just: &shellprompt; make Again this will build more than you need. Where to Put Them If you are brave you could install the shared libraries in a public place, for instance /usr/local/lib, however this might cause problems with other gcc-compiled programs. A more conservative approach is to put it in a dedicated directory and configure speech_tools to look there. In either case got to your desired installation directory and do &shellprompt; cp GCC_BUILD_DIR/libgcc.so.2.7.2 . &shellprompt; ln -s libgcc.so.2.7.2 libgcc.so &shellprompt; cp LIBG++BUILD_DIR/libstdc++/libstdc++.so.2.7.2 . &shellprompt; ln -s libstdc++.so.2.7.2 libstdc++.so Where GCC_BUILD_DIR is the directory where you built the gcc library and LIBG++BUILD_DIR is where you built the g++ library. If you have chosen to put those libraries in a dedicated directory, say `/foo/bar/gcc_shared_libs', you should add the following line to `speech_tools/config/config' &shellprompt; CONFIG_LIBS=-L/foo/bar/gcc_shared_libs You will have to include that directory in your LD_LIBRARY_PATH when running any speech tools program. Checking it's all OK When you have compiled speech_tools, you can check how the libraries have been used by going into `speech_tools/main' and doing something like... (sh, ksh and bash users) &shellprompt; LD_LIBRARY_PATH=../lib:/foo/bar/gcc_shared_libs ldd bcat (csh users) &shellprompt; setenv LD_LIBRARY_PATH ../lib:/foo/bar/gcc_shared_libs &shellprompt; ldd bcat The result should be something like: libestjava.so.1.1.0.1 => ../lib/libestjava.so.1.1.0.1 libestbase.so.1.1.0.1 => ../lib/libestbase.so.1.1.0.1 libeststring.so.1.2 => ../lib/libeststring.so.1.2 libsocket.so.1 => /usr/lib/libsocket.so.1 libnsl.so.1 => /usr/lib/libnsl.so.1 libm.so.1 => /usr/lib/libm.so.1 libstdc++.so.2.7.2 => /foo/bar/gcc_shared_libs/libstdc++.so.2.7.2 libgcc.so.2.7.2 => /foo/bar/gcc_shared_libs/libgcc.so.2.7.2 libc.so.1 => /usr/lib/libc.so.1 libdl.so.1 => /usr/lib/libdl.so.1 libmp.so.2 => /usr/lib/libmp.so.2 speech_tools/doc/estspeechclass.sgml0000644000076400007640000001262507262605664016346 0ustar awbawb Speech Classes Overview EST offers two classes for handling and storing speech information of all types: Waveforms and Tracks. Both are basically matrices with one dimension representing time, the other representing a particular channel and the value at that position representing an amplitude. There are signficant differences between them, however, that makes the use of two separate classes preferable to one. Waveforms Waveforms store digitalled sampled acoustic waveforms. They are composed of a matrix of shorts, where rows represent individual samples and columns represent channels. Waves can have arbitrarily many channels, though 1 (mono) and 2 (stereo) are the most common. Waves are stored as shorts as this is the most common file format, which ensures fast compatibility with most file formats and hardware. As each sample is representing by a 16-bit short, the dynamic range of a wave is 96dB. The Track Class The track class is used to represent the outcome of a signal processing operation on a section of speech. It can be thought of as representing a series of frames, where each frame represents signal processing information at a specified time point. The Amplitude Matrix Each frame is a set of ordered coefficients, which represent the output of a signal processing operation on a single section of speech. For example, a frame may represent a spectrum, a cepstrum, or a set of linear predication coefficients. An alternative view is to visualise the track as a set of channels, where each channel represents a how a particular type of information varies with time. For instance, a channel might represent how the energy between 500Hz and 600Hz varies over the course of an utterance. Frames and Channels are stored as a matrix of floats, where each point in the matrix represents the amplitude of a given frame and a given channel. The Time Array In addition to the amplitude matrix, tracks also contain a timearray, which has the same number of elements as frames in the amplitude matrix. The time array is aligned one-to-one with the frames. Each position in the time array represents the time of its frame. In many forms of signal processing, frames are at fixed intervals (often 10ms), and in such cases it would be possible to store this as a single global value. However, the track class is extremely general in terms of time positions and allows frames to be spaced irregularly, which is particularly useful when dealing with pitch-synchronous processing. The Break/Value Array The track class also contains a break/value array, each element of which also as a one-to-one correspondence with a frame. In many representations some frames have undefined values, and the break/value array is used to represent this. For example, F0 contours and formants do not have values during unvoiced sections of speech, and hence frames representing unvoiced sections may be tagged as breaks in the break/value array. By default, it is assumed that all amplitudes are defined and hence no breaks are set at contour initialisation or resizing. In time, this will be replaced by the more general Auxiliary Matrix. Channel names trackmaps etc. The Auxiliary Matrix It is inappropriate to store certain information in the amplitude array. Sub-tracks, channel and frame extaction The track class provides an easy mechanism for dealing with a single portion of the track at a time. If we have say a track with 10 channels and 500 frames, it is possible to assign a vector to any single frame or channel, or to assign a sub-track to any contiguous set of frames or channels. Any values that are changed in the frame or channel vectors or sub-track, will affect the underlying tack. It is of course possible to copy values in and out if values need to be changed without changing the underlying track. Programs The following programs are available: <link linkend="ch-wave-manual">ch_wave</link<para>performs basic operates on waveforms, such as adding headers, resampling, rescaling, multi to single channel conversion etc. </para></formalpara> <formalpara><title><link linkend="ch-track-manual">ch_track</link<para>performs basic operates on coefficient tracks, such as adding headers, resampling, rescaling, multi to single channel conversion etc. </para></formalpara> </sect1> <sect1><title>Classes &docpp-EST-Wave-2; &docpp-EST-Track-2; Functions Auxiliary Track Functions &docpp-EST-track-aux-h-3; &trackexamplesection; speech_tools/doc/estsigpr.sgml0000644000076400007640000003120410045556420015153 0ustar awbawb Signal Processing The &est signal processing library provides a set of standard signal processing tools designed specifically for speech analysis. The library includes: Windowing (creating frames from a continuous waveform) Linear prediction and associated operations Cepstral analysis, both via lpc and DFT. Filterbank analysis Frequency warping including mel-scaling Pitch tracking Energy and Power analysis Spectrogram Generation Fourier Transforms Pitchmarking (of laryngograph signals) Overview Design Issues The signal processing library is designed specifically for speech applications and hence all functions are written with that end goal in mind. The design of the library has centered around building a set of commonly used easy to configure analysis routines. Speed We have tried to make the functions as fast as possible. Signal processing can often be time critical, and so it will always be the case that if the code for a particular signal processing algroithm is written in a single function loop it will run faster than by using libraries. However, the signal processing routines in the EST library are in general very fast, and the fact that they use classes such as EST_Track and EST_FVector does not make them slower than they would be if float * etc was used. types The library makes heavy use of a small number of classes, specifically EST_Wave EST_Track and EST_FVector. These classes are basically arrays and matrices, but take care of issues such as memory managment, error handling and file i/o. Using these classes in the library helps facilitate clean and simple algorithm writing and use. It is strongly recommended that you gain familiarity with these classes before using this part of the library. At present, the issue of complex numbers in signal processing is somewhat fudged, in that a vector of complex numbers is represented by a vector of real parts and a vector of imaginary parts, rather than as a single vector of complex numbers. Common Processing model In speech, a large number of algorithms follow the same basic model, in which a waveform is analysed by an algorithm and a Track, containing a series of time aligned vectors is produced. Regardless of the type of signal processing, the basic model is as follows: Start with a waveform and a series of analysis positions, which can be a fixed distance apart of specified by some other means. For each analysis position, define a small portion of the waveform around that position, Multiply this by a windowing function to produce a vector of speech samples. Pass this to a frame based signal processing routine which in outputs values in another vector. Add this vector to a position in an EST_Track which correponds to the analysis time position. Given this model, the signal processing library breaks down into a number of different types of function: Utterance based functions Functions which operate on an entire waveform or track. These break down into: Analysis Functions which take a waveform and produce a track Synthesis Functions which take a track and produce a waveform Filter Functions which take a waveform and produce a waveform Conversion Functions which take a track and produce a track Frames based functions Functions which operate on a single frame of speech or vector coefficients. Windowing functions which create a windowed frame of speech from a portion of a waveform. Nearly all functions in the signal processing library belong to one of the above listed types. Quite often functions are presented on both the utterance and frame level. For example, there is a function called sig2lpc which takes a single frame of windowed speech and produces a set of linear prediction coefficients. There is also a function called sig2coef which performs linear prediction on a whole waveforn, returning the answer in a Track. sig2coef uses the common processing model, and calls sig2lpc as the algorithm in the loop. Partly for historical reasons some functions, e.g. pda are only available in the utterance based form. When writing signal processing code for this library, it is often the case that all that needs to be written is the frame based algorithm, as other algorithms can do the frame shifting and windowing operations. Track Allocation, Frames, Channels and sub-tracks The signal processing library makes extensive use of the advanced features of the track class, specifically the ability to access single frames and channels. Given a standard multi-channel track, it is possible to make a FVector point to any single frame or channel - this is done by an internal pointer mechanism in EST_FVector. Furthermore, a track can be made to point to a selected number of channels or frames in a main track. For example, imagine we have a function that calculates the covariance matrix for a multi-dimensional track of data. But the data we actually have contains energy, cepstra and delta cepstra. It is non-sensical to calculate convariance on all of this, we just want the cepstra. To do this we use the sub-track facility to set a temporary track to just the cepstral coefficients and pass this into the covariance function. The temporary track has smart pointers into the original track and hence no data is copied. Without this facility, either you would have to do a copy (expensive) or else tell the covariance function which part of the track to use (hacky). Extensive documentation describing this process is found in , and . Functions Functions for Generating Frames The following set of functions perform either a signal processing operation on a single frame of speech to produce a set of coefficients, or a transformation on an existing set of coefficients to produce a new set. In most cases, the first argument to the function is the input, and the second is the output. It is assumed that any input speech frame has already been windowed with an appropriate windowing function (eg. Hamming) - see \Ref{Windowing mechanisms} on how to produce such a frame. See also . It is also assumed that the output vector is of the correct size. No resizing is done in these functions as the incoming vectors may be subvectors of whole tracks etc. In many cases (eg. lpc analysis), an {\bf order} parameter is required. This is usually derived from the size of the input or output vectors, and hence is not passed explicitly. &docpp-LinearPredictionfunctions-3; &docpp-Energyandpowerframefunctions-3; &docpp-FastFourierTransformfunctions-3; &docpp-Framebasedfilterbankandcepstralanalysis-3; Functions for Generating Tracks Functions which operate on a whole waveform and generate coefficients for a track. &docpp-Functionsforusewithframebasedprocessing-3; &docpp-DeltaandAccelerationcoefficients-3; &docpp-PitchF0DetectionAlgorithmfunctions-3; &docpp-PitchmarkingFunctions-3; &docpp-Spectrogramgeneration-3; Functions for Windowing Frames of Waveforms &docpp-EST-Window-2; Filter funtions A filter modifies a waveform by changing its frequency characteristics. The following types of filter are currently supported: FIR filtersFIR filters are general purpose finite impulse response filters which are useful for band-pass, low-pass and high-pass filtering. Linear Prediction filters are used to produce LP residuals from waveforms and vice versa Pre Emphasis filters are simple filters for changing the spectral tilt of a signal Non linear filtersMiscellaneous filters &docpp-FIRfilters-3; &docpp-LinearPredictionfilters-3; &docpp-PrePostEmphasisfilters--3; &docpp-Miscellaneousfilters--3; &docpp-FilterDesign-2; &sigprexamplesection; Programs The following are exectutable programs which are used for signal processing: <link linkend="sigfv-manual">sig2fv</link> is used to provide produce a variety of feature vectors given a waveform. <link linkend="spectgen-manual">spectgen</link> is used to produce spectrograms from utterances. <link linkend="sigfilter-manual">sigfilter</link> performs filtering operations on waveforms. <link linkend="pda-manual">pda</link> performs pitch detection on waveforms. While sig2fv can perform pitch detection also, pda offers more control over the operation. <link linkend="pitchmark-manual">pitchmark</link><para>produces a set of pitchmarks, specifying the instant of glottal close from laryngograph waveforms. </para></simplesect> <para>The following programs are also useful in signal processing: </para> <simplesect><title><link linkend="ch-wave-manual">ch_wave</link>performs basic operates on waveforms, such as adding headers, resampling, rescaling, multi to single channel conversion etc. <link linkend="ch-track-manual">ch_track</link>performs basic operates on coefficient tracks, such as adding headers, resampling, rescaling, multi to single channel conversion etc. speech_tools/doc/estintro.sgml0000644000076400007640000006644707262605664015217 0ustar awbawb Introduction to the Edinburgh Speech Tools &TheEST; is library of general speech software, written at the Centre for Speech Technology Research at the University of Edinburgh. &TheEST; is written is C++ and provide a range of for common tasks found in speech processing. The library provides a set of stand alone executable programs and a set of library calls which can be linked into user programs. Updates and news about the speech tools include releases and bug fixes may be found at http://www.cstr.ed.ac.uk/projects/speech_tools.html Most speech researchers spend a considerable amount of time writing, developing and debugging code. In fact, many researchers spend most of their time doing this. The sad fact is that most of this time is spent on unnecessary tasks - time which could be better spent doing "real" research. The library is intended to provide software that programmers use day-to-day, and provide this in an easy to use fashion. The Library The Edinburgh Speech Tools Library has two main parts: a software library and a set of programs which use the library. A library is a single central place where useful software is kept. A UNIX library is a single file (in this case called libestools.a) which can be linked to an individual program. When writing a program, you can call any of the functions in the library, and they will automatically be linked into your program when you compile. The key point is that you never need look at the library itself or copy the code in it. That way you can write small programs, concentrate on the algorithms and not have to worry about any infrastructure issues. The speech tools also provide a number of utility programs for things like playback, sampling rate conversion file format conversion etc. Usually these programs are just wrap-around executables based on standard speech tools library functions. What does the library contain? Speech class Includes tracks for storing sets of time aligned coefficients, and waves for digitally sampled speech waveforms. Linguistic class A comprenhensive system for storing different kinds of linguistic information is given. This is based on the Hetrogeneous Relation Graph formalism ***CITE***. Feature structures, tress, lists, graphs ect can all be represented with the linguistic classes. Audio playback Easy to use routines to record and play audio data without any fuss. Signal processing Commonly used signal processing algorithms such as including pitch tracking, cepstra and LPC, filtering, fourier analysis etc. Statistical functions Grammars Intonation Software spport for the Tilt intonation model Speech Recognition Utility Functions and Classes Useful classes such as lists, vectors, matrices, strings and functions for reading files, parsing command lines etc. Using the speechtools Once installed, speech tools can be used either by running the exectuable programs or by building your own C++ programs and linking to the library. Documentation on executable programs is found in . Instructions on how to build your own programs which use the library are found in . Licence, Installation and Acknowledgements Licence Since version 1.2.0 we are distributing the Edinburgh Speech Tools under a free software lince similar to the X11 one. Basically the system is free for anyone to use commerically or otherwise without further permission. Hence the current copy policy is Centre for Speech Technology Research University of Edinburgh, UK Copyright (c) 1994-1999 All Rights Reserved. Permission is hereby granted, free of charge, to use and distribute this software and its documentation without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this work, and to permit persons to whom this work is furnished to do so, subject to the following conditions: 1. The code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Any modifications must be clearly marked as such. 3. Original authors' names are not deleted. 4. The authors' names are not used to endorse or promote products derived from this software without specific prior written permission. THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Acknowledgments The library was written by Paul Taylor, Richard Caley, Alan W Black and Simon King, during the periond 1994-1999. During this period, the above people were supported by the UK Physical Science and Engineering Research Council though grants GR/J55106, GR/K54229, GR/L53250, by Sun microsystems, AT and T and Reuters. Other contributors We are extremely grateful to the following people who have made their code available for general use. We should make it clear that these people did not directly participate in the development of the library and hence cannot be held responsible for any problems we have introduced in the use of their code. Markus Mummer Waveform re-sampling routine (rateconv) Tony Robinson Provided cepstral and LPC routines Richard Tobin and LTG RXP, an XML parser. Paul Bagshaw the pitch tracker Craig Reese and John Campbell ulaw conversion routines Paradigm Associates and George Carrett for Scheme in one defun. Theo Veenker (Utrecht University) IRIX audio support. Rick Woudenberg Inspiration for the design of the wave class Borja Etxebarria LPC reflection coefficients Simmule Turner and Rich Salz editline command line editing library Henry Spencer for his regex code taken from the FreeBSD 2.1.5 distribution. The Regents of the University of California. for some string comparison code. What is new Since the last public release, 1.1.1, January 1999, there have been a number of enhancements to the library system Free licence To make the system more useful for more people and place it properly in the free software community the system is now free for both commercial and non-commercial use alike. Utterance consolidation A number of tidy ups have been performed on the EST_Utterance and related classes. This makes the interface cleaner and should have littel affect on existsing code. Generalization of Features Any new object can become a feature value after simple registration of the object through a provided macro. We also make much more use of this. SIOD tidy up Scheme is no longer "in one defun" but "in one directory". The system was split out into separate files. New objects are now held as EST_Val and it is easier to add new objects to the system. C++ class documentation We now include documentation on a per class basis using the DOC++ system and docbook for more general descriptions and examples. This has improved the coverage and quality of low level documentation for all classes in the system. Tilt Analysis/Resynthesis For intonation analysis the tilt code has been completely rewritten. Installation Release notes This documentation covers version &VERSION; of &theEST;. While previous versions of the speech tools were primarily released solely to support the Festival Speech Synthesis System, the Edinburgh Speech Tools Library now contains sufficiently useful tools that it is of use in its own right. Although hope that the speech tools has stabilised to a certain extent and less structural changes will occur in future versions we don't guaranteed future compatibility, although every effort will be made to make upgrading as easy as possible. In addition, we warn that while several programs and routines are quite mature, others are young and have not be rigorously tested. Please do not assume these programs work. Requirements In order to compile and install the Edinburgh Speech Tools you need the following &gnumake; Any recent version, the various make programs that come with different UNIX systems are wildly varying and hence it makes it too difficult to write Makefiles which are portable, so we depend on a version of make which is available for all of the platforms we are aiming at. A C++ compiler The system was developed primarily with GNU C++ version 2.7.2, but we also have compiled it successfully with a number of other versions of gcc, Sun CC and &visualc;. Hopefully we have now sanitized the code sufficiently to to make it possible for ports to other C++ compilers without too much difficulty. But please note C++ is not a fully standardized language and each compiler follows the incomplete standard to various degrees. Often there are many but simple problems when porting to new C++ compilers. We are trying to deal with this by increasing our support. However, it is likely that small changes will be required for C++ compilers we have not yet tested the system under. However we feel this is stable enough to make it worthwhile attempting ports to other C++ compilers that we haven't tried yet. Before installing the speech tools it is worth ensuring you have a fully installed and working version of your C++ compiler. Most of the problems people have had in installing the speech tools have been due to incomplete or bad compiler installation. It might be worth checking if the following program works, if you don't know if anyone has used your C++ installation before. #include <iostream.h> int main (int argc, char **argv) { cout << "Hello world\n"; } Supported Systems We have successfully compiled and tested the speech tools on the following systems, except where specified we include support for both shared and static versions of the libraries: Sun Sparc Solaris 2.5.1/2.6/2.7 GCC 2.7.2, GCC 2.8.1, SunCC 4.1, egcs 1.1.1, egcs 1.1.2 Sun Sparc SunOS 4.1.3 GCC 2.7.2 (static only) Intel Solaris 2.5.1 GCC 2.7.2 FreeBSD for Intel 2.1.7, 2.2.1, 2.2.6 (aout), 2.2.8 (aout), 3.x (elf) GCC 2.7.2.1 (static only) Linux (2.0.30) for Intel (RedHat 4.[012]/5.[01]/6.0) GCC 2.7.2, GCC 2.7.2/egcs-1.0.2, egcs-1.1.2 Windows NT 4.0, Windows95, Windows 98 GCC with egcs (from &cygwin; b20.1), &visualc; 5.0. (static only) As stated before C++ compilers are not standard and it is non-trivial to find the correct dialect which compiles under all. We recommend the use of GCC 2.7.2 if you can use it, it is the most likely one to work. Some of the compilers listed above produce a large number of warnings when compileing the code. Previous versions of the system have successfully compiled under SGI IRIX 5.3, OSF (Alphas) and HPUX but at time of writing this we have not yet rechecked this version. Java Support The java directory contains optional &java; classes which give some access to &est; facilities from &java; programs. This has been created to support the &fringe; graphical interface. There are two levels of support enabled by the JAVA and JAVA_CPP options in the config file. JAVA compiles some very basic classes intended to allow very simple simulation of &est; facilities in pure &java; programs. JAVA_CPP compiles classes which use the &java; native interface to provide access to the actual &est; &cpp; classes. You may (for instance on Solaris using gcc) need to make shared libraries for some compiler support libraries in order to comple the full JAVA_CPP support. See for details. Windows 95/98/NT Port We have done two ports of this code to Windows machines, one uses the &cygwin; package, which provides a Unix like environment under on Win32 systems, the other is a native port using &visualc;. For our full Windows NT and Windows 95/98 ports we use the Cygnus &cygwin; environment (version b20.1) available from http://sourceware.cygnus.com/cygwin/. Windows 98 is significantly more stable than Windows 95, especially when many processes are started and stopped as is the case when compiling with &cygwin;. We strongly reccoment 98 rather than 95 be used if at all possible. However with both 95 and 98 you can expect Windows to occasionally lock up or complain it is unable to start new processes or otherwise missbehave. You will be restarting windows regularly. A Windows NT system should not have these problems. The port using &visualc; does not provide all of the features of the Unix and &cygwin; versions. You will need access to a Unix or &cygwin; system to create the makefiles used for the &visualc; compilation. Both &cygwin; and &visualc; ports have a number of limitations. Shared library creation is not supported. Creation of Windows DLLs is different enough from creation of Unix shared libraries that the support does not carry directly accross, and we haven't yet had time to work on it. Java not supported Because the &java; support is related to the creation of shared libraries, this is also not yet implemented for Windows. Command line editing limited Because of the limiots of the Windows DOS console window, the command line editing in siod is less reliable (for instance on very long lines). (&visualc;) Networking not supported Networking under Win32 is different from Unix in a number of fairly fundamental ways, we haven't tackled this at all. There are no doubt other differences we hve not noticed. We don't use Windows for any of our work and so the Windows builds of our systems don't get the extensive use the unix builds do. Building It Configuration All compile-time configuration for the system is done through the user definable file config/config. You must create this file before you can compile the library. An example is given in config/config-dist, copy it and change its permissions to give write access &shellprompt; cd config &shellprompt; cp config-dist config &shellprompt; chmod +w config In many cases no further changes will be required, but it might be worth checking the contents of this file just in case. Where possible the system will automatically config itself. Type &shellprompt; gnumake info This will create the local config files and display what it thinks your system is. If this is not suitable for your machine then edit your config/config. In most cases the default will be the best option. If you are unsure about what you should change you probabaly shouldn't change anything. As of 1.3.1 due to conflicts in copyright we have dropped GNU Readline support and replaced it with a differently licenced alternative which does not imposes the restrictions of the GPL. editline is a free command line editor library. We have added substantially to it, including support for long lines, incremental search and completion. However as it has not yet been testsed on many systems it is still optional, though is on by default. For Linux we now fully supported shared libraries and even recommend them. However if you are going to do alot of development and don't understand the consequences of shared libraries and getting LD_LIBRARY_PATH correct (or what that is) we recommend you compile unshared, the default. If you are going to simply run the speech tools (and festival) then shared is a reasonable option. Uncomment the line in the config file # SHARED = 1 Shared support under Solaris is complete for all the speech tools. If you need to exec festival scripts using a version of festival built with shared libaries, you must either execute them from a featureful shell (e.g. bash), install the shared libraries in a standard place or explicitly set LD_LIBRARY_PATH. Solaris's standard shell doesn't support script excutaiton of shells within shells. Simple choices for common set ups are given near the top of this file. But for some sub-systems you will also need to change pathnames for external library support. At present read config/ReadMe for details of changing basic configuration. On systems (and versions of systems) we have not yet encountered you may need to create config/systems/<PROCESSOR>_<OS><OSVERSION>.mak files. Often you need only copy an existing one (other version or similar system) to get it to work. Typically the only real differences are when there are major differences in the default C++ compiler (e.g. RedHat 5.0 to RedHat 5.1). If you do need to add a new systems configuration file please let as know so we can include it in the standard distribution. Compilation Once you have configured config/config you can compile the system. &shellprompt; gnumake Note this must be &gnumake;, which may be called make on your system, or gmake or gnumake. This will compile all library functions and all the executables. If you wish to only compile the library itself then use &shellprompt; gnumake make_library Note that if you compile with -g (uncommenting DEBUG = 1 is config/config the library and the corresponding binaries will be large. Particulary the executables, you will need in order of 150 megabytes to compile the system, if your C++ libraries are not compiled as shared libraries. If you compile without -g the whole library directory is about 12 megabytes on Linux (which has shared libraries for libstdc++ or about 26 megabytes of Sparc Solaris (which does not have a shared library libstdc++ by default). This is almost entirely due to the size of the executables. C++ does not make small binaries. In general we have made the system compile with no warnings. However for some compilers this has proved to be near impossible. SunOS include files have a number of system declarations missing, so many system functions (e.g. fprintf) will appear to be undeclared. Sun's CC compiler also likes to complain about missing source for some code even though the code exists within our system and is deliberately in separate files ro make it modular. To test the system after compilation &shellprompt; gnumake test Installing the system All executables are linked to from speech_tools/bin and you should add that to your PATH in order to use them. Include files are speech_tools/include/ and the three generated libraries are speech_tools/lib/libestools.a, speech_tools/lib/libestbase.a and speech_tools/lib/libestring.a. For most cases a three will be required. If space is a preminium, compiled with the shared option (binaries will be then be substantially smaller) and you can delete all .o files Some aspects of the system have further dependencies which depend of the option selected at compile time. Specifically the readline libraries and Netaudio libraries. Building on Windows 95/98/NT There are two ways to build the system under Windows. The &cygwin; system provides a unix-like environment in which you can perform a compilation as described in the previous sections. &cygwin; is probably the best choice if you can use that route. &visualc; provides an environment much further from the Unix systems our code is developed on, this places some limits on the &visualc; port, especially in areas relating to networking. The remainder of this section describes how to compile with &visualc;. Creating <filename>VCMakefile</filename>s We compile using the nmake program which comes with &visualc;. This is a fairly standard make implementation, but is not as flexible as the GNU make we use for our normal builds. So, in order to compile with nmake new Makefiles are needed. These can be created from the Unix makefiles using &gnumake;: &shellprompt; gnumake VCMakefile Creating VCMakefile for . Creating VCMakefile for include Creating VCMakefile for include/unix [...] Obviously you will need either a unix machine or the &cygwin; system to do this. Sharing the compilation directory between unix and Windows machines, for instance using &samba; Configuration As for unix compilations, the &visualc; compilation process is controlled by a configuration file. In this case it is called vc_config_make_rules. A version is included in the distribution, as vc_config_make_rules-dist, copy this into place as follows: &shellprompt; cd config &shellprompt; cp vc_config_make_rules-dist vc_config_make_rules &shellprompt; chmod +w vc_config_make_rules You probably don't need to change this default configuration. Building To build the system: &shellprompt; nmake /nologo /fVCMakefile This should build the libraries and executables, and also the test programs in testsuite. However there is currently no way to automatically test the system, Indeed some of the test programs will fail under &visualc; due to differences in file nameing conventions. speech_tools/doc/estint.sgml0000644000076400007640000000311207262605664014632 0ustar awbawb Intonation intonation This section gives an overview of the various programs within the speech tools library that deal in intonation processing. These programs are still a little unstable though some have been used for a number of years. Pitch tracking intonationpitch tracking analysispitch tracking pitch tracking The executable pda may be use for pitch tracking speech files. It is based on Paul Bagshaw's pitch tracker @cite{bagshaw93}. Tilt The speech tools library provides code for the analysis and synthesis of F0 contours using the Tilt intonation model. RFC to be written speech_tools/doc/estwagon.sgml0000644000076400007640000004343510266526343015161 0ustar awbawb Classification and Regression Trees Overview As part of tools for statistical modelling &est includes methods for automatically building decision trees and decision lists from features data to predict both fixed classed (classification) or gaussians (regression). Wagon is the basic program that provide this facility. The construction of CARTs (classification and regression trees) is best described in breiman84 and has become a common basic method for building statistical models from simple feature data. CART is powerful because it can deal with incomplete data, multiple types of features (floats, enumerated sets) both in input features and predicted features, and the trees it produces often contain rules which are humanly readable. Decision trees contain a binary question (yes/no answer) about some feature at each node in the tree. The leaves of the tree contain the best prediction based on the training data. Decision lists are a reduced form of this where one answer to each question leads directly to a leaf node. A tree's leaf node may be a single member of some class, a probability density function (over some discrete class), a predicted mean value for a continuous feature or a gaussian (mean and standard deviation for a continuous value). Theorectically the predicted value may be anything for which a function can defined that can give a measure of impurity for a set of samples, and a distance measure between impurities. The basic algorithm is given a set of samples (a feature vector) find the question about some feature which splits the data minimising the mean "impurity" of the two partitions. Recursively apply this splitting on each partition until some stop criteria is reached (e.g. a minimum number of samples in the partition. The basic CART building algorithm is a greedy algorithm in that it chooses the locally best discriminatory feature at each stage in the process. This is suboptimal but a full search for a fully optimized set of question would be computationallly very expensive. Although there are pathological cases in most data sets this greediness is not a problem. The basic building algorithm starts with a set of feature vectors representing samples, at each stage all possible questions for all possibles features are asked about the data finding out how the question splits the data. A measurement of impurity of each partitioning is made and the question that generates the least impure partitions is selected. This process is applied recursively on each sub-partions recursively until some stop criteria is met (e.g. a minimal number of samples in a partition). Impurities The impurity of a set of samples is designed capture how similar the samples are to each other. The smaller the number the less impure the sample set is. For sample sets with continuous predictees Wagon uses the variance times number of sample points. The variance alone could be used by this overly favour very small sample sets. As the test thatuses the impurity is trying to minimise it over a partitioning of the data, multiple each part with the number of samples will encourage larger partitions, which we have found lead to better decision trees in general. For sample sets with discrete predictees Wagon uses the entropy times number of sample points. Again the number of sample points is used in so that small sample set are not unfairly favoured. The entropy for a sample set is calculated as sumof for each x in class prob(x)*log(prob(x)) Other impurity measure could be used if required. For example an expermental cluster technique used for unit selection actually used impurity calculated as the mean euclidean distance between all vectors of parameters in the sample set. However the above two are more standard measures. Question forming Wagon has to automatically form questions about each feature in the data set. For discrete features questions are build for each member of the set, e.g. if feature n has value x. Our implementation does not currently support more complex questions which could achieve better results (though at the expense of training time). Questions about features being some subset of the class members may give smaller trees. If the data requires distinction of values a, b and c, from d e and f, our method would require three separate questions, while if subset questions could be formed this could be done in one step which would not only give a smaller tree but also not unecessarily split the samples for a, b and c. In general subset forming is exponential on the number items in the class though there are techniques that can reduce this with heuristics. However these are currently not supported. Note however the the tree formalism produced but Wagon does support such questions (with the operator "in") but Wagon will never produce these question, though other tree building techniques (e.g. by hand) may use this form of question. For continuous features Wagon tries to find a partition of the range of the values that best optimizes the average impurity of the partitions. This is currently done by linearly splitting the range into a predefined subparts (10 by default) and testing each split. This again isn't optimal but does offer reasonably accuracy without require vast amounts of computation. Tree Building criteria There are many ways to constrain the tree building algorithm to help build the "best" tree. Wagon supports many of theses (though there are almost certainly others that is does not. In the most basic forms of the tree building algorithm a fully exhaustive classifcation of all samples would be achieved. This, of course is unlikely to be good when given samples that are not contained within the training data. Thus the object is to build a classification/regression tree that will be most suitable for new unseen samples. The most basic method to achieve this is not to build a full tree but require that there are at least n samples in a partition before a question split is considered. We refer to that as the stop value. A number like 50 as a stop value will often be good, but depending of the amount of data you have, the distribution of it, etc various stop value may produce more general trees. A second method for building "good" trees is to hold out some of the training data and build a (probably over-trained) tree with a small stop value. Then prune the tree back to where it best matches the held out data. This can often produce better results than a fixed stop value as this effectively allows the stop value to vary through different parts of the tree depending on how general the prediction is when compared against held out data. It is often better to try to build more balanced trees. A small stop value may cause the tree building algorithm to find small coherent sets of samples with very specific questions. The result tree becomes heavily lop-sided and (perhaps) not optimal. Rather than having the same literal stop value more balanced trees can built if the stop value is defined to be some percentage of the number of samples under consideration. This percentage we call a balance factor. Thus the stop value is then the largest of the defined fixed stop value or the balance factor times the number of samples. To some extent the multiplication of the entropy (or variance) by the number of samples in the impurity measure is also way to combat imbalance in tree building. A good technique we have found is to build trees in a stepwise fashion. In this case instead of considering all features in building the best tree. We increment build trees looking for which individual feature best increases the accuracy of the build tree on the provided test data. Unlike within the tree building process where we are looking for the best question over all features this technique limits which features are available for consideration. It first builds a tree using each and only the features provided looking for which individual feature provides the best tree. The selecting that feature is builds n-1 trees with the best feature from the first round with each of the remaining features. This process continues until no more features add to the accuracy or some stopping criteria (percentage improved) is not reached. This technique is also a greedy technique but we've found that when many features are presented, especially when some are highly correlated with each other, stepwise building produces a significantly more robust tree on external test data. It also typically builds smaller trees. But of course there is a cost in computation time. While using the stepwise option each new feature added is printed out. Care should be taking in interpreting what this means. It does not necessarily give the order and relative importance of the features, but may be useful if showing which features are particualrly important to this build. Stepwise tests each success tree against the specified test set, (balance, held out and stop options are respected for each build). As this is using the test set which optimizing the tree, it is not valid to view the specified test set as a genuine test set. Another externally held test set should be used to test the accuracy of generated tree. Data format The input data for wagon (and some other model building tools in the Edinburgh Speech Tools library), should consist of feature vectors, and a description of the fields in these vectors. Feature vectors A feature vector is a file with one sample per line, with feature value as white space separated tokens. If your features values conatin whitespace then you must quote them using double quotes. The (Festival) program dumpfeats is specifically designed to generate such files from databases of utterances but these files may be generated from any data source. Each vector must have the same number of features (and in the same order. Features may be specified as "ignored" in the description (or in actual use) so it is common that data files contain more features than are always used in model building. By default the first feature in a data file is the predictee, though at least in wagon) the predictee field can be named at tree building time to be other than the first field. Features can be discrete of continuous but at present must be single valued, "multi-valued" or "list-valued" features are not currently supported. Note this means that a feature in different samples may have different values but in a particular sample a particular feature can only have one value. A type example is 0.399 pau sh 0 0 0 1 1 0 0 0 0 0 0 0.082 sh iy pau onset 0 1 0 0 1 1 0 0 1 0.074 iy hh sh coda 1 0 1 0 1 1 0 0 1 0.048 hh ae iy onset 0 1 0 1 1 1 0 1 1 0.062 ae d hh coda 1 0 0 1 1 1 0 1 1 0.020 d y ae coda 2 0 1 1 1 1 0 1 1 0.082 y ax d onset 0 1 0 1 1 1 1 1 1 0.082 ax r y coda 1 0 0 1 1 1 1 1 1 0.036 r d ax coda 2 0 1 1 1 1 1 1 1 Note is it common to have thousands, even hundreds of thousands of samples in a data file, and the number of features can often be in the hundreds, though can also be less than ten depending on the what it describes. Data descriptions A data file also requires a description file which names and classifies the features in a datafiles. Features must haves names so they can be refered to in the decision tree (or other model output) and also be classified into their type. The basic types available for features are continuous for features that range over reals (e.g. duration of phones) categorial for features with a pre-defined list of possible values (e.g. phone names) string for features with an open class of discrete values (e.g. words) vectors like floats but as vectors of floats, (e.g. MFCC data) The data description consists of a parenthesized list of feature descriptions. Each feature description consists of the feature name and its type (and/or possible values). Feature names, by convention, should be features names in the sense for features (and pathnames) used throughout the utterance structures in the Edinburgh Speech Tools. The expected method to use models generated from features sets in the Edinburgh Speech Tools is to apply them to items. In that sense having a feature name be a feature of an item (or relatve) pathname will avoid having the extra step of extracting features into a separated table before applying the model. However it should also be stated that to wagon these names are arbitrary tokens and their semantic irrelevant at training time. A typical description file would look like this, this is one suitable for the data file given above ((segment_duration float) ( name aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) ( n.name 0 aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) ( p.name 0 aa ae ah ao aw ax ay b ch d dh dx eh el em en er ey f g hh ih iy jh k l m n nx ng ow oy p r s sh t th uh uw v w y z zh pau ) (position_type 0 onset coda) (pos_in_syl float) (syl_initial 0 1) (syl_final 0 1) (R:Sylstructure.parent.R:Syllable.p.syl_break float) (R:Sylstructure.parent.syl_break float) (R:Sylstructure.parent.R:Syllable.n.syl_break float) (R:Sylstructure.parent.R:Syllable.p.stress 0 1) (R:Sylstructure.parent.stress 0 1) (R:Sylstructure.parent.R:Syllable.n.stress 0 1) ) There are also a number of special symbols that may be used in a description file. If the type (first toke after the name) is ignore the feature will be ignored in the model building process. You may also specified features to ignore at tree building time but it is often convenient to explicitly ignore feature(s) in the description file. For open categorial features the token _other_ should appear as the first in the list of possible values. This actually allows features to have a partially closed set and and open set. A description file can't be generated automatically from a data set though an approximation is possible. Particularly its is not possible to automatically decied if a feature value is continous of that its example values happen to look like numbers. The script make_wagon_desc takes a datafile and file containing only the names of the features, and the name of the description file it will create. This is often a useful first pass though it almost certainly must be hand editted afterwards. Tree format The generated tree files are written as Lisp s-expressions as this is by far the easiest external method to represent trees. Even if the trees are read by something other than Lisp it is easy to write a reader for such a format. The syntax of a tree is TREE ::= LEAF | QUESTION-NODE QUESTION-NODE ::= "(" QUESTION YES-NODE NO-NODE ")" YES-NODE ::= TREE NO-NODE ::= TREE QUESTION ::= "(" FEATURENAME "is" VALUE ")" | "(" FEATURENAME "=" FLOAT ")" | "(" FEATURENAME "<" FLOAT ")" | "(" FEATURENAME ">" FLOAT ")" | "(" FEATURENAME "matches" REGEX ")" | "(" FEATURENAME "in" "(" VALUE0 VALUE1 ... ")" ")" LEAF ::= "(" STDDEV MEAN ")" | "(" "(" VALUE0 PROB0 ")" "(" VALUE1 PROB1 ")" ... MOSTPROBVAL ")" | any other lisp s-expression Note that not all of the question types are generated by Wagon but they are supported by the interpreters. The leaf nodes differ depending on the type of the predictee. For continuous predictees (regression trees) the leaves consist of a pair of floats, the stddev and mean. For discrete predictees (classification trees) the leaves are a probability density function for the members of the class. Also the last member of the list is the most probable value. Note that in both case the last value of the leaf list is the answer desired in many cases. Here's a small example tree Functions Programs The following exectutable programs are provided for the building and testing of decision trees <link linkend="wagon-manual">wagon</link> is the core building program <link linkend="wagon-test-manual">wagon_test</link> applies a trained treee to data and tests its accuracy. Exectuable Programs &wagonmanualsection; speech_tools/doc/estutil.sgml0000644000076400007640000000057207262605664015024 0ustar awbawb Utility Functions Utility Classes and Functions &docpp-EST-Token-2; &docpp-UtilityFunctionsforstrings-2; &docpp-UtilityfunctionsforIO-2; speech_tools/doc/Makefile0000644000076400007640000001042307262605664014103 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Author : Paul Taylor and Alan W Black ## ## Date : July 1997 ## ##-----------------------------------------------------------------------## ## ## ## Documentation directory ## ## ## ##=======================================================================## TOP=.. DIRNAME=doc ALL_DIRS = man arch_doc DOCNAME=speechtools DSSL_SANE_DB=sane_to_docbook.dsl DSSSL_HTML=cstr.dssl DSSSL=$(DSSSL_HTML) TEX_SCALE=1.5 # Temporarilly we explicitly list the programs which have been documented MAIN_TO_DOCUMENT=ch_wave ch_track ch_lab tilt_analysis tilt_synthesis sig2fv \ sigfilter pda pitchmark spectgen design_filter dp ngram_build \ na_play ngram_test viterbi wagon xml_parser wfst_build wfst_run \ scfg_make scfg_train scfg_parse scfg_test siod ols ols_test \ fringe_client bcat na_record EXAMPLE_TO_DOCUMENT=matrix ling track sigpr deq error handle hash kvl \ list matrix named_enum pathname string token xml SGMLFILES = cstr_defs.dtd speechtools.sgml estbaseclass.sgml estexec.sgml \ estgram.sgml esttilt.sgml estxml.sgml estserver.sgml estjavaapp.sgml \ estspeechclass.sgml estsigpr.sgml estintro.sgml estint.sgml \ estwagon.sgml estutil.sgml DSSSLFILES = $(DSSSL_HTML) $(DSSL_SANE_DB) DOCXXIMAGES = edcrest.gif cstr.gif est.jpg est_small.jpg DOCXXFILES= classHeader.inc hierHeader.inc indexHeader.inc \ banner.inc $(DOCXXIMAGES) HTML_REQUIREMENTS = $(DOCXXIMAGES) cstrdoc.css arch_doc FILES = $(DOCXXFILES) cstrdoc.css sane.dtd \ $(SGMLFILES) Makefile $(DSSSLFILES) LOCAL_CLEAN = *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr ALL=new_doc_help include $(TOP)/config/common_make_rules include $(TOP)/config/rules/doc.mak speech_tools/doc/cstr.dssl0000644000076400007640000005527407262605664014322 0ustar awbawb ]> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; CSTR modifications to modular docbook stylesheets. me of this could ;; ;; perhaps be split into parameters and more parametarisable ;; ;; definitions replaceing ones from the standard style sheets. ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define html-index #t ) (define %shade-verbatim% #t) (define %missing-link-error% #f) (define image-directory "images_gen") (define $generate-chapter-toc$ (lambda () #t)) (define %generate-book-toc% #f) (define ($shade-verbatim-attr$) ;; Attributes used to create a shaded verbatim environment. (list (list "BORDER" "0") (list "WIDTH" "80%"))) (define ($shade-verbatim-cell-attr$) ;; Attributes used to create a shaded verbatim environment. (list )) (define ($shade-verbatim-text-attr$) ;; Attributes used to create a shaded verbatim environment. (list (list "style" "white-space:pre; display:block;") (list "face" "monospace") (list "color" "#000000") )) (define %body-attr% ;; What attributes should be hung off of BODY? (list (list "BGCOLOR" "#FFFFFF") (list "BACKGROUND" "../cstr_background.jpg") (list "TEXT" "#0000AA") ) ) (define $line-annotation-attr$ ;; font attributes for line annotation (list (list "color" "#A00080") (list "size" "-1") (list "face" "sans") (list "weight" "bold") ) ) (element lineannotation (make element gi: "font" attributes: $line-annotation-attr$ (process-children)) ) (element screen (make element gi: "DIV" attributes: '(("ALIGN" "CENTER")) ($verbatim-display$ %number-screen-lines%) ) ) (element programlisting (make element gi: "DIV" attributes: '(("ALIGN" "CENTER")) ($verbatim-display$ %number-programlisting-lines%) ) ) (element sidebar (make element gi: "div" (make empty-element gi: "br" attributes: (list (list "clear" "right") ) ) (make element gi: "TABLE" attributes: (list (list "CLASS" (gi)) (list "BORDER" "1") (list "CELLPADDING" "5")) (make element gi: "TR" (make element gi: "TD" ($semiformal-object$)))) ) ) (define (default-header-nav-tbl-ff elemnode prev next prevsib nextsib) (let* ((r1? (nav-banner? elemnode)) (r1-sosofo (make element gi: "TR" (make element gi: "TH" attributes: (list (list "COLSPAN" "5") (list "ALIGN" "center") (list "VALIGN" "bottom")) (nav-banner elemnode)))) (r2? (or (not (node-list-empty? prev)) (not (node-list-empty? next)) (not (node-list-empty? prevsib)) (not (node-list-empty? nextsib)) (nav-context? elemnode))) (r2-sosofo (make element gi: "TR" (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "left") (list "VALIGN" "top")) (if (node-list-empty? prev) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to prev))) (gentext-nav-prev prev)))) (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "left") (list "VALIGN" "top")) (if (node-list-empty? prevsib) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to prevsib))) (gentext-nav-prevsib prevsib)))) (make element gi: "TD" attributes: (list (list "WIDTH" "60%") (list "ALIGN" "center") (list "VALIGN" "bottom")) (nav-context elemnode)) (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "right") (list "VALIGN" "top")) (if (node-list-empty? nextsib) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to nextsib))) (gentext-nav-nextsib nextsib)))) (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "right") (list "VALIGN" "top")) (if (node-list-empty? next) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to next))) (gentext-nav-next next))))))) (if (or r1? r2?) (make element gi: "DIV" attributes: '(("CLASS" "NAVHEADER")) (make element gi: "TABLE" attributes: (list (list "WIDTH" %gentext-nav-tblwidth%) (list "BORDER" "0") (list "CELLPADDING" "0") (list "CELLSPACING" "0")) (if r1? r1-sosofo (empty-sosofo)) (if r2? r2-sosofo (empty-sosofo))) (make empty-element gi: "HR" attributes: (list (list "ALIGN" "LEFT") (list "WIDTH" %gentext-nav-tblwidth%))) (make empty-element gi: "HR" attributes: (list (list "ALIGN" "LEFT") (list "WIDTH" %gentext-nav-tblwidth%)))) (empty-sosofo)))) (define (default-header-nav-tbl-noff elemnode prev next prevsib nextsib) (let* ((r1? (nav-banner? elemnode)) (limg (entity-text "title-left-image")) (rimg (entity-text "title-right-image")) (r1-sosofo (make element gi: "TR" (if limg (make element gi: "TH" attributes: (list (list "ROWSPAN" "2") (list "ALIGN" "left")) (make empty-element gi: "IMG" attributes: (list (list "SRC" limg) ) )) (empty-sosofo) ) (make element gi: "TH" attributes: (list (list "COLSPAN" "3") (list "ALIGN" "center")) (nav-banner elemnode)) (if rimg (make element gi: "TH" attributes: (list (list "ROWSPAN" "2") (list "ALIGN" "right")) (make empty-element gi: "IMG" attributes: (list (list "SRC" rimg) ) )) (empty-sosofo) ) )) (r2? (or (not (node-list-empty? prev)) (not (node-list-empty? next)) (nav-context? elemnode))) (r2-sosofo (make element gi: "TR" (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "left") (list "VALIGN" "bottom")) (if (node-list-empty? prev) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to prev))) (gentext-nav-prev prev)))) (make element gi: "TD" attributes: (list (list "WIDTH" "80%") (list "ALIGN" "center") (list "VALIGN" "bottom")) (nav-context elemnode)) (make element gi: "TD" attributes: (list (list "WIDTH" "10%") (list "ALIGN" "right") (list "VALIGN" "bottom")) (if (node-list-empty? next) (make entity-ref name: "nbsp") (make element gi: "A" attributes: (list (list "HREF" (href-to next))) (gentext-nav-next next))))))) (if (or r1? r2?) (make element gi: "DIV" attributes: '(("CLASS" "NAVHEADER")) (make element gi: "TABLE" attributes: (list (list "WIDTH" %gentext-nav-tblwidth%) (list "BORDER" "0") (list "CELLPADDING" "0") (list "CELLSPACING" "0")) (if r1? r1-sosofo (empty-sosofo)) (if r2? r2-sosofo (empty-sosofo))) (make empty-element gi: "HR" attributes: (list (list "ALIGN" "LEFT") (list "WIDTH" %gentext-nav-tblwidth%)))) (empty-sosofo)))) (define ($verbatim-display$ line-numbers?) (let ((content (make element gi: "font" attributes: ($shade-verbatim-text-attr$) (if line-numbers? ($verbatim-content-with-linenumbers$) ($verbatim-content$))))) (if %shade-verbatim% (make element gi: "TABLE" attributes: ($shade-verbatim-attr$) (make element gi: "TR" (make element gi: "TD" attributes: ($shade-verbatim-cell-attr$) content ))) content))) (define ($sect-toc$) (let ((depth (attribute-string "depth"))) ;; Called by the TITLE element so that it can come after the TITLE (build-toc (ancestor-member (current-node) (section-element-list)) (if depth (string->number depth) (toc-depth (ancestor-member (current-node) (section-element-list))) ) #t)) ) (define ($chapter-toc$) (let ((depth (attribute-string "depth"))) ;; Called by the TITLE element so that it can come after the TITLE (build-toc (ancestor-member (current-node) (component-element-list)) (if depth (string->number depth) (toc-depth (ancestor-member (current-node) (component-element-list))) ) #t))) (element (SECT1 TOC) (make element gi: "DIV" (process-children) ($sect-toc$) ) ) (element (SECT2 TOC) (make element gi: "DIV" (process-children) ($sect-toc$) ) ) (element (SECT3 TOC) (make element gi: "DIV" (process-children) ($sect-toc$) ) ) (element (CHAPTER TOC) (make element gi: "DIV" (process-children) ($chapter-toc$) ) ) (element (BOOK TOC) (make element gi: "DIV" (process-children) ($chapter-toc$) ) ) ;; Variable list (element variablelist (make sequence (make element gi: "blockquote" (make element gi: "table" attributes: '(("class" "parameters")) (process-children))) (para-check 'restart))) (element (variablelist title) (make element gi: "tr" (make element gi: "th" attributes: '(("colspan" "2") ("align" "left")) (process-children)) ) ) (element varlistentry (let ((terms (select-elements (children (current-node)) (normalize "term"))) (listitem (select-elements (children (current-node)) (normalize "listitem")))) (make element gi: "tr" attributes: '(("valign" "top")) (make sequence (make element gi: "th" attributes: '(("align" "right")) (if (attribute-string (normalize "id")) (make element gi: "A" attributes: (list (list "NAME" (attribute-string (normalize "id")))) (process-node-list terms)) (process-node-list terms))) (make element gi: "td" (process-node-list listitem) ) ) ) ) ) (element (varlistentry term) (make sequence (process-children-trim) (if (not (last-sibling?)) (literal ", ") (literal "")))) (element (varlistentry listitem) (process-children)) ;; by copy of the index building stuff. (define (htmlindexattr-inherited attr) (if (inherited-attribute-string (normalize attr)) (make sequence (make formatting-instruction data: attr) (make formatting-instruction data: " ") (make formatting-instruction data: (inherited-attribute-string (normalize attr))) (htmlnewline)) (empty-sosofo))) (mode htmlindex ;; this mode is really just a hack to get at the root element (root (process-children)) (default (if (node-list=? (current-node) (sgml-root-element)) (make entity system-id: (html-entity-file html-index-filename) (process-node-list (select-elements (descendants (current-node)) (normalize "indexterm")))) (empty-sosofo))) (element indexterm (let* ((target (ancestor-member (current-node) (append (book-element-list) (division-element-list) (component-element-list) (section-element-list)))) (title (string-replace (element-title-string target) " " " "))) (make sequence (make formatting-instruction data: "INDEXTERM ") (make formatting-instruction data: (href-to target)) (htmlnewline) (make formatting-instruction data: "INDEXPOINT ") (make formatting-instruction data: (href-to (current-node))) (htmlnewline) (make formatting-instruction data: "TITLE ") (make formatting-instruction data: title) (htmlnewline) (htmlindexattr "scope") (htmlindexattr "significance") (htmlindexattr "class") (htmlindexattr-inherited "id") (htmlindexattr "startref") (if (attribute-string (normalize "zone")) (htmlindexzone (attribute-string (normalize "zone"))) (empty-sosofo)) (process-children) (make formatting-instruction data: "/INDEXTERM") (htmlnewline)))) (element primary (htmlindexterm)) (element secondary (htmlindexterm)) (element tertiary (htmlindexterm)) (element see (htmlindexterm)) (element seealso (htmlindexterm)) ) ;; TeX processing support (define html-tex-filename "TeX.formulae" ) (define (tex-graphic #!optional (nd (current-node))) (let* ((format (attribute-string "format" nd)) (fileref (attribute-string "fileref" nd)) ) (if (equal? format (normalize "tex")) (make sequence (make formatting-instruction data: "@Name ") (make formatting-instruction data: (string-append image-directory "/" fileref)) (htmlnewline) (make formatting-instruction data: "@Start") (htmlnewline) (make formatting-instruction data: (data nd)) (htmlnewline) (make formatting-instruction data: "@End") (htmlnewline) ) (empty-sosofo) ) ) ) (define ($img$ #!optional (nd (current-node)) (alt #f)) ;; This function now supports an extension to DocBook. It's ;; either a clever trick or an ugly hack, depending on your ;; point of view, but it'll hold us until XLink is finalized ;; and we can extend DocBook the "right" way. ;; ;; If the entity passed to GRAPHIC has the FORMAT ;; "LINESPECIFIC", either because that's what's specified or ;; because it's the notation of the supplied ENTITYREF, then ;; the text of the entity is inserted literally (via Jade's ;; read-entity external procedure). ;; (let* ((fileref (attribute-string (normalize "fileref") nd)) (entityref (attribute-string (normalize "entityref") nd)) (format (if (attribute-string (normalize "format") nd) (attribute-string (normalize "format") nd) (if entityref (entity-notation entityref) #f))) (align (attribute-string (normalize "align") nd))) (if (or fileref entityref) (if (equal? format (normalize "linespecific")) (if fileref (include-file fileref) (include-file (entity-generated-system-id entityref))) (if (equal? format (normalize "tex")) (if fileref ($graphic$ (string-append image-directory "/" fileref) format alt align) ($graphic$ (string-append image-directory "/" (system-id-filename entityref)) format alt align)) (if fileref ($graphic$ fileref format alt align) ($graphic$ (system-id-filename entityref) format alt align))) ) (empty-sosofo) ))) (mode tex-graphics ;; this mode is really just a hack to get at the root element (root (process-children)) (default (if (node-list=? (current-node) (sgml-root-element)) (make entity system-id: (html-entity-file html-tex-filename) (process-node-list (select-elements (descendants (current-node)) (normalize "graphic"))) (process-node-list (select-elements (descendants (current-node)) (normalize "inlinegraphic"))) ) (empty-sosofo))) (element graphic (tex-graphic) ) (element inlinegraphic (tex-graphic) ) ) (root (make sequence ; (literal ; (debug (node-property 'gi ; (node-property 'document-element (current-node))))) ;(define (docelem node) ; (node-propety 'document-element ; (node-property 'grove-root node))) (process-children) (with-mode manifest (process-children)) (if html-index (with-mode htmlindex (process-children)) (empty-sosofo)) (with-mode tex-graphics (process-children) ) ) ) ;; Sections can pass on role information (define ($section-body$) (let* ((sect (current-node)) (class (or (attribute-string "ROLE" sect) (gi sect) ) ) ) (make element gi: "DIV" attributes: (list (list "CLASS" class)) ($section-separator$) ($section-title$) (if (equal? class "entry") (make element gi: "blockquote" (process-children) ) (process-children) ) ) ) ) (define ($section-title$) (let* ((sect (current-node)) (info (info-element)) (subtitles (select-elements (children info) (normalize "subtitle"))) (renderas (inherited-attribute-string (normalize "renderas") sect)) (hlevel ;; the apparent section level; (if renderas ;; if not real section level, (string->number ;; then get the apparent level (substring renderas 4 5)) ;; from "renderas", (SECTLEVEL))) ;; else use the real level (h1elem (string-append "H" (number->string hlevel))) (h2elem (string-append "H" (number->string (+ hlevel 1)))) (name (element-id)) (isep (gentext-intra-label-sep (gi sect))) (nsep (gentext-label-title-sep (gi sect))) (role (attribute-string "ROLE" sect)) (h1class (if role (string-append (gi sect) "" role) (gi sect))) ) (make sequence (make element gi: h1elem attributes: (list (list "CLASS" h1class)) (make element gi: "A" attributes: (list (list "NAME" name)) (if (string=? (element-label (current-node)) "") (empty-sosofo) (literal (element-label (current-node)) nsep)) (element-title-sosofo sect) )) (if (node-list-empty? subtitles) (empty-sosofo) (with-mode subtitle-mode (make element gi: h2elem attributes: (list (list "CLASS" (string-append h1class "-subtitle"))) (process-node-list subtitles)))) ($proc-section-info$ info)))) (define %html-header-tags% '( ("link" ("rel" "stylesheet") ("type" "text/css") ("href" "cstrdoc.css")) ) ) (element synopsis (make element gi: "table" attributes: '(("cellspacing" "0")("cellpadding" "0") ("class" "synopsys")) (make element gi: "tr" (make sequence (make element gi: "td" attributes: '(("valign" "top")) (with-mode synopsis-table (process-matching-children '("synopsis" ("role" "type")))) ) (make element gi: "td" attributes: '(("valign" "top")) (with-mode synopsis-table (process-matching-children '("synopsis" ("role" "name")))) ) (with-mode synopsis-table-args (process-matching-children '("synopsis" ("role" "args")))) ) ) ) ) (mode synopsis-table-args (element synopsis (let* ((role (attribute-string "role")) (children (children (current-node))) (start (if (node-list-empty? children) "" (data (node-list-first children)))) ) (if (and (string? start) (not (string=? start ""))) (make sequence (make element gi: "td" attributes: '(("valign" "top")) (make element gi: "tt" (literal "(") ) ) (make element gi: "td" attributes: '(("valign" "top")) (make element gi: "tt" (if (and (equal? role "args") (string? start) (not (string=? start "")) (equal? (substring start 0 1) "(") ) (make sequence (literal (substring start 1 (string-length start))) (process-node-list (node-list-rest children)) ) (process-children) ) ) ) ) (empty-sosofo) ) ) ) ) (mode synopsis-table (element synopsis (make element gi: "tt" (let* ((role (attribute-string "role")) (children (children (current-node))) (start (if (node-list-empty? children) "" (data (node-list-first children)))) ) (if (and (equal? role "args") (string? start) (not (string=? start "")) (equal? (substring start 0 1) "(") ) (make sequence (literal (substring start 1 (string-length start))) (process-node-list (node-list-rest children)) ) (process-children) ) ) ) ) ) (element link (let* ((endterm (attribute-string (normalize "endterm"))) (linkend (attribute-string (normalize "linkend"))) (target (element-with-id linkend)) (etarget (if endterm (element-with-id endterm) (empty-node-list)))) (if (node-list-empty? target) (if %missing-link-error% (error (string-append "Link to missing ID '" linkend "'")) (make element gi: "font" attributes: '(("color" "green")) (process-children) ) ) (make sequence (if (and endterm (node-list-empty? etarget)) (error (string-append "EndTerm to missing ID '" endterm "' on Link")) (empty-sosofo)) (make element gi: "A" attributes: (list (list "HREF" (href-to target))) (if endterm (with-mode xref-endterm-mode (process-node-list etarget)) (process-children))))))) (element formalpara (make element gi: "DL" attributes: (list (list "CLASS" (gi))) (make element gi: "dt" (process-children)))) (element (formalpara title) (make element gi: "DT" (make element gi: "strong" (process-children))) ) (element (formalpara para) (make element gi: "DD" (process-children))) (element filename (make element gi: "TT" attributes: '(("CLASS" "filename")) (process-children)) ) (define (chunk? #!optional (nd (current-node))) ;; 1. The (sgml-root-element) is always a chunk. ;; 2. If nochunks is #t or the dbhtml PI on the root element ;; specifies chunk='no', then the root element is the only ;; chunk. ;; 3. Otherwise, elements in the chunk-element-list are chunks ;; unless they're combined with their parent. ;; 3a. Things tagged with `newpage' are chunks. ;; 4. Except for bibliographys, which are only chunks if they ;; occur in book. ;; (let ((maybechunk (or (not (equal? (gi nd) (normalize "bibliography"))) (equal? (gi (parent nd)) (normalize "book"))))) (if (node-list=? nd (sgml-root-element)) #t (if (or nochunks (equal? (dbhtml-value (sgml-root-element) "chunk") "no")) #f (if (member (gi nd) (chunk-element-list)) (if (combined-chunk? nd) #f maybechunk) (if (attribute-string "newpage" nd) maybechunk #f)))))) speech_tools/doc/sane_to_docbook.dsl0000644000076400007640000001766407262605664016315 0ustar awbawb (declare-flow-object-class element "UNREGISTERED::James Clark//Flow Object Class::element") (declare-flow-object-class empty-element "UNREGISTERED::James Clark//Flow Object Class::empty-element") (declare-flow-object-class document-type "UNREGISTERED::James Clark//Flow Object Class::document-type") (declare-flow-object-class processing-instruction "UNREGISTERED::James Clark//Flow Object Class::processing-instruction") (declare-flow-object-class entity "UNREGISTERED::James Clark//Flow Object Class::entity") (declare-flow-object-class entity-ref "UNREGISTERED::James Clark//Flow Object Class::entity-ref") (declare-flow-object-class formatting-instruction "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction") (declare-characteristic preserve-sdata? "UNREGISTERED::James Clark//Characteristic::preserve-sdata?" #f) (define sect-depth 1) (define unique-name (number->string (time))) (define (copy-attributes #!optional (nd (current-node))) (let loop ((atts (named-node-list-names (attributes nd)))) (if (null? atts) '() (let* ((name (car atts)) (value (attribute-string name nd))) (if value (cons (list name value) (loop (cdr atts))) (loop (cdr atts))))))) (default (empty-sosofo) ) (element sane (process-children) ) (define (sect-at depth) (if (> depth 0) (string-append "sect" (number->string depth)) "chapter" ) ) (define (handle-container-item type depth) (let* ((id (attribute-string "id")) ) (make element gi: (sect-at depth) attributes: (list (list "id" id) (list "role" type)) (make sequence (with-mode build-title (process-node-list (current-node))) (if (equal? depth sect-depth) (make element gi: "toc" attributes: '(("depth" "5")) (empty-sosofo) ) (empty-sosofo) ) (with-mode text (process-matching-children "cxxdoc")) (process-matching-children "cxxPublic") (process-matching-children "cxxProtected") (process-matching-children "cxxPrivate") (process-matching-children "cxxItems") ) ) ) ) (define (handle-item type depth) (let* ((id (attribute-string "id")) ) (make element gi: "simpleSect" attributes: (list (list "id" id) (list "role" type)) (make sequence (with-mode build-title (process-node-list (current-node))) (with-mode text (process-matching-children "cxxdoc")) (with-mode parameters (process-matching-children "parameters")) (process-matching-children "cxxPublic") (process-matching-children "cxxProtected") (process-matching-children "cxxPrivate") (process-matching-children "cxxItems") ) ) ) ) (define ($xref$) (let* ((id (attribute-string "linkend"))) (make element gi: "xref" attributes: (list (list "linkend" id)) (empty-sosofo) ) ) ) (define (find-depth nd) (let* ((p (parent nd))) (if (null? p) 0 (case (gi p) (("CXXCLASS" "CXXINTERFACE" "CXXUNION" "CXXSTRUCT" "CXXENTRY") (+ 1 (find-depth p))) (("SANE") 0) (else (find-depth p)) ) ) ) ) (define (sgml-root-element) ;; Returns the node that is the root element of the current document (let loop ((root (current-node))) (if (node-list-empty? (parent root)) root (loop (parent root))))) (define (node-depth) (+ sect-depth (find-depth (current-node))) ) (define (unique-filename base ext) (string-append base "_" unique-name "_" (number->string (element-number)) "." ext) ) (element docppRef ($xref$) ) (element docppLink (make element gi: "link" attributes: (copy-attributes) ) ) (element cxxClass (handle-container-item "class" (node-depth)) ) (element cxxUnion (handle-container-item "union" (node-depth)) ) (element cxxInterface (handle-container-item "interface" (node-depth)) ) (element cxxStruct (handle-container-item "struct" (node-depth)) ) (element cxxEntry (handle-container-item "entry" (node-depth)) ) (element cxxMethod (handle-item "method" (node-depth)) ) (element cxxVariable (handle-item "variable" (node-depth)) ) (element cxxFunction (handle-item "function" (node-depth)) ) (element cxxMacro (handle-item "macro" (node-depth)) ) (element cxxPublic (process-children) ) (element cxxProtected (process-children) ) (element cxxPrivate (process-children) ) (element cxxItems (process-children) ) (define ($cpp-title$ before after) (make sequence (make element gi: "title" (literal before) (with-mode code (process-matching-children "name")) (literal after) ) (make element gi: "synopsis" (make sequence (make element gi: "synopsis" attributes: '(("role" "type")) (with-mode code (process-matching-children "type")) ) (make element gi: "synopsis" attributes: '(("role" "name")) (with-mode code (process-matching-children "name")) ) (make element gi: "synopsis" attributes: '(("role" "args")) (with-mode code (process-matching-children "args")) ) ) ) ) ) (define ($title$) (make element gi: "title" (with-mode text (process-matching-children "name")) ) ) (mode build-title (default (empty-sosofo)) (element cxxClass ($cpp-title$ "class " "{}")) (element cxxInterface ($cpp-title$ "interface " "{}")) (element cxxUnion ($cpp-title$ "union " "{}")) (element cxxStruct ($cpp-title$ "struct " "{}")) (element cxxMethod ($cpp-title$ "" "()")) (element cxxFunction ($cpp-title$ "" "()")) (element cxxVariable ($cpp-title$ "" ";")) (element cxxMacro ($cpp-title$ "#define " "()")) (element cxxEntry ($title$)) ) (mode code (default (make element attributes: (copy-attributes)) ) (element docppRef ($xref$) ) (element docppLink (make element gi: "link" attributes: (copy-attributes) ) ) (element args (process-children) ) (element type (process-children) ) (element name (if (string=? (data (current-node)) "()") (literal "operator") (process-children) ) ) ) (mode text (default (make element attributes: (copy-attributes)) ) (element math (let* ((file (unique-filename "docppmath" "gif"))) (make element gi: "graphic" attributes: (list '("format" "tex") (list "fileref" file)) ) ) ) (element imath (let* ((file (unique-filename "docppimath" "gif"))) (make element gi: "inlinegraphic" attributes: (list '("format" "tex") (list "fileref" file)) ) ) ) (element docppRef ($xref$) ) (element docppLink (make element gi: "link" attributes: (copy-attributes) ) ) (element cxxdoc (process-children) ) (element expr (make element gi: "literal" attributes: (list (list "class" "expression")) (process-children) ) ) (element method (make element gi: "function" attributes: (list (list "class" "method")) (process-children) ) ) (element (parameter name) (empty-sosofo) ) (element name (process-children) ) ) (mode parameters (element parameters (make element gi: "variableList" (make sequence (make element gi: "title" (literal "Parameters") ) (process-children) ) ) ) (element parameter (make element gi: "varListEntry" (make sequence (make element gi: "term" (with-mode code (process-matching-children "name")) ) (make element gi: "listitem" (make element gi: "para" (with-mode text (process-children)) ) ) ) ) ) ) speech_tools/doc/man/Makefile0000644000076400007640000000651307262605664014663 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1996 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Author : Paul Taylor ## ## Date : March 1995 ## ##-----------------------------------------------------------------------## ## ## ## Documentation directory ## ## ## ##=======================================================================## TOP=../.. DIRNAME=doc/man # Replaced by the docbook system (well almost) # MANPAGES = ch_lab.1 ch_track.1 ch_wave.1 na_play.1 wagon.1 wagon_test.1 FILES = $(MANPAGES:.1=.top) $(MANPAGES:.1=.bot) Makefile INSTALL = manpages all: $(MANPAGES) %.1 : %.top %.options %.bot cat $^ >$@ %.options : $(TOP)/bin/% $< -man_options >$@ include $(TOP)/config/common_make_rules manpages: $(INSTALL_PROG) $(MANPAGES) $(MANDIR)/man1 speech_tools/doc/arch_doc/Makefile0000644000076400007640000000670007262605664015650 0ustar awbawb########################################################################### ## ## ## Centre for Speech Technology Research ## ## University of Edinburgh, UK ## ## Copyright (c) 1999 ## ## All Rights Reserved. ## ## ## ## Permission is hereby granted, free of charge, to use and distribute ## ## this software and its documentation without restriction, including ## ## without limitation the rights to use, copy, modify, merge, publish, ## ## distribute, sublicense, and/or sell copies of this work, and to ## ## permit persons to whom this work is furnished to do so, subject to ## ## the following conditions: ## ## 1. The code must retain the above copyright notice, this list of ## ## conditions and the following disclaimer. ## ## 2. Any modifications must be clearly marked as such. ## ## 3. Original authors' names are not deleted. ## ## 4. The authors' names are not used to endorse or promote products ## ## derived from this software without specific prior written ## ## permission. ## ## ## ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## ## THIS SOFTWARE. ## ## ## ########################################################################### ## Author : Paul Taylor ## ##-----------------------------------------------------------------------## ## ## ## figures and equations ## ## ## ##=======================================================================## TOP=../.. DIRNAME=doc/arch_doc GIFS = eq01.gif eq02.gif eq03.gif eq04.gif eq05.gif eq06.gif eq07.gif \ eq08.gif eq09.gif figure01.gif figure02.gif figure03.gif \ figure04.gif figure05.gif figure06.gif figure07.gif \ figure15.gif tilt_eq01.gif tilt_eq02.gif tilt_eq03.gif \ tilt_eq04.gif tilt_eq05.gif tilt_eq06.gif tilt_eq07.gif \ tilt_eq08.gif tilt_eq09.gif tilt_eq10.gif tilt_eq11.gif \ tilt_fig01.gif tilt_fig02.gif tilt_fig03.gif track_fig01.gif FIGS = tilt_fig01.fig tilt_fig02.fig track_fig01.fig FILES = Makefile $(FIGS) $(GIFS) include $(TOP)/config/common_make_rules speech_tools/doc/arch_doc/tilt_fig01.fig0000644000076400007640000000431607262605664016642 0ustar awbawb#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 6 540 3435 1215 3735 4 0 0 0 0 18 20 0.0000 4 210 210 540 3660 A\001 4 0 0 0 0 16 14 0.0000 4 165 360 840 3735 rise\001 -6 6 2565 5535 3240 5910 4 0 0 0 0 18 20 0.0000 4 210 210 2565 5820 D\001 4 0 0 0 0 16 14 0.0000 4 165 360 2865 5910 rise\001 -6 6 6390 3960 6990 4260 4 0 0 0 0 18 20 0.0000 4 210 210 6390 4185 A\001 4 0 0 0 0 16 14 0.0000 4 165 255 6690 4260 fall\001 -6 6 4365 5535 4965 5910 4 0 0 0 0 18 20 0.0000 4 210 210 4365 5820 D\001 4 0 0 0 0 16 14 0.0000 4 165 255 4665 5910 fall\001 -6 2 2 1 2 7 7 2 0 20 6.000 0 0 -1 0 0 5 210 8460 360 8460 360 8655 210 8655 210 8460 2 1 1 1 0 13 0 0 -1 4.000 0 0 -1 0 0 2 5715 1710 5709 6135 2 1 1 1 0 13 0 0 -1 4.000 0 0 -1 0 0 2 3765 1710 3765 7935 2 1 1 1 0 13 0 0 -1 4.000 0 0 -1 0 0 2 2040 1710 2026 6135 2 1 0 2 20 13 0 0 -1 0.000 0 0 -1 1 1 2 2 1 2.00 120.00 240.00 2 1 2.00 120.00 240.00 3765 4935 5715 4935 2 1 0 2 20 13 0 0 -1 0.000 0 0 -1 1 1 2 2 1 2.00 120.00 240.00 2 1 2.00 120.00 240.00 2040 4935 3765 4935 2 1 0 2 20 13 0 0 -1 0.000 0 0 7 1 1 2 2 1 2.00 120.00 240.00 2 1 2.00 120.00 240.00 1665 2610 1665 3993 2 1 0 2 20 13 0 0 -1 0.000 0 0 -1 1 1 2 2 1 2.00 120.00 240.00 2 1 2.00 120.00 240.00 6090 2685 6090 4860 2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 2265 7560 2265 8835 2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2 6090 7485 6090 8985 2 1 0 2 20 13 0 0 -1 0.000 0 0 -1 1 1 2 2 1 2.00 120.00 240.00 2 1 2.00 120.00 240.00 2265 7785 3765 7785 3 2 0 2 0 13 0 0 -1 0.000 0 0 0 9 1059 3994 1980 3994 2486 3764 3062 3073 3729 2705 4190 3073 4627 4224 5064 4662 6768 4846 0.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 0.000 4 0 0 0 0 16 16 0.0000 4 180 375 690 2985 rise\001 4 0 0 0 0 16 16 0.0000 4 240 1050 390 3270 amplitude\001 4 0 0 0 0 16 16 0.0000 4 240 1050 6240 3765 amplitude\001 4 0 0 0 0 16 16 0.0000 4 180 300 6540 3480 fall\001 4 0 0 0 0 16 16 0.0000 4 180 1320 2265 5340 rise duration\001 4 0 0 0 0 16 16 0.0000 4 180 1245 4140 5385 fall duration\001 4 0 0 0 0 18 21 0.0000 4 225 555 2671 1815 rise\001 4 0 0 0 0 18 21 0.0000 4 225 450 4668 1815 fall\001 4 0 0 0 0 18 21 0.0000 4 225 840 3796 8565 vowel\001 4 0 0 0 0 16 16 0.0000 4 240 825 2640 7515 position\001 speech_tools/doc/arch_doc/tilt_fig02.fig0000644000076400007640000000322707262605664016643 0ustar awbawb#FIG 3.2 Portrait Center Inches Letter 100.00 Single -2 1200 2 2 1 0 2 0 7 0 0 -1 6.000 0 0 -1 0 1 2 0 0 2.00 120.00 240.00 975 6900 1950 6900 2 1 0 2 0 7 0 0 -1 6.000 0 0 -1 0 1 2 0 0 2.00 120.00 240.00 7125 6900 6150 6900 2 1 2 2 0 7 0 0 -1 4.500 0 0 7 0 0 2 900 2625 900 7500 2 1 2 2 0 7 0 0 -1 4.500 0 0 7 0 0 2 3000 2625 3000 7500 2 1 1 2 0 7 0 0 -1 6.000 0 0 -1 0 0 2 2100 2625 2100 7500 2 1 1 2 0 7 0 0 -1 6.000 0 0 -1 0 0 2 6000 2625 6000 7500 2 1 2 2 0 7 0 0 -1 4.500 0 0 7 0 0 2 7200 2625 7200 7500 2 1 2 3 0 7 0 0 -1 6.000 0 0 7 0 0 2 5100 2625 5100 7500 2 1 0 2 0 7 0 0 -1 6.000 0 0 7 1 1 2 0 0 2.00 120.00 240.00 0 0 2.00 120.00 240.00 5250 4500 7125 4500 2 1 0 2 0 7 0 0 -1 6.000 0 0 7 1 1 2 0 0 2.00 120.00 240.00 0 0 2.00 120.00 240.00 1050 4500 2925 4500 3 2 0 2 0 7 0 0 -1 6.000 0 0 0 16 525 3506 1350 3506 2081 3412 2606 3413 2849 3338 3412 3507 4256 4725 5231 5588 5568 5813 6374 6113 7199 6375 8231 6263 8381 6282 8831 6300 10293 6319 12131 6263 0.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 0.000 4 0 0 0 0 16 14 0.0000 4 210 1020 1725 8025 input start \001 4 0 0 0 0 16 14 0.0000 4 210 900 1800 8325 boundary\001 4 0 0 0 0 16 14 0.0000 4 210 825 5625 8025 inpu end\001 4 0 0 0 0 16 14 0.0000 4 210 900 5625 8325 boundary\001 4 0 0 0 0 16 14 0.0000 4 165 855 1125 6675 start limit\001 4 0 0 0 0 16 14 0.0000 4 165 780 6225 6675 end limit\001 4 0 0 0 0 16 14 0.0000 4 210 600 1200 5100 region\001 4 0 0 0 0 16 14 0.0000 4 165 1170 975 4800 start search\001 4 0 0 0 0 16 14 0.0000 4 210 600 6300 5100 region\001 4 0 0 0 0 16 14 0.0000 4 165 1095 6075 4800 end search\001 speech_tools/doc/arch_doc/track_fig01.fig0000644000076400007640000000466607262605664017002 0ustar awbawb#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 6 1500 1200 7800 4875 6 1800 1200 4200 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1800 1200 1800 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 2100 1200 2100 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 2400 1200 2400 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 2700 1200 2700 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 3000 1200 3000 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 3300 1200 3300 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 3900 1200 3900 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 4200 1200 4200 4875 -6 6 4500 1200 6900 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 4500 1200 4500 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 4800 1200 4800 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 5100 1200 5100 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 5400 1200 5400 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 5700 1200 5700 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 6000 1200 6000 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 6600 1200 6600 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 6900 1200 6900 4875 -6 2 2 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 5 1500 1200 7800 1200 7800 4875 1500 4875 1500 1200 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 1500 7800 1500 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 1800 7800 1800 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 2100 7800 2100 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 2400 7800 2400 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 2700 7800 2700 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 3000 7800 3000 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 3300 7800 3300 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 3600 7800 3600 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 3900 7800 3900 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 4200 7800 4200 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 1500 4500 7800 4500 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 7200 1200 7200 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 7500 1200 7500 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 7800 1200 7800 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 6300 1200 6300 4875 2 1 2 1 0 7 0 0 -1 3.000 0 0 -1 0 0 2 3600 1200 3600 4875 -6 2 2 0 1 0 7 0 0 -1 4.000 1 0 7 0 0 5 1500 5700 7800 5700 7800 6000 1500 6000 1500 5700 2 2 0 1 0 7 0 0 -1 4.000 1 0 7 0 0 5 1500 5100 7800 5100 7800 5400 1500 5400 1500 5100 4 0 0 0 0 0 12 0.0000 4 180 735 675 3375 amplitude\001 4 0 0 0 0 0 12 0.0000 4 135 495 600 5925 values\001 4 0 0 0 0 0 12 0.0000 4 135 330 675 5250 time\001 speech_tools/doc/arch_doc/eq01.gif0000644000076400007640000000235007262605664015442 0ustar awbawbGIF87aR̻wwwfffUUUDDD333""",RI8ͻ`(dihlp,tm8oF`$sL8TӀNz NK׮[ o:Wh* > 9*m Q Q   + ]@)] I*yVO ` + ו"(  k  )UM@)@%0ˁ1@}1@Au&Kc<0`PHo(6%{"PkShYD@"0 A4ElPQ`T0L_,2 xS*3(8BD `\ &h~bpڧ.DAm6 [x-"lCؾ"7@49R'TIHv x4(+ty&dqKtiTD"Q4C( 2S|NXU;lP7E0D9NXSވD4 ,~ׂ @H0D PI.-PAd"B8PyI47;d% Â]4AGS]D\LI&udO F`rQ&u $;W~THAe0U" +Du񡗀:3`2}eKhA0 H.NZD?R`F8\X\e\ PL($Q#iIhRpN@H &Qٻņsi[AJW3n pG|_l31 P@i1E"#Nj "5Vd`|AU㍂LLꩈLt`P.DA-+p\K'4<:O[W݉7 <} eA[S)Ԣ0{Z~W釀+X@}@S}$K|̗`,2X,Ų8T8NYP(Q1}DbH 3a!@ [H4<̢$䁣`C3``BNaQ$B.Č3+vU$^&GTyL@T5)VLZnDAQ1{RP%: yEi(Y\:vv1q1g0i@ ovF(D(JK֘XA.5"R{ոAꋉRvRC0L@@|# '-PJ 5[l3J:EYtOZĜ<`Q ERJEAՈe|=iEBQ23(LP7E;.ʚYC ]&)$\ߐe.` = hZD |qmMcu7_7sHPhu*CcWX0i`Y*KS;Cc5CB,t3ѦSf^1d7D ~3Yw(7tЌڃ z\CfR j, /ɒBJX>i?o2!jxqD/P8 ;A", HRy1TeC}% aQ#Acn)q b̏ReK^r &1W<yXY/!44(:PNwaS鳦MM( HO < l_X  1L>L- YnJ", ޲ lkAR%6(Y0-)R"[X0c%x&[OqQ<4 j )$!b=&PpA @bS%i+khrH1V;#h7 t8ɇ(CPl-Z.(@1&.4Bos0vpsшR":i :94>/&p|X:&΁o9@^'| hrQ*Z[_}]8lhv|P:H7ĊL _Vq;,@m!:{1]^\]aiq`Cc18Y4̦_t2@}8тC6!qHIm, M`ߎQh< i䫅8I%-2a}} ZM2YB5Z&@::A #+f E9™b7 C=F&gj-(7xgVwYueF .Ӣn-x.c 'h %m` P+yoEq=er)# n9[I"1 hNË0z@l, Gû .oKֆGcpRe0c)6 C|TB0Ã׫sԔv^= =RQN9O=y#%pە$"ؕY0# ppbQNMwPx ZhUУe۵F( 1(w0ꒊUd]yv&2]CbG"EAiq9hPm `]m gQR`Ї'00n6 [6uUTd%+]}'LkTf!5Q6@V+3ym^1pE#owF  PHUK-pQ`-%4.z1ogpޖWY= gzv"x 7i2]-Zn,!Kx~ajڥL|m{I5VX٬KS`;#D)2;m aHaDڗ#n\kp+Nbjȹ_ `ABJjN䮔P윧AyqZ<RЩj=РPnᒻPJ @ aȔ?b [xk"( *,!J=4 ?֛Lm89FJ{R8CP,0-4`*DD1.Xtb4RXiNH"ƞqH[GXj$ GpI6}\DuG#qE!@C})Kǰ+#J0,A4cԟ0=]'IQё\ !4)DͧHeNXbiY-*mJ`v74>Z@ c`/㲲%r8 E'$2< ™n-{P@H`NsmD&*-Q8X|.tY$ܹ9y @J?rp =09]? :0a LbN=ӸTQ{Ht@ E-8bGG5QRItQ:ѫva^ W֩>B + i9QYEnX@6Cmjg<?)X.[j*ڇU,z6 [P"pj3"JbfU'*? i=KX$RmaYRu fZ2e\HLtJ%0i9`f(oK+4 SeyXb*)Y Δ]l!\:tU|dB%˪`XY&C-3(@" *06Ё+(e(Bcpic4AVhnY#-4u@.oO-CzjkFTJY{|#?˜D" pH7B9`9jY6qڍ-pJ,oQ]q=PѾUwHD*VA8Ƣ˲$ۗ8AҒ;>8W΂RR}Uݸ 0uQ2"A}2LLlA; ;JyIUBDN/V ;OJ)20-%DЩӗ^v [~GŭHa@IқWm$V2nY-Tp*ׯ^wQ*xKtuqlm*;2Y&{j7M1rɅ.va^0zB,\fdF'2'{Y>5_%d^ho"7;&03N|:+xhtz :yG'5s&YL L1HԸh2H)LC^Γ^{:HhwRen'So3emq)0=g.G&ABpw*qP71qP[^rkbJoUez@_F#P6uAc1EsbRN Bt{G\ppt3Pt7=PWQv&VFVv&7p Xuo9OFrSu| 0 ;!gDgaB#ףK<=>2Ihh1?ldVL0yvR kOxD&BVc@l8d^3Kdc{N&uGn>hS1ԄT7tQ0agPq﵈reڇ?eNJdzƋEb苫8dg u5 w%,W~cWFZVؘZhcPhX8Seh ͨS'W @X؏);speech_tools/doc/arch_doc/eq04.gif0000644000076400007640000000406007262605664015445 0ustar awbawbGIF87a̻wwwfffUUUDDD333""",I8ͻ`(dihlp,tmx|pH,rp)NF"ah 3a6wG{c]wt6}~4524seUefF 3x    M 2Y  F եn L үD1 Ϡ\ ` y0J1A E}_PH58wJ~9 ؑ!A $@/2@?G0 ^aLX$Y`FB^S(0KIJpNRU/ORK0ɄM܄MnƢtdw \em]9OE%!&x;( 0*m9Eh P(4-Zq1@WGa%j4vX~PaB@qA%v ":¬`!+ڰ*q/pmprCLkL⦇6Œv5 PmP/N7չݗBxP}SD2q_b߱Gܨ_% Wg? ʩw&y%vN( PARI&wcld(zrŬQmh4;$٨uH.JX4YjɥMSw唔|Q-fEe*{tNL|+<&r9m@[ZD2>lv%) 0<D٨, )":YN6mw`Tɷ!D%6vF6goQЫw JNZ9S6GVރϡNLXA}L' ǝU*E ,` )f 9'N?sf7HB @5$~q@+$1 DfLATDd2Iʊ&X>>'Bx9@T%%Dtu_t"6;iQ4*H c@ qwum Qv}@Zi%o6⍓"!P["7IVY|'-%ۡCZl)BҎC_ēf.+#` >5 =|A]{%3rl?L?@ 调 Lv# -8Yff,I(<5&=]Fh3hģl]8#H ' =)x7ZB3` {'%v}d&5G%I@Ԕ9frz:ͦa''A%PLd\Ms#@=JpXRݎv_1.@(^4Uf Tl+2*W83"^J׽f3^3T" FN 6d:Y\yN)#G6 #|WOF>r_\%3Yɘ}ϐd uV^,&GPC8\׭`Y氂pLgD;speech_tools/doc/arch_doc/eq05.gif0000644000076400007640000000574207262605664015456 0ustar awbawbGIF87a7̻wwwfffUUUDDD333""",7I8ͻ`(dihlp,tmx|pH,Ȥrl:ШtJZMvpzZH$ ߴfN8Ɖ|>kn# |5~432s1_0U/P.~h~9 x-    : y,n  7 y\xeB %< 5nh+KGhpYʴ#Dp X1c ["$tJP~q < Eؔ1;t36%QB,TS6 pPρjK#ԤE8ZAFFn%Dka IXB+=}$9~bKZF'V^g 4΋dق'LM%GAƌ9mv",Έy ,N"{EQ?"B 4"n݁=x}`Za MP ̣aqa{#~ pY?قS67B-b&:Lb@T%I>Q- "PV3;L5XABX!IPM9pP)En<IhYe (q6 Z h :$-zjK$$IiVȇ^)*2*^C@@ hQGQAjf(7`M#\eK `a^@dnbW5Y~Afj `)*+-Y9P)@[,/ִv//6=Xji1]T/]ͣ@?Ex`csAIx|E|2$tŋ+U-FxLw!,f0ésV?:rX5dȇR"@#9]p<!rrEDPdF(llFfemqJgr61ьJf65l54ag[1g$4SΟ;aLN]l"!R&'Q17fbM'j-* %zPUPuTpB@ľjL4 R."8VMGeEVs|쟌H%,*uJJ^jA6e_[ͩc|R!= [qz\J g[62,66=zIi0UwWp%BRx:bk}1z=bA)(.2 SX+"\gGOp k c`O̺uƔ}qTbs ɂ&`/G@#9LWF<\.L90 _A@CQezQ2&"%TénӜzT (a E#]TOۇ]]?=Fvh4j ʅihhԔu0g(- U R-kuf`= ̻ D֬~#tٿczDV['h{RȊ_|ڦzIBy# +7W c읧o yz̸/7fLoܲhr(P4y4gx :j a Hh!z3F.t~tr8tC1SYS3; "xɢDիZqDIO޻9t dө\Q) Y˜fO;h͂ĺϝa`cUm,βSU22fyІ*岀oWry}[q"uI&(tul ֞X>^_xmdyIwg֢b6rTmU?9C Y[B}|>:$eA`?W`# &-Xl7 xz60@l&#QrOcJqU2>Pr*f~3gqtX‚T89FwSH9 pvm3>_W]5 J5كH_HbUQ3LJ`]K6f\7~GPUZM46{6u}Mw 0(*E;'0ix_Wq8j׸ha6bx;XhKFNd7 eV҈W9Yy0;speech_tools/doc/arch_doc/eq06.gif0000644000076400007640000000431407262605664015451 0ustar awbawbGIF87av̻wwwfffUUUDDD333""",vI8ͻ`(dihlp,tmx|pH,Ȥrl:ШtJZجV x۰AsM'5<#|>~=<;:9y8t7~k~=6    xi  տ:5 ` ]8B<4@+ћ#@ 0 A837<%A)@.@)xRBtYx8c @n$85 x5%pw?zv W(d`CncP`%Ak ؁ D@)^ @pw)- d$}R;v0j~>N\YŰY~a9uR2X-fQ||]#iV]^gsF2}'+xxWfY]+ Q'@hͽDs%Z38!6!#H 5`HWN,4n5$a t3ά"c*b7 r&!rB3>qa;_:dB.VMPOS"J&\؏%eLBtJg 8QWK]miA>9X[%˥Ȥ6'xזuZZ=m$i9ΘQpZ9ssZynڤ1r dH%=H|,$ь tizbfTlЖsG:Aȣ۞V,27d.^DB䊾`fݴh|ιwOTȤ^g3Q6SUer-KƸ,U.mK<\,Pus3² (2i'[nebW5%so?\+S \4^d-/:TI10Y bpEd[Ƙ?$Op2 ,,RM^yw( 8/萳NðlN@] & 08ՄWg sA?PU3XYUG\ ICqS= +~QtRLğ"A?|A g& "19 !IO֣4KJ1PE]w ҉_SV%$M2l78Y+Z$?,s>*XexNz0 Ň04HO'D4 L>w`BJhjQ2|#ipt1y,(4 op,$G9O2ܩ!9B`pU"̀6Ɂ;z$B"I@T~8+o6nK2 ~ KW1`:B drGA3)d )c>f/죠PACJFQpΚUAZ%wsH7=@Djš"p@T?$?# T(`y,*Xjr"s͊BяXIW:$فE0YŠD("t Lu=ԣ`i) hvPQ~LD͗N3ҁ?oH΄?>{ӠRSK>d]QФR4)P{>Vm~u0vp,n?Û>B@$(9cx2Y#1f) Eo$HjPαu&0*aγ-`̀o˂b`Uq/`X+ʃWbCXUЀM|/ F$%J&'A(FiCeZpY1Da`+M>c3u4i "䑡R*ah\˂un.Sj_|5a0to\G5usa'06ceWFs d[v ]Em{Mr ;speech_tools/doc/arch_doc/eq07.gif0000644000076400007640000001254307262605664015455 0ustar awbawbGIF87a̻wwwfffUUUDDD333""",I8ͻ`(dihlp,tmx|pH,Ȥrl:ШtJZجvzxL.zpn\zF`$~gt }B 22!10/n._-U,y  +     *߀(XP!\ >̵/7 ˖@6(A;̱xY,Ipإ-EN>i˃HF!9HσHC;su !}b`P`` NhF('PvnPac|H""rw"HF.r(2HcZܘJ$#>{|`8ÆH&}x_ȣ؁I*EޢdbFdvbIޚQ99!YL'fp>ꔥI 'hv5Zw姼Ta"D1jCƚO,tvzK k,0P~(Z g?hť-D-8X)D;)Z(!1VWw`w8O@ t\N z0t П901%qWP mGN?N+6,`K)@$M S6좀2,w$(p11tϾREUh5A O23HJ3>Q]\u!pMMCr}N.Z@D&K%dޚs 8bTװh,2UJ  z1z;ͳqs;!z1֥Nl" 4 =eZ;Zki4m8 G;o.2b<,} 1Ylb+-9"@tXN8@U.sdۜrFx`8 V* ,H45bV@ 6.%jCD +  !N`3 X0_en Je7WUh,\ ɸur,ǸX& t$ۘE:dUcI8ȸ$cȶ6:AwwP  p(9+"g'C݂FEa { Ϝ *,$N HjSҤwvnqXњ0pG N㳰;d>4gZ%e"Pm*[Y0iej[eAs(`V.Vx GX^P5br7wVd*OM ~$5Kqa'#2sx8ü}hLmҝBbqBeO%s$JSfɏ~:Q9w iO}Vns- TEބo| (X1]H7 ]UY}_[Wպ:K>.IF1t'Įu~:ݡN$ԔrX#Kp=iMndif2LJ. iHZ!v$KA<Tm9~Qy-/*2;t$E&Qc.$A/E1I墳7Mޙ#KU* )25 OTxi5\Ivٹ@ yq=&TspT.b@MP6u[RN8ጉ9,,hEKN]2.r. ZWHZҚ0V9NUÊ޽,q5,{V_|,lV%Ř%`o ^;=)˭RtaD֗g#-.܌Cd>(ӷ.Q'ѹ@5HMVֆwEzu!iPOXSdcWwq6x [Œql \vN~(;IՕ ]4igֲ@wX=7 1HhuK[K.ü$6yAx.wĘ7{ &Xtb GZP<|.#|$T+ ;bRJlH#J=ɜwwgPA>k$ 1Bɸ豾ھ\2@Evd4LXM,h/i!qKv9Iųë|  jdAGz+PV2DeŴof+),rulӸfk{:Ӱ᪐$لh^sxĩc輨r#j:U7+$70ԸB1CR?n' $t=i؇̧`h-F} aR$ -쟆Re5gedteQfS ,&,%,3:3;uXFy19AV.Gppp\RHrIcUd{5s^]*DqStuu{H [ic#>Qo}]d'yR[$iݑz'S )+mchzH_BW7d[$hfvqk@C W]= u,Y(|,# |HV;=ve x=THz8RsehX(H$x/t~^0 pj%rd r1+"i$9&UmSl7l<+#= zU<Y2C,CR%Ar}+i&phBq(D0GVA'ypC-@]&gFEUWNW\'T9(w'0 hMgHQ1S2A}Iu5|vU8yTI9GXE7 x3WȐݸѨSG^Y5U']p\Pba0V1 6g7'p}xC.75ܙcbi:yk 9ÀJdQTA+dV"`3VKIgh>h o2XW>ZEfHhU%yؑ$iqH1"`a!#8)(jf#+CB1zI-Zj7yPQ8gVvʟ9I}ʎ6 栧#j J?ڤ )"*Zr)\dXZ @ V68'$۳Ʋ9fBk?)H; :\F@PKKGj!O[!%㑟|\ ױ4-.7:R˴l-%Ҵr[tkmv Lr*̰gY[KY6+`Wik K K[ + Ht3"++`}T `@ƥVb @aY6vk1k v B搖U\`[0@\%!@ QmѻWts^y])p4I6gCA\!ȰH#H^,1 ہG!*y~ K3` \¿ ۸ S>t&N! , 4p5.'T72P&| =Eܐz'.:eR<< Αu^snU?x2Q#( U10cLU쫵a>TGsZ*DW̓F2V[B UȖ˻lLʮKl5P [ !X7F 8H)YJ)  ^}PyEØ;Aho!ܦp( $7cYT !Ac 7LPQh>% ]~i8iYh ̴D:ji #&AH=qvɊ=!7LƥUICUDqx˞FzH7zp4)VEtQQ xR{+·. @I`ig*=^ɻ=ݟFʎ{ʬ|]ʺK Ng;ߝ05"[&mʲKĦl,<] 0ٱ}l Btz I%3νQP>p:ԚQ%uPЌ; G22'Jߜߪ7y#Gaj ]7U9vgkPʋi3W6}1UYd^v4$\>tQ'gUg  !ik{ ~J@ۚmM}qs=DSeQ9xvXMj,S KU(+r\t5}í.rJk)Cэ+C롡w^ ֟[߬.!uV-Hj^NNn C{Z~&P'n~,9 04_,8:-5> AO"&E/)NPR?T_VX';speech_tools/doc/arch_doc/eq08.gif0000644000076400007640000000712707262605664015460 0ustar awbawbGIF87aI̻wwwfffUUUDDD333""",II8ͻ`(dihlp,tmx|p( x$J0zf=/H$ 9 4h ]5{b ' n"vY# `iAõ=̘Ȳ#chO\lv;NPA!0`B(` )P@hdS%nbE th 1J2)Z6ۙAXSPD3H&:% !FHP@@%+ 0JLՆ@vٴk)w M[§^}%x`r 2fRk-fÚk^g6CPB ́=-, |/gAl kO[i{{NkjӦ[f\˻;'(x ;\x3jǛlT#4@@}@^}uF~^$~|䗂 Rv7!!{u `.GrȢY.vx ƈ_ @9gWBM D(IIa$Mi@&8݈`8Ƙbh&𣅍g$v.I&OF)%VV@Q$pZ E0Z~vEHEǡnfb:fGj \ghZ蜉lU*ᮧ:j a"[m|ҨFa;,0ۀT56Qg4_7p)U";_2k$.|˽c<,YtU0#qv݀,m(-T|˨hjuJp@!f֏ Dvq~%35L~5M?.M򅐩^9Fu"V-4/6\u&f 4֒M0^=%[8EJM6p 9 5{j9|,~e[.YڸрP.tu~8&:s:_PI肓^ 埿~[ _6QV  * Ї:9R3`'83Ă qM<(Ls엾a^n(!Vh:>!h1ꀈ@"DX@@J M(BA\c(vMd(qǧY&|Q##pF=ج9aP&5hs!ӘHld(/0J^rsDrA c ĥ"G-ҟ]v?: VBj4ˆDâZ  a4+)K Җۄ%2LF֤1Wyp*S2<3k z :PG1 S f:G9"VI&gͮ,Z-ix9?)dj 4h8zRIJ(<$j$4(f"6* 3 o 37fR~=Dc@SnLԲui6I*SAxU/D;Ң:/iX@jPr6 W/`vT*YXULLb[,Υc@*PY~Oi1C_,eہZ,`) :vp,PyBpb-.'pm- RΊ u{׆,lp/DŪnߊͫu^r!eTN"1UŢ)6$Z"@W< 098uҙ@ (KҚXe.1vNlOWQDVn gL=*ǎ[|@9J~% .XCwyIl]֚ Je)7;e"LFU,+B(AE}, 8 q]b!4|-h$EMemfen& LcJZ2:=RHߨ7iK5e &J!zK>od\;ӳVĺΑxߣ"5`P '5 x&2ql)q^9KPE`gky|?Y;9='o<].{g@B|vg0X;d ' B!Y6|aYg!14w9H +-0%l]~`"Qh@/58 ^FBRu3S`B 1x1yZuB"')6 UUcgXT houY'57Segd{!B^ր"!4"OxVȃ0,H9QrgJk7 buЁ0`hiq1؆)Q'6H\8b[Z$Yyk&G]R8gr(%(`x(G%Ԇ2NŊN[CEyB)rd\Ȍvdi>^JhʒA؊Wь{_X,؍Ëe(RChT8/75Ž莫HfFcY[Vu2ӎ@/` Eq@8hO 1 )$f9r#9Y,Cpc)ӏ+7|:N3 1"  hF}sȒD )1(8!sddZ}N9NhcfYc'gXHZR/ARdY6Cz6PÖAHd2qPO}G5rb>rf2fsjkg=S9C:?(92:0i$eGQrvBVד<; `9h?=}Ӄ)w%"I).d@>c0Atq+锠Hl(r);ɛ)ɩ)<0|sn{D-#ْy!)˹(Y-i# ) H 0yq qt*WogpME p%*pjv,*(p.o wA3Z9Aup5,p=jKjCIYpC rO ;ڢ1*S AJMYJ00`ঘq/@Y ,d dK z|j ~⧃J/:Zzک:Zzo;speech_tools/doc/arch_doc/eq09.gif0000644000076400007640000000757307262605664015466 0ustar awbawbGIF87aQ̻wwwfffUUUDDD333""",QI8ͻ`(dihlp,tmx|pH,Ȥrl:ШtJZجvzxL.odlκ:slf}/ Y gh. _ i]+\ði'Ygū0Wedɷكh#TrpۼP%4Sq L @ &"@Pᓁ 8@ONi/b\5!G+H%q\j8!#LIˈCe0JěUEDJ28x9Y HX뀀 P-QԲ[B t'04{V Xb#} WBful5†q] 0/Ppusgbh _S8ވa`@.o5҅AmX6dEX <&|T)4@@W} GqF 4 w( ا][f! 0 `( p/R!p 6|'@#J:.H 8AEl9G&9DL*WWPf(%VN\#*)!y8d"CQNi@p@;i',K$:r'XtJ^P6 RR F<^0$yY& tJʍZzi)'린i[jj)+zv>f"FN[E=WnV@BK{xWqASkR"%/|{y i{d lo`$0 On;o slA;+%WRL@j;7h z"Lk5|w5[HBTCznFbN?>wbjM5=Sէ۹+8GLD6  4(@9˵h*:}k4 9w* f~xi7ޚKkȾ9?P_z,BwMʗ} [hk.~ o= hzԿۏ_-I!Ał帎Ag@0\cQ`z G% `(L ; `0! mpA"'j `30dCJAEMaF2(ԡ"`Q0b`>b5@xE4N c;V7<0HdQsȊ| G +Bǩь3>rs .K]$Ft) { Zj8k#L,9 ,0KQ|ҥxgG%V%CTf+ɴ_2e/ L lFA6%pZ 3myhFg;x-zD3{`:fHQX TdrgG- 8LXEuemJ)<_ɕ04$Z*$E%YZҘt20eKszP[64I,@u3 Sz5*gUBa x6[6MI# 4mJyMvXdRD,(Neg )w9@{0,Q1VB]lc?KςjAZ֒J-!/ٶW6Dg: ݕj^)4d͸|l;[b `_f0GU!!歲.Do|wx#)%SczT)^*T-{w1삏+y.w͍pz3ZBJeqIe Iv` YeuBoC_(H2a#Yذ~cE1S) 7p~S3XdΌOdȞYAz ly;D '#)% Z"BM@KKOZsk{vi;66h:~ۭ#W$pB:*('@ɾygl\H+s4G"z?` @ӗ9] knlY' c^v0@JHxܐPGGT+OOڧ~#v.ڻ/ 9UR>{ħ=jk6 IػΛDk~]GH+ h> e#7Jk1?K1wE|3_=Ed_e2}c Tԡy/? w|24)B!\ dPAP D@A DD[` dDbāZ c@ gAX6a`!sZ B@#FmF&{:o)PHhf ]yyCPLn W9#-[PK1>BhR3G> MaYу@(q&Wd7|8}؆X{qFW Hiqs1yp  ;vvXW(r18\؅D@`.8"@2wQ xnj8Lb%b4r"Z8h5 %rzyugSۆH5 3wbCQSq Rp!ᡐߘ(9(cw(la!58Nd (䏊B!$b"NȎD&َ1;i=Y#!@T.$IeK.b&>pV YY [@Mi,"d3y_Y% 4CWQk'NObmA$1 V^,v_R'ivYt$8:(ْ?y"w98P< tYP)2r%VJR= Y,tYMFJ|roy"qyzL=H|D:I>%xٝ{ LYCS3(]s`" oVVoқ]b ù0@);$1zW)@ss +9)R;o7C/#Ygu&rZ}Ze CFVBkcyo@)+Q:)L*3q%O3G5slQʟVcw s|zy&-a:6jN.n]q_oϢטz-k+7…9d1bX$Z,xZwXy<űIF9|ˣNB<[Ti'S>̗HJ遨<=+H]0jTRQA=SR̮v$Dlؤc%L,[m$<7^{*{x⥁m=*T<.y,znugղk;ݼ{ <1Or\$lBsGKW~]K۫+:I1xo(o"z'둴^ػyuk_|dX`ݗ18a} |y酶{!Hb&b*b|Z0.U5HLj;ㅰ!Gb8. cQ"ʎQQ`V)1]^|vғI cnZ] .w` Fk lKPlnչB>'\n*8p% )L$g7w3r:;Yvܦt0VO' Wϛ-تȰ/fߴv3 zqvߍwzwxl[vךT6wONy_G18l/nz:h꙯z뮿{$vn㦏~{{|O||/|m}e*}j}}_ax[R-x9'r&OjڿERR80X Osa*h B2" ~&3  ԭHPNF9?kQ0CV̆(tQmG ,!1RVD/]aE$a1D '.p1rB+e~Y}( 5#Gx(,ч39ҢdO;ks`MX8Fm"G鰎LANz$DVi `(hh,Yh3b+nESiVR/ ?a,H519M:Vg$e.7MlV0Mh 0ٴ9ŹNtR|d2ILyⓚ씟WVZh

$@Cw\*km%ZȘ]-'z: "f {ţ UÕ۷;wρEɢ,slYY6:B@ݦ.b1G")v[eY5lY*t&u0rImdmxnzo eKGͩ)E2Zuʱx,aˑ<9[Sf;SE F\׻K^,}TM62ީRO}H*%1 Jz UψH{:`,v:֡o:` MzI|M~o%+=[1ەF77ƫ [V_PKE{o^q]w Y=ow2gt}87w7ws6ݠ&Eu9R&WUwVr$8nǂсw \&Akvw3'uq=9Apc6pE OHUc2m&tBu6rm27+)AeG+&FE|gb(%.$wHTv`q.gr#Ȇgm7yt7ķwD]xxCRt{\+yjUtgYÅu&XyKv(Ȋhڂ{\Ȉ\aȈzzt߈gшDGCf4 4ܰ^bPndXʜ(Dy)ud$ Z:  u0j]sI`*eڙ)gY:j+Z$3hPDl vulmyŗJvD D!ZҫGj;hbhšVzpbG(IJD*VAspE91j*J+#d)zns鹮6Vج֯h)qg7ꐏǷbG*ڰwZ2[ֱ=V*;ն"{q.;(_:{8q6وEKhܑZ*SKjy:s:f"Wnõ mUik+涾FcKfrk"`K8UFl jɺygk{"&_[KkŸ֚|;%k󹒻\ַV  [6˻Zպ{8Rzuq3 +ּx[b{˽ +Kˍ5CѪCK=ZOK(@;I0J\Kni8 x̸3ewKlZ/Top܄D)Ms|ʔ$n+| ,FscmӊIBAܸD4G"PCDEPHM*PlӕIZb̓vd% ǯ^ܪcuDjjdft[̇qL6n\,i*ȣ8/©7|!i6ኵt×,ʙlNRfɆ,&㸱sį<3˅z˄\ˤ|Fˬʾ\ɒ,~9LY̸̺ \̜ʜ\uYTch[ ;4ϳ\m оR;speech_tools/doc/arch_doc/figure02.gif0000644000076400007640000000552307262605664016324 0ustar awbawbGIF87aK,Kڋ޼H扦ʶ L ĢL*̦ JԪjܮ N)}qVC(xbXxHY0)iҹ Z8 !ǁjڊڰZ6 j˫K|5 q\|4||<=Mmt}-^'q];./</nQ﯂.l 6ὀ!"Q8fȑ"AJ)W| 4̬3Ν<{ 4(5:8pC;1<o,sh8ao;o葴Qi}Ƒ7/MC` HаL%]k7zD‚JXXnU4aa^\Hљ 1RUhg,4u8h(u Յ󫐎@JW1a *p\XF/Llo\rt ~B<F+c [tD'j=shOXS?Ѥ83b/ کjv9Z.E}R!y#5fN\tlQz~ ;u#׫{O"D,)&v:Һ: >:;<"ӎ&;˞;jXİoo7sr/_^3[e+36/??<@뛟җ=D oo#!Ӡ۠$nr_⠮Qe&&T@H9$ EȐe!g" ujƗ6pS&=4$&)>zTΐD)NfFUY,nmU/ *2S\\0wKDLf$L鱪фjb61=.Yΰ Ӱ:kB'@+PRLOpiMy5CX AEKo.Q"<#}$6MS^4 _)5*Kmb7` áV)BSutW+ԮVe9Ĥ+N"E F Xͯ{@Gp6˪?H{,fYJkfuOC5@84bUV-E <-;{!\N6 ]Is\#k>iTGo"lC$ Roxkb ɀzdzW9dUrmHg2moJf]V'_H4eoGC (2+k KIW6 swL^LaXL0D|0XN8fm8 \m񈉬8Ban.PF=O?"}M_<0… :|1ĉ+Z1;z2rH"4)BYWL}/78Ν<{ 4Сn> %22SԍS Ut֭\z 6XYEtb7kM\8suXw޽| 8`#ynÊ2V8an8[9͜;{ :ѤK>:լ[~ ;ٴk۾;;'M7pO ǠMGI+qS)ܹsOu{߈XMzIvjܘ/F9@hY<'he.W{1ZpY_馧)] boB kJkފkk.0k$r#ajj,IM .H)t[{mv:. 6*Ry ri(N:%!ٮ]oI\ kïQ# /a  kh$(5o2DHY\r\+K;qΒ2S-քLDӜ6] ͵L=s=p[qieI(mHQ>ĨMbހs1y2^wF>%W"zf]㧷:k3?{{|O||/|?}OO}_}o}~O~柏~~Oߏ p,*p lJp/ jp=-#?4Ǥ%X99*#K*A$ ƈ,)OOL[,'3J$ƕD-o\~x,kU:Ad,Od*s̄1JX2<滌9M<7 ps,9ωts&.N*J ڥfyuit ;9=Ijű&3;ֹk$7QMeϊ;<@m$PEu'T:׭2`crZ76?2)2QNYmilРjtK*.)7UˡФKS(bt_J aR-)Thǩ|q5n^zIm(ci_U& PVbQd]LaiQ -)P(QYiOԪvmmT{U13X.LqVmHGY+;l:ӦZ'Ti!œ&]!zv3Ű{ْ\3z5RiyެAsE Vor1UC{YWCrm ޤ~5bUՒ >.[(</.K-f(5n ,ha31W;̟`R8PEXgҩ|-y͚T9' fCzo!b=02sdp<8n]lD61/(0ANꦊhqNtJA}c̵n+2v,լVYݚ.ծXZvl[{^ hK{̠cAlk{ܦ3];yBgs{J#鶻 x6|O 0_07Mn`=o Ep~u<)ݳxp>Q_=xc;ׅksď[r48ŵw^#o,n/=ù͐c4!/Ep;Zs>qșFljYUy[?EN0.^_سgbVsn ~w^ 1k/k~?Ћ~/Oԫ~o_~o~ /+oKԯk/Ϗ͘4TܯpG8q[OseT o$^h_paDPdFa0[HDo]D2Ɓ7(QFFxQ5B$8/`e ؂68~:<H@DuG"ꇄIKȄMxNJՔMTQnSXIVHO_{X(blLU6p sWmgTwtVfhvɖswh:`4 \$(t)3يҕIp]Gbu(V񙍹%eu&fxt9xyEeg)|e>8ũ6_/{ɓZhٕY`ɛW64:?;"ՑH-vSU1v92W|I2sğ/x!BP *Jj["dpToe,/yxe&_ iP%*2+fӕÂrrI憣.) z5(wqr@ "B:Glb'DtUv OW tZ)\ڗO&SsbjdYWESwhlZx T%OޕI^Y&ÚHirTbbE$iəi7wH/o(kx3H*% vӨ򙩚!S(jw:7x b4sקJÚ Yi-ztj\v2Ūnp*cz)mzdgb8-Z$cVaiWctWkAyWygŊ\YxfRv˱ !+#K%kW;speech_tools/doc/arch_doc/figure04.gif0000644000076400007640000001633607262605664016332 0ustar awbawbGIF87aAi,Aiڋ޼H扦ʶ L ĢL*̦ JԪjܮ N{XGXh50x(yɣX *x)zBj`  ){kٚ닺 K\Lh9l -=M]m}]Y=N(h$^Ծ?3x9^? N/HMR/\s*1$8}?& ѵ 1D 59Xz`L|%4'u)d8?l1$I>q fK=" 1kDDA5צcmWVԫ qUR gx]Q{E_~Zw]a>V/MxSV9gfɍy.Ѥ?.:uǪ[^°R nhs z08guAۿ?~ ԟ&vp`J$h8s/9uWa~b9H'D8 S*Rȡ.V7Hc>dIA'nӌU#Pd}Ene^eTZ^M^iP#jzg hF)gSwֈ0(oYHzfhni#Xi% Pndj>iƒykJꮾV檍Ɖ)l.l>ANKm^mnm"TfԸ掛ǹ. Ct / ½6q/LpD˟5۰+1SyW% q1M# Rrx'3б-?2z+8" `߽u5StI]tHl0K{]F1,"W\W[[٣朲_M;m]?jxDc7[,7߂ 6 k6(uֳs᫐M< w܎댶8Z>9-=8뢫8bb^둇N26zǎ;d5 ᙟ.<궣,S[o{L y+*y4<#Qzh>7*Ύ>O| },MO̠fIW ?cwtBG@3:*Ǩ*=FPRiPN Ԥ4ySJkSPTw]}TW=[ճҭv_a95eV1V=QV^K1 #hםu\S~vflU2n)Ye-]MKM.qWW[&h .o{k6sq_.R~jUIJ7kRNrp%o[^%z[ZVl]3u˂r_k00_c۰ax-wMFN8Dqax?&v̷HT㠉a\z6{1~vőRd3֒eD,Y,ggmU2M33d6JC#5YDs{,3R "sp`h.yÑAќ{4s.ڪ~`:]OO'O eP#գV|YRG֮1%V_Zּv!k.d+{%}^˒,^J2]m^ܺ"ɍ,o+Q;wi|{ |G >0An,HQE:pZ.vq̄=~>c\1/Je4;6KF^NP͜zbp svGQak3ުa\pMY/IAKv=!WG^mf'Y,~4{BJн;˕OyEq| nnYrpv=+m<䂺9sz}TROأ}#{%wE^'/aC-ͧ~MOkWZp1ݏ#a7D]ϪMVn>Թao(w+ضX ӠGqhq4â#"tBMXS m  #"H,*W5(#/؂&m%=X ?8hHh7(!|r&U W,*ȂM8`1KxGCƦo q(@>8^( p+w8&6~{Hu%/хa{/6m(4h(' h}xx})8^(؉2SA9T 6^x(+YyȇrAېr0Mm ׈wLx x'A~$  Ct~4i1w> g~=v @JYTPjafAG ؐwnle9Yuؑaa6b.aqS2epk-&t1Iz!3Rr1sYǒ%WV'*|I]${Xs2|CKqƐمf6T #64C_w\xő;拯^jkT %`i<,CghdZRd7|^S7^E|YvrvxfgmYy[YU'icQb9ty)_喨ՙ隐\Xda$9vIUɚS降Ōs&)TȌ䘜 rCBzvn*F]i/YܙdT5~0dSFq*&SvCĝdY~ԏDM eJy zK՝f֞QH"tUNSOTeC5ĢWx zSL4eԢX&P1G# ~0ʣ6ip N-A:5TW픐L9?TMj;Y*^.%hUzWj%ʠNFLzmWqX$OPYE R'%R_d}l 3I/1R|LRWYun [*~C|%u^_"TiiKgCi:馳 x5Uʜj۵`%ڠiX+ڜRǫ Y١VYsY}*٭zZy)|}]j ڮ*ɵ::ʮFz ^ʬ}F )ٛiȭ)VJ׺u1z{{Ŋ*)# +(J e -} p +/[iG Zv k9:Ceky[`sIvV+2cgaQ[C&BxP9`0V.Ɠ\ٷ1zd{W1t¦7 ji3а+tJ;`:mᚹJQ{%[ ~˲+k +KOkX,K m숂x;xȼ{?ȯۼKʸ-īH4xI؇;Ⱦڊ- ҿGVK;OH[P8\- b  brD FеԘh(-|y\nFh6-ʐUHiYM [}YX$cͅimo q-sMumwy{} ؁-؃M؅m؇؉؋؍؏ ّ-ٓMٕmٗٙٛـԟ}4(-ڣMlзݹk1Uq+jm=&]ڵqD(k@Ma]=W)Ccn"ܼMʥ Vϧm<}~|e橣;;ŧ9K=4EQf-7Vїl1~df뛈LW-JxFX J%ދXG~۹ n8nxL!b֦H>-%Ž3} Z@M{Ǻ ޿)r}6|k):Xcwf~-gPے]A\ Op yنĨ}d@ƌ=tu@n]^<QdrZ>{v\> l u2vӂb_w.ANL.oWmwqw?i1}x}~zҬt~Ay1ݮw9KЍ^!B#K}ҼneJ/]> u~;l륫9 hˁlڌN9Enا->L.;h^en<\rl}LpéL%7 X{:x l"  .,熃\2o6rd%Aq!?_e =*/@,Te1}.D1TGe]>?z]gvZI_~<4/ b_L&jd#np rUm^BQf6\>2EkmI܍U|/߉ni5֚ݭ<̝: ֫T?GoUr~R,ɯaOm OH;ڿ<Կ-{o//?\_O@O1ua<*q֛wP<ѴTmKAO(!ɝsdVgZYa>\67ivc^jK  &,#S0u63:o@UD9=MOdHQY[]_QUagikmoqsuwVGy|脁5a/qy-8 A)&L8B8qAqO m}/ȍH0ʋ(;q94SZI !DtPL:A4TOżD#Q]8>bhl[{A{6^M]4nK:\IT`4:FrK‹/e!?Vbg!v3gWZM´ؚva p͵#\x$$X+,{xs3cnW#8:wdxOgQj'=l6o@J1>~O"0oD-@lM9#|J(Y_$Ŝ^JN<&Tm1&YD!k#KqDKTEE]`҆K%I3O62RMj' W}vPRϼ5WVSn-鄷V-]q=] 4^@|S_wH[BCT=[5\I޴ݭW{ XᐷdmeilTTQY)6I~wևYd*VAumfr-ͤq1.❣^rW>VM ]]aNRnBCiJ=K?{I{[@f={::+g0D(y?xt;{㯇{>ҽ??]_|WMw(S m=跾剎hW6)%`@p0qa§B}% A:Çpo}B,zhEJ\0C'1WrAsE,)ZnCڄ!"h3p)@plӈG؍ HA4!ɇ>&#!sH%1IMn'SJQA4)QJUa2\+'’0+HZrU /2.ghLeC\3dBԐfgfSn~ۨXNuBb^jgM~N- 'vFiLA63YHDC Ь lӄE)8լ8G]>IQ* n.2-e ]-42yST;)`DS:C5jpzTbKu*nT4jKjën$WOXC5J%YEf5mu[WΕu]W}_X5a؇;speech_tools/doc/arch_doc/figure05.gif0000644000076400007640000005177207262605664016336 0ustar awbawbGIF87a5b,5bڋ޼H扦ʶ L ĢL*̦ JԪjܮ N ~'7HXhx#0p pIV7Y c @6zJz3k[[%K[v{P KlлI|8K$-]-͝=!H>?NA?#\P0C\ W_3ztl4v-xGI#6dpmD=ԧ-!htC`-eWrΉRMmh5 ԥЩTCJ骪֭ '“_ÚȒγgӪuƖLDՄ4RxJ~69fcK@{rY^[0\M6&'.<:-zRm_v֤kGrf{%/|eqεw=xәޑqٓ__֢|ם'o[u (^``>aNH! p bTuU$Sl8x!b:˴%Hي6ވc:!>$}AI$E#~($4d7.=68BL"V~ fb"fciɦvGv$8(fZ"ewbe9cJYhʹhF裒)p%N[5)' * k*kwk~j"뉱8 ^m JmZmO _O>}/E?:z<{oߋˀ=٘}קoCďo>%| ؿE.c HH/-@`0`v#3( dG@ P/3L Iʰ9)R=PC@_ o#GLab =KD7 kP"!H/*}9hctc^άqstGQ~4GjD.:/~d#x HBfk#sW1cFV ౓d)cH4ҕK-U9EQ5(Zn$,!IH"0c)2Ӎ4eXbRә$]Aj>< 2 9Q"hR3(Ɣe3Mh9-qL~ҟ֜6sNt$ I˂v,)LΡtg<s,ў(C~'h!A9M\4(BWP4hRt SG7#FŹGov=f*IP9iPAFg(:mHVUձv jXNZ(DɉnZY׏u8XDdE<5fT,G$2֮+j^yTuacT-=hFRrT7^vUjR,s=miDUMlnە 5nsK\>t. ˧Rq5-vMpjh͋ZVA#wu9]Wo.}mUpv׵.~ \^W½o+`Ѿ/| g0uhT#mz aX+9\cߘ./󸿽#r< '9 -w[#KQ.]{Ds"-s2d¬1vf6Sure {γa\4k=ި fv](~.@=Ҝ? PzԤ.OT7n76XCL֡K2Zm޵f 2ZgwhՄ _#{پ`g{׮2vͤ]7gT=)k&7vtHv hڦw٭WhƷ~g[DHm)%eo7<1g|Y83w"DVLXCk?樈9n;:gS-~n%_7NGɼ_=yӟtK6S[crZzφNrgU쳣}j_>rG]pWׅNc]_w ~wa">Hm'KdqPv<2ˋCYU~]^Ҕ7w }ҁ)r /xz |i^0>gbе)t滅}׳A'ߏ; ~Zs}d ';|#;m >&whmx4yas9F%)HxbTF,vPQ.(Y$(LG[UekK[[څ1+c˼›㦼kU۽{K6[;[zBڧJ;aKNiu[̫k{;;ዯ+Kn!Fa7,|hjR[,\f!ܿ% zG | "+57 <4"*#*{ |Ɗ:?_8M żKb xr=~\Ơ6@Dlp'g$>@d #v@eܢwl+25 {LjʾiB Hvt֓#-'je+ȫ3eiɼ;?Z KmTz|Ajcx bTHQ c5lbZηc|"9Lê,(*+F,ov"q3\q{0}e{ gx|‰(5\rp̉j п<(t ǟv\+W6z$ݞwѶ[-yFI{'7)?%}/[:j2=B8 {6_>D-{4FH^NJVX :Y9U-lQՕb֋6^Z`=;^ d=?A}G]Wh}Mc.}]{}=ՐMmЕ퇔m2˙ ٟ-ڣ=q-NG'nr+xک}δ!`kk?k ) gܡCŭ~lɫУ֭/ս 3,ʲq> >MC6ޕͳڻl]km߷mMthvq-w= o~u > ^ n=e/];W4;n*9@+6~2't,DNM>$^(FoByVa>WN[Jk.}\pHu6i^N;|e^mg~;.N>wԜ烮s^z=Nn..켮.k~^^ڹ~2.=^nwlNoľ.ڎ^N~6/AJ 4"!΍tMm8O9_44о\ʎnnL oBVWY(_ObOe[ovYjq/$puy+mzo+yw{+Tm-քԊ?Op&@]ԀҐؚ_m֞~xkiOD??oט?_j/ظ_O_ͯ_۟֟؟_=ʬel߸ /?L#aӨEq֛wPOCLlA |P )Lۂӫ %.û+GL1:Ulal$aDB1c:Pl*R)!{J*C RH$(,s3l|S,f0U%/s8InN™Oܡk1:Hc*eN4@Ew Tԗe!U*4ݔSD0QOX5_UUد b_SvW=N]uV&u:o^evYqA} rɋ[u]_ɋ\w{YF]s-]dURvD=]q bznx^99c?Wň_Eik /ng(Z?u9Yt69+ŸdWޗ5^%F|zhMza~ W>)sH╇ZE{x{xts>zݞ*K{1 }S+csפĿh{[R|kv=|+}^-M 6x.i0G#$l<v#՟0d͐,DJdKW !Wt#*M" EX+"?bkLI_'QSfDqؕэ-Q&udpE81Y(1jqmI-SU$!H!%M$!̀ 9ђ< Vn\4@ RF+@Qu,"#y<\/J+/]iQ~X&) iax9҈&/Mm&$$IpD/?e`g;àI*S'>cyT\aXg̓.ԝnQJsa M*eMuԆDEoɂ3٧DR~hʖ3 mJLgQ4$Z ONT)F LOQésT4jh\jҊbiW*&5eeXͪ6u Lj[WΕu]W}_òM#la!vX:L1@E6awWv,,:ς+J۴Ӛ*:[m8Z c垆ڪ 1[[6Dmq{ \D=+{Pܘ:ʹsцWBw\Bvݪ|x{WNXEtKֹ7-m}k߰/l7`pz\ m/\ 7„0";.jj^bxp1a2IL 8>)jLn2m$דoZQ\b 2B3AU.qM`1 f1)U]5skW!w]-ٔHy~<FmrmSʳZ\8׈7y؟u{Powns7vf|6e\lyⱷ_^~DOYƹyag˕k>]ӌ7+ {'ހ7rc=wr~Sw--xroŶ=1'?s\ao|쓾/?Y>;~OXO/H//Oc"'PO+PCP6PPzO;>[P' ُk0ma)ap{whPM E/9-T2\^+ʢ _E -Ĵ_δ /, ?Oаg GGjP>S TD#R4UB&-UQl8b: NsrAk@af\Q$?&Mu; Zo%Ͳ*ggCTekvi@h30jE4sv@sj/b2j/iͶwV92Bl6UG;ykS-Z4Vbvfulg66_?ovbvu5Hiam!< 6#r99ϱ3;&wutq5M$6m'o7kyr:l=]vs3?PcW&uun2rx1vuXWxAvWVtIoW g(ve9wsO#ތ{A|P3nJL`%#*b"0".~w~~W~7W뷀 kx%xX7Zo W(Rs\W׃IDE]Ka6C1pawduhN\u]ksg8WM` vu0.X+mYMwAxS#mkxf$ ?8qD } T}&424d&҄vp(.w18bĐI8xcF/NoLU"f~`PsFz=@u!k` l?@YYYUOy5lnVqOCYstK0ҐUЅcaK)4q-U[XWV؊5Yڙ9y#X5ZYFR⹹U:Lx5ҴS*7MbIm{O{rx.s3-'uyOΡ[FU?z@9-zr{tF~Yqcid9Z}񸪗ڑ榷::X[٫HJcYךZd뺢5ZGXGMC7dqYWI)v88 =Vse/ۍ4{$H%@=InGt?#{v?{Ry6ng[;;ճE';$d¸w$Jvh=ن_+*7aOi/pKTz`ɱ9YEvd;h!w;; 0{KBCJUaռ|;7ɾ{35<vM1[}.i@ ٛxW<{fߛ_ǡ_uđGŝ\<Gܵʵ?1<+\|_;˧xRHܞ;|#Ӝ Γɜ3v˛Sj}ˏϳ5jοrj7=υ*۴֛w~ި_i+`\Խp&R17z7zJtA(RooqYvv uYRkm{q^/w6 w?>hR (#_zr E ?rRVZ/?&"Y'+rKvp\7n+9t #2l3*6vjQ.8,V]Lt^_@߱-oazco:` ՟a"UHD$J&g'%G)@gi++nn"h"0 +p/-spu1655tSlUL2v:gx*yzt+8o|)oL\a: ^2:t 7rܗbI㳁C1g F#ʜ:+RIT1m=3ğ8-ڏhœ,W}w*V^,R"l TFz*,G[UiB7M%kOnˊۻZ-Q-R ^Z8.O2NvJrںbZU;4"7m1g=Φm1Jmw%hppa[qMߡd3HΟsݳJO6ww%8o}A_o,{Wd5\郗|!]fo2vԃ ga; w6pdɊf b G`7#xɳgP$PIf\yam3$ɘL2i`v4E q^T8H$i&] beqyBfPf*V!*Zh;9^;nbiHD iq٨<) pY%|Zꬥ**b*_v(vJk)+e$lYs,J㥚)(.nvi'ul-Qg/ʩs*{ ˓o)W[|, _ M߿"G1rl29`5i&6s-0l? ^ I+rKqKK=uG7]Tk7\5_edؽ*9l$ka}.s[Ȫ++a7rG d.b؄quڸ.z;؋$衋>:饛~:ꩫ: W-Kj*76G;h.µ/{C>><}-vNSOn]'y\K ^ܷC?Zyjy;h6| P4gE$u ra '3! S.|`(.w4pL`ax foBC$KTE'FIh,rq^"()Qa,ch1_Dt(9ұv#=~# )A<$"E2|$$#)IR$&3Mr$(C)Q<%*SU|%,c)YҲ%.s]򲗾%0)a<&2e2|&4)iRּ&6mr&8)q<':өu|'<)yҳ'>}'@*Ё=(BЅ2}(D#*щRh٘FэjܨG9ю 5)IOҔt.)LC*St+)McST7iOySbF=*Rԥ2N}*T*թRV*Vխr^*X*ֱf=+ZVoNNUTR|HcCMծM^u@QJI7"ӱ_, Ȳ K^)UBk*f5qD/OMS"R{el2Uՠre$=kEM[kBBŮ^¬n ^WZƕMPyǪWؘT{d ;'Kwq FXԂ+*f=aj&8K,#-?Nb0dj=<vta<Dcx2.Yݮ~OܑFe/&vVb0sXZ01 5Hv9Et26K=OH3!g$<$lw|eERX.PG;~k4֑v !bst^01jz`'Қ~5sjO+P;vO3֨~AVAG{Ah#GwfvSm LPۄVvcT[bjٵ-(o/Kp٭H;ƁaKlIFnoYx֓|o|/oJj;|=?ʚ+N>3(UD~.&ϡrpx^3`B<]ы~u'J2ܞ48+NfKB.NuT `Kjۍ>v:q{~»Hc`vvgW:wK~t_ !GL<*#Qo쑟|ߤ_Z_c/ޓn~od=/˿}4ş `65 k< *HN!] v~  `5`9׭ q`\ i`I ![ 8N Zj&!Ně`J<[.ajVYYa!]!f$M&N{4 {䡪  "缊tسKb R!"$n$^:vz"%r?ebb!vb%Vb+ #b-}b,"")("M0*Z)nb3"c2.3J0 4#v6.22pb51n(:#9ڡ&D"$Ϊ:F#9nI0c8v}8}A^5$&̣7:(敚dM% >$/haF"VXBdB":4C:2K}&MJ@ GNLDA֊E^\>6BzLqMe'&e^ e`ec.xZ@dSV&!hZ?NZ%H\q\Qh\eO&̹"BPfKTL&a%Y E֣V\f#`I&oeK df_F%VM\hreAϙEV忡k&f[ $%5fkkbgjfcLdVL*frgpVd fWVs2ft&tglu~ mS9PfT&3֦y'gfXp2Dzgmqd\§șHKu*}OAb}e&"`c&/lg4Npڊmڋo'ma%g`3H6qBhf6%zhh:( YP"ڡ"䂎NhKd#[)@n:hibi{ZiyJjBi:R钚iN2)2*ihii鑞cםzii"2\Brj W*;F)j:z**֩jje.n9j~j"ꮶjꯎ*M ᤮ުj@u!&!&)>j!a"v璽QkEk堽tk췒`""|ha>,FN,V^,fn,v~,ȆȎ,ɖɞ,ʦʮ,˶˾,Ƭ,֬,,,--&.-6>-FN-V^-fn-v~-؆؎-ٖٞ-ڦڮ-۶۾-ƭNG퉹 L* .4 .nLΡV֥冮Dg.VZȴc.=Sְ.]lnM\.R R .7/ܡ~n&[o#Bol.Za܂nV"No!.z2o$܁֭ r*6mjo6cf:k/Z`*-p/[,I06C0f%UP wQp P 1EqqP W7f[͎`Z;"NJ]'6>I,ed:v$-ks~ K\NfZ .y "1eGnOкY%O 1jkp#_ "*C#\EK/+a.)%űY:!0 (2H1sqdfT3Y36_6g37o7w38$83993:: .5==s;>3>?4@9s ޒ4ÛA)4<{B/4O3r=2}jv.4c!>ɳHDfo\2%M21ONcn_1L# c ~T; $K'C1$`Gh.kEUUYVf9uzݟP\$õVI"tאW`Zδa; "5aɨv .,]6`#Eb{uyNfLj+6iCn6_\cvHC gXoWD.+bGvMRCg7-]qz\j7pXx27lurWYiXtdtxCz#plwՉFgf"mSe q%IoG'Ӝ}l7PrԂgx;HhL[8[rb=tCww[CWJ\FN^+ވ7ksjbn@wr{4)AG#=}k+cr{ƕS|+˸|ϵ8W}儋687o_Ib`~88fk}+dSQ{=o&wCS>zcs#MlHeϒvq*f\F(7:,YyߴEv7 2K˅arx!y؍,iRURgCLΘ?;mSwЅ:{ٮ;wZߧ8˻<𲯻Pǵdj`abtp?; 9n!TKVU^ḥ;ʼ [l(([]u|%VD;:{8޼rSϛ}=Z2_ҵ#CaK6ZsY գS ~ͼ7) yE÷9{ϽCvq3{K=fɾb0>>~Dy~~?B~+??";?H[D6ScC{h{s?W .?>,#+Sw?$FNX}ScBq$KDSu%AԤwk 6wu|#'4&KfbQmZ\ CU||Fkvmsz~{4 $,3DLTti|TaD -58:emu}ER]meMV^Dr^ɹ̚]tfnVg"2wB'" ƮROy_g%w=g`{ $|Pq YHQHD;y T(v㒙gjęs@/rB  I-MR㩦OQd겚A*8`۴uJ>a`MdV2nl?}-VfgtE\ߺv F2Y '-faQ2:Si;mpgvy"_œj,e[ۛ4'{lxӭ \臉Ӗo t}&嬋R8qyͧ pr гGd QB Kq&8B2<E9+QV;XZ F5e00axh$VjFt)no8zG{?m߾FZgoM~Ѐ"X  Af `E8BЄ%sl M"#6 sx"@&6Y~4O2aE3DeE!AxD$h"D&ps"EPd<Ə]F8ұQͨ9"$qfF<bG==|N8 FJRed!gLΰ$DŽD!)J>ғ4S(1Ohe iZҗ *{KbД_1LH0әI{͢9MQ3UUuc՚E-WAWְ5a.ֱ:ؠ{V^'R=Ȏִ]iUmR"(eE8{]dF[%nFŒc7EL>z.'l: fvp u*"uOF:gwKP~5I5M|Kowr WO]Ջv27ӊ !\FЯ{kXjM}"kIΡ5|?r=}}m5 .vƣn˦%E` '8qԎ(2z#Ӕe/)e0Ya>wJdN3f:ǹssg4#2d op]PcITz)_LʦDEJ4Ǘ<IP 6WP2U准iT"yn5O ..5k蚹mlh): vE҉f։?9ms:z!&GdlOR\ gw'| .cgVA޿ A=!k–ҿk#sn[ కTMܸ9 N؞a%8-o$;ÒM˿vqj S湦i~K)_-&>v 7Ɏ&&@;Ge~?G)-K*NzJ ~.{s s?쏇ٛN;F|5yDž<` zo$.3'J/j+k\,Z9F}믮krV*P;'cOzh7k!a?U}dm?{>귔B?S&ʩR3f;. g/\ٸeZ7ЂBk mA{#< d9츕:B4@ :=$cCU;?9o˶#Ai1^kBt y>#CEBQ/,EJ ?BC&5 B׉;4?1$ACCTqkT'dEB[B,JD C|RcD;DAD,Df8Cod[8EV4DY?'l>&\22+H_-f2CX{P-*Kl&=j:\lhLƃEfc'4,GXFJE$lGZCGL̐qz8]?3yĽRAKTEmT3v@ GTDcDDTHTGl_%ZFgXk,ɌT޺>cI5kI9{ɕtI33II첟ɕtɠ(ȗKH^Ƥ\JhGtE|F\LNJJ.񝐳JĐ|JyǦ HGw|Cdʴ39dEKKl\GFtE+2TLLDb| ;M4HռCʀK͓\ l<7Ͷ*qbMzl!TCtDSNd ìNR4Om!Tdtd<m.;hlTt-BTW,ucs?v]Tj](kK2媶!ȩ0pHnh}V{;^ŖEFukBcznN#|(%{5ٍMj`Fz4_NO>5^O`~X` vY F`UQ]`n`Na.a~aaB=aF_`P\r >^.b$a&Iea"^b'f~b%b(a*>b,U)b >b3b4a^e)v2bv`/]65$Vc;a?aBa dA04dFbE>d@b>~d16%9~c1X%ceфSFv!veCURe Z \MEd_4^vQWeeV:gV>h.>8.LiFQh.fflSfjpq&-r6sFtVufvvwxyz{|}~;speech_tools/doc/arch_doc/figure06.gif0000644000076400007640000000364007262605664016326 0ustar awbawbGIF87a,ڋ޼H扦ʶ L ĢL*̦ JԪjܮ N h08hx(GȨy(iyCɩ I*jzz@ک J[k{7K뛦[;L\< ľ`0Nwa91G xٛ9jch\g\ީ'Fv狏)2^nL(.X墣ThzZ{Z Z7Q窥뫌'*zP%B dY,$ YP&XSl bo.:ÿ&/llž2 %qŲM"lqچwB2SQK2gLipP2#/R11;\tmК8tRPGjuO7]2ӊ\ 5/L-RkSLnw,v̽j6 xGyC.8LGπx 'o߅Wrڐ,šZVז3t+L^0oxt:JCX(&.Yd DN{|J?Aft^[}_0k(FcHl*3Cz{LH)1.#XƱ5""snJnN4# Fh$ ZJvKsoTYY(ӕl0Wm˜b33:1Y2j]C,Mnn" Zr NsMbN;rkΓd8+uAt<}3 APy.Ԝ?TP^Ĩ@۴UԠUYIMsRfT4+>]QŔTM=:Җ$EO Ԡ u/f>Mzj&՞:5*OTPKiUsUSESU5]UL3VY6uYjZ$Ҍ•iMGZWUee^zV\D-aXJ4`ݪ^UƊW) nl+Hbyvf/{ZZe`Y{Nve[qY%nC Szv-DSZCuroSvfTFj ZWgk;u[ [޴74w x.+x n Kx/ kx? x$.P;speech_tools/doc/arch_doc/figure07.gif0000644000076400007640000000425407262605664016331 0ustar awbawbGIF87a,ڋ޼H扦ʶ L ĢL*̦ JԪjܮ ǁ\>^ۆ7^ߧX8x(ȸH9)YywiH Y :ښJ:K[ kۤ,<jL|˱ }EMbM{\,^M N΋=ν\n:Oid,.'!  !P PH%CJ6xY̙$<4y6(ƈo:} 5ԩTZ5֭\z 6رPۑ9CIFP.[&+dPFEޝ}]jo0b{Ni υ X98l3g)fŏWF}Ft;4c=-u6ưlԕ8[zQ8ƅPP5q _:_+AF x>P\jrNHgu ZgEȂ&gJ')~&+").Ψ",b:c<#2$ChE BbN> eRNIeV^eZne^~ fbIfffjfn grIgvމgzg~t䒂Jh ih&(ꨢ2%h'}iڟsr*6?盪(ZJگ ,L{8|QQ mN[BeQhȶͲ>%담q+F.a:L{қڵF;[rYcWŌ=(,r'?Eg<4GyL,$W5 7P+KS,wF6c]l#vf/\q׽ڡwo=`,v={q7DטWNh5ĵσ+d" &ΆKN^X6mAb7-1X|\F'QKk$QF^mR;w1RɎ~aWG:l (Q Jk$'!YTc%wI7fpd4IR R(¸lC|a*x=SFrzT%ZIUzJxZїx"1?Sȼ2qf>q5-XlzG7aR"eNJEJD8YNxRdg= |s? Ѐ t-AЄ*t mC шJtqgSTڜ7œtO_{no8< ,`%^5iANCT)#i} I{dـaX'vXiёs(j k~6W(O^F)#Zi~ jNZjj`(JkJk*T,%k{)=8{^ "+frx$Q8ӛx&b*.}V+źKѹ<; ;8ծ1Ӛ" 4l[Tz r"Lr&r*,u2?00ͪl08s> tBMtFkw4EIO9PPg"V_uZo͵k]CPa5vBexvjvn wrMwvߍ7i ~+Q5qsᄿ #W嘷0o876^:`2o> >㎂/įn'7Cԇ = S }׀_/.?J ~οOR -ZѢKg?ilt_# %P$ <X} `/wd& FҠ;4pQIm8Dp)"6dja9_IT@9qhqΡV!A,>QOQT)[ՠ02>c*hC6lw$ZA y31 hF?.@8"*1W|"1H6p<\kd]2 :2=I2Mʦ!DùՑ>L-c˹ҕ 'AƤ;aK+DOs7: ά:&"eāFԂ7F*y۩uɝ<'Y?q3Y',OE3 @9\hJЂӡ DÉP}$)3DrY4"h4RNԤ]i@;ڦS0g`Q c)xS bgiMSxT6D,3*S ըJu궬լju\W9Fԯ/b5O:'F Z+,`+]cuֻ@[zՎ5 j؁5YZ,cdžή]e+;b6lfY-52$-G6ڲ6%kXUҩ5m7;{Wbe'̞ģ nocZNB- 'k:ԹhƺqD}eΕ.,(^5&tHR6pJ9;Q9;:6qu^[J)9OЙ9 K|vkb=-]mElcNR͎.xu0K eN!B`"YƜ,onyL]0צms_XaA gX9s?\g|^nxe6?5X|91aK7IҦqiGπ+\JP'7}wFQOU?.#.{Tՙ$u%t\ր|rrfsnvhdٚ~nGd]cU5N.7k7{7Ä6qexk;%wYn|Z{ 6Vk=p]˛ǂ*m|C _6ӝngv'cn-rs{MxQqOZ5/OyfHrE],o˞G{37zQLS}>U A]d:3d/;ܯ='}uz^OΝT>6esCw-L1E?)yz oMR}3^G{Gze~qnu#OX{êXŝ}y|տyN˳~#? qw:|+?V!U~wXFRa\Kzw{~8b (`UA~z}"(2fa?vO~g$X.((!*c4M"}2| BcVfNJ"w@CX|P V!JHGL؃%|_S)Ak(CeHb1O4h|mHQ(hhsp~/0HzG"jg_m lXz]h|È0vLFGǸȘrT?Ȅv7m㘉䘀ڸ0hhX؎qH8݃RxȉȎ9~RHvo^h 94 I(7ő̇%{GÒ2i()%5n#'h-ɏ3=)xA^>/K3OyH CY)SSK 0Ig3a)1IbIx6FkɐJij3rYSY\94_$"ٕx9Y9ٔsG{9LRy2{^ٗə#ٓ 29F㙟X&y&YIyiIٜ2P霪 )4)ɚyI2⢗ɖy;>cʙ9ѝyiB-9Y 2ڟ^)i IIYz3i≡yȩI%*":17$Z+ʢ9j?:iI@! ɠ Lz2ڢĥ(0M Q "TCJYjGIʡإjaRʡfz`jmښ~ZyBJ9dZiڡʦY o ZJJک /J;NW*ʨpY"HzjsR:zhJΚpʪxp!JϪZ!Zzz*ګj:Z犮L*ZSJ#jʯSz1 ʮ㺰&;?ʮ#;Kª$ L* ʩ-#12+6۱NY$۰*E˳.1'zk,czPKY 3Ay>U%ѵ:RۮI[k;#۶O`s8̿L [83Rl-Ĝ̕XЬ, BZͼόŬ¼(̧,<ݼ)Y<,V|ϩ X\8UXl,],!,'l-]30 r;m]4mBMm ]u ie@=|π=uMct ZY2mlϓׂ֏,-ُ٦ؘm١ Ճ-҉]٤mզ]ص]ًړۑΝn۷ݧۅ}=ܢbȉ,ݑ|Ȋl=8l)܍ ߍݘޕe]L -}04pKo{o҂Sbl!MuFVh n RI~#N-~⯰,[{.E7.+NCNEnG^I;..;NPY%=Χ Zn4YnVU.\~^.i63lɳo">w&RSN .w]~>n闎ΰəg%s>unNw;vakNꢮ ޷g^㷾d>|t^^=쿎ѮоN^̮.n~ynL@n~2.o6~ﯮnՎ4?N?(.؎3Q5o<N7"F2GQfJB,^/KOW?cDbg_a6ϴx?8 /OobC*)"-M?r/O"913!eeun?k?mϭ޷vN RLO(q_;AWO߬o[_MZ:#gYo>oX__B}2xnH-o9݋ 뵵eN9MþɜVU^Ya]cKkme/Q'D:B/;-A(a47 #oŷ7SZqM׏HSE}co0EH 6= CǍăEQ#])ra@<3e^S"0c&jyʂhR:o)Ҧ$2%:VJC++sE{lb6> E;l(o *l&r3S~C}yB.׽J4T,W7}b4f:3^0hΥ]Y\SN|'tl#^w/= nw ݵu ?s+ lEAǾhzƯXhr^&N y"e; ?P $ s! ܎2LF+J-,C5 +C c DN/8Rԯ>C+)8.1P4"qDI$R=}\\XD/͏~Gxm]25isI N9ɺ3L)s@/lB ͒+GG6mXR..-1c6S>?=0THT*UPFT5TIORzto6\5WX9u?[EvUe_e5YqqbN`^ͳ]}6h0KX]g=7fE5rHpyv_- wQ-FU]n]f-xiũ'}^mx!C~8axOUMn]o9eqXgEؔW-~vYa݅(Hi~\sźW1&uy螄ZFj|o5m}NZFoFaמX[o|n n)-| ir:jiut^tkA]^JY7xqF_9۱W.T}kXځN}pf?}{  z[220tH>I0|`O.辞l/C ?X0 Ӷ~_:NSE_6X4;\(]Wh3 NЅX):DxαCLLXF2ҋ!,o!H)dGDLb%#^l!B HOPV #>:L#p/MZl!ͨc[$yK\җ5K)BA2l&Ǎm2k7Y4s%0Dʳd6mxGW1uʬ?^:ݔJz6r'B=~]&:9P4l4yʃѣU7;p޴WKttCZS^39iIjR2%Fҋ*uֻ0wJu>&P{*T^}QIV4|*;jUe[Uet *tud*8ֶn5T[j"vrmIZd5 8T)4ضֱHd6˿R%+i[Ѻ&6W-lYֶ~VWbR}"qY Xmmkڪ궹mCϟ~UG]k+zՕa;]>+P~7bok ?uo~ *\Rw  xO-[vN%/9 7E/c _TWqx3~eK 3n$_E0`)Mg`HdxHnLw qG+bK__%tֲ=,7&n}Ole?yip)ulDxf6RyQ-i2ΏYhкcvtcUxgnuMMԝuEmXf] lX{&AM\wwn!=kNZ`U^+m+wNomSڲ&]P1hk9v6}os;w >˻4GL{noỦvlZy_.M퉿^lO.f?1\se3cfh*nh۞57{tb@xM;=Ug{o޺?ml\B:+kz}f:ta|IGzN,K,Ͼw:)U-}o|xK>򁇼{qm `+?yˣ^x7`~sgz^vQGݍW<kɛgvaO~pQ0ϋ<]ArI̻'lMs߯hkO{'*ѯvD?Wd/p/v-P04Ho0m/.oTo/#n8ݒ`UM oT0X/JNOKNhN,<P3N OM l J o p а0 p w ð%0 qugW 00m OI+Q$lw w0pT 0 /$/511_>LB1ېQ1[diߑƌQyQCt6 ' 2)q11WO+ 1 "q2"ݰnLGQKQ%OQ"gq$c#WqJp21 'dR$irY#2 Eѻ qP(!ɑ$o"% %R_0*%='$&/7R {R_p o#ﳴ(k! KS)W1[r*%m/˫*Rr(!2,ݱ,Yr+3ㅹ s&s4R!u,sr.wY/,s$r2Cs-O-i)428R1SSZn/-6]n)ߊ3"#q䠑48;s0V36ē.R6u/7q;4s7I.:S,9s90K?r003S3#329s;˳5Ba<3=AE?m2sB t831Wt1s"TFFR)"3/R:3REyTTD3Du3;I4",C'I%FSBT09o+?GHt4KHדHaGOG{GTNA,kt4OFjIgS !SQ'$ 3E1LY4SAU2!5DEuVGծ4IPtPyRC:]JSOuOU]EN͔IctXsDS5) REORI_AuF*.H,.W_Wu^u\QX5TKst>tYUYL_tO[ՕK5baNCv_a5_5!4ZqP^PIdd\RVa>7QUS@f-ve_;g76akU[M~['h%]cig5\=hNtG6N6kV?aXÖa#u+kufU`/Ug bReul}vje3jvHQgmb3YlVnZWu`uLOVj/ nm!VmSums qhZsnppRm?samECrQHMn4qqq!WvAq9niux/t+jVsff_xcUUu[HvYC$MFt^"ΗwַwAwCy'|wMew{eA#mmBc:XJ?΁KS^ll{kyw7WLI=|y²4.V8-,*Y[xjqTVx„ubIC-Sjxr7V7 x1mCT#<<\9\*%آ\7#؃ Aσa#Gp|̓Λ<-k<܎<}J^5[3~u%<<$ϥ<:&=O,eI] a5\cw;G#|eO=+$dӱחYI؝;Ώ]lt}յÜ<PR3}<|93۹f-;wۗ{[v8Xvi u6kA0wz[ ޿AxSzɚ[g ]ݻݥz +ɵйǜ9zl9pHV^xjѳo~}>Gdi[@雞~Q>~빾>G;i~پ>~~Ӿ>~?x ?^ط%_:!1?)u^2?EڧqGYKٝM['> ?}Qb%~mag??_?_??|_qß+__M >bjp.I 瀡2̙+ۺ/3]7뻩$ CEq,/M칛R+6r3'*ev_k/<.;>v#V K^"c#d ""%O$h(i)Vf'',i-nc*-R/S0.r2nj1stau6w7uf6Zgyl7{r48ۺ} =|?/Vhp?` -!Ĉ}!,X ,fMĐ"G6 $#ƏŁK2geRtji!5-Jʔ,yI)EFR R0ЫCVǒ-{֋jQM6۴fҭ z/.l0Ċ3nq_'SV2̚73ТG.m4ԪWnOزgӮsXۺwme‡ eʗ3o9ҧSn:u;xn/o|гo^Q>( X*x _ "JZxafb!HD^8pz1!)"-"18#5x#9#=#A 9$Ey$I*$M:`;speech_tools/doc/arch_doc/tilt_eq01.gif0000644000076400007640000000125707262605664016503 0ustar awbawbGIF87ammUHHU$$,0 J1`N0 ).+ m7CmU(@Ό(EދZZWJ4id`弯'4x ]7Uk~ rs=P- }zb &}|Mw 7= qW @rT6k6M'M60mB.U,I۾l+|tac)>@50 W}<"d&TC&05Ԅ Z s΄ԫc* %؏0+GݺU&@ JѣH˘=#|25C p#kD.Q"<.P[K ,xĩ HEDI*^fAn|b4 /THiX[ujЄg2RN\B" %to=S=8Ƽ~ЪS KZhjnn2T9$x|tD8(=;p!~+P~`,ppx,-0G,QPX Aw4s.礳& NQa_C9sP#ϴ(M:w2V8!{SA!CW 1 7AeO;speech_tools/doc/arch_doc/tilt_eq02.gif0000644000076400007640000000105107262605664016474 0ustar awbawbGIF87ammUHHU$$,0(xjj`(SBAp,/Gw@=al\`R*`r>_tZ!] lWF D eS>|fT)pHqQR \9]] Jhbd|PV( kTX1q'1aa](oD?RLWr jZ">9Pٲl ^;Ç#JHaY28} H.,ਤZ#!'F^&t𳌑ք+< eTe-+ibD>@c6P)iCsoy)2|Ⴇ|@^%]V9#4%:3޿:4xΜ ]bS@ANQv裫[dfM\i ⦬}29=圁CtvF?\;speech_tools/doc/arch_doc/tilt_eq03.gif0000644000076400007640000000203507262605664016500 0ustar awbawbGIF87ammUHHU$$,0:!k۽4`(dIN0h2*k0|ٸ@BA(!XR7\DӪdJH!]E/8 A trd yUc D +aX T  Nn M H8N=)J =HN/|/W ǛU/w*5u9=HCHTTrSCn ;-W/)8]聽[6EHiГ.R CI/IBYj H 6q>_dLRtbaz#y.e:ؔp+L oK^0ZQ|x%G+BTbc1+zKE U;1PWR?ّ`_ l9dhZ\1_~ɕˠC&JX$;speech_tools/doc/arch_doc/tilt_eq06.gif0000644000076400007640000000070307262605664016503 0ustar awbawbGIF87ammUHHU$$,0I 6_ͻ 7 ‚q%  +0QE英chȊ@@L*[!6Fw\q ,KW)IY K.D| $6u6K {`*2~C |A bKi(%K)$o$+}sZ)o3fdA)AKF*R dWSE9)!`O bs,R &}Ex)΁^fz/ԋ$`_(0u; EѪ. 4Ɂ(S\ɲ˗0_.uD~8sBf3 27btģlS!*VY"$\gtvXg7Vh X$"Gl#[%NpVi!Pi11qh#%2&2u;speech_tools/doc/arch_doc/tilt_eq07.gif0000644000076400007640000000067407262605664016513 0ustar awbawbGIF87ammUHHU$$,0I 6_ͻ 7 ‚q%  +0QE: 3pю`T]$lgs1a*TZ+䈃`!N {@ 5baJQJE**!j p&3)l>d _@)@2Ncp,6 bUź9)!Tlv/6ރ&xsf2>ie ҙ{BAIe۝m8 ba^<Iɓ(S\reԊ@ DrBd,G-#g|R8!WI=!p CȊtf#bP`iʉ nIa&_:N7Cf-hŎ sf0Y;speech_tools/doc/arch_doc/tilt_eq08.gif0000644000076400007640000000071407262605664016507 0ustar awbawbGIF87ammUHHU$$,0I+ 6/07'(fl+  *r`8$PcHk*pX*BzB]%x}UT/f6-E_j( $%x= `o B6di6ZAOB}C#s,6z/85"B { o!",v\Hq ^7kPYuf TuXTP.;hX wGh$d!45B۔ 4 : Ț Y2 9O N0cʜI͛8qA@D@Z0Ip$qwYP= h=@IH*i"F>Z( lN´AO?A" I(p a UG "r3O-aRg<Ҧ;speech_tools/doc/arch_doc/tilt_eq09.gif0000644000076400007640000000072107262605664016506 0ustar awbawbGIF87ammUHHU$$,0I+ 6+07 @4) m] 1r`T$`r.T* F(%P_4gn hT7.E (AOBhz> /wB6.}BZ| DcRL 8ru[wH7q" hW7d!#6)jV"[iU/T*ŸW["B5te 2!ry!y9HUQXI(`$s*@)SC`Ū% 7b GI | DpJ5XZ8@͛8sɳgK(QB$ $Qj,%KO dυ:JU٬3RYm'r j%vu2e;Fz+8H[ rN-jy ;gě[J ;speech_tools/doc/arch_doc/tilt_eq10.gif0000644000076400007640000000321207262605664016474 0ustar awbawbGIF87a-%mmUHHU$$,-%0I8F`(dih j,SxN3m0”`ptLGOʵ,S2]EmU;{]Ap` "P6k !a}6 z 7/,|PJ Dip@q"   } Di ͎{Q. @` %tzr A>_290-51dSPA8+HT%)̣$F|GOAazPFݔTB<;sTe Γw ~9h P MڱlyѺQ  bz"^kSp1t %-wU(t\a‚gQ1:$W$`L<]b.Xv bn H H!+Crgn Au;CAфN@zw֡ w@ .e/sB]j@j ̿ߧ^ s;PY5.SW bwV M<Y!z5D3 Q_Tؖ0FVs>(fu3҄J>j-@D]:Ԥ+eԕY1%#zd#Hu M<3fb[u&"[ьB0AIIM d ` *ኟzLYH z(#H[r <ؽpB>eV)#nb tP KB& u;AZe ˧iE D o!v+JRO 0uc9Ȓୱ]gHE8Y nNTo }vȞG,Wl\KAk\QFP[<($_s1 Щ,цXMl q8Aby|#'Ru1L%Ã(Kz"pM.,|!'{Lw=5_3HO٧o^nLV)Bpg{ 9dC!ǩ[s7Q'֭ԅC*Ϥ|$d6PT(DHK iIbަTN@ )qOAU #eow;f4sb` \bZCEV*l1 bg07D$1@pL٪ \fw)}oH4)ͨ|xn'4 i"0y'ȆzJΎa֡< Rv*!`ĭ0щ<,q]ȏf{XsD9`8Rs="QBMrF& 1B዇ GCbdԈ{좑DNM@}H. H:ȒLH)MJ0wH)2|E-M((&5nj0ý;ՀS{l(A=PB8T.ȹZR&J2l"PW!Vǐ@[.VZ}hN |Up% *W2u+*l]:8(1fW4yHu]VqAy#1v LtnfRa<I3L6Q' ./eX;speech_tools/doc/arch_doc/tilt_eq11.gif0000644000076400007640000000131307262605664016475 0ustar awbawbGIF87ammUHHU$$,H8k7m&$ B%QbMʬʸ/m(4d 'QNKUUe>! [pA1ٜŸPpWC|iC!;}^Hl @"cQLx Qx aW\C: B| gL U;VkU]KWW n_Ogp;^ ꖨD&m.JXMRvO\5iւy` ;&à'qGv J GoΟ2e*<`9TNM #ɀBxt)R DU`.܌ƭ[lי<A` `볽INPyIQNz6L% ~8 G?+,po^u0'QA@bqS޺Y-o=[jIub. X8esi3Bx/㻚|]FOz*0 Sza2d2`(Ye@7:qVbO+XUc5e]Un,2X :\\X8N?4mb^_^"n1';Vq 1PYt Gݳ#|_31vS^lD#G 9G_ >뱇{qn<@aelfRVetdyHO\X-eFjwT0VP!r(NZt aAH(aH+ DhC|iJ 'jO!:'չ@p(!Fn>3c )Q=9F`'x̣>X{ĉ !Q ű5?}' HFR@M9r"(e @TyPM^Pd R|de."[f+AYb@)8җ؁`wG͊|8 @k/?̧3-7Wxqs*˞Z:ґK4ԛ}-T<"cB.,wBۋp]`;ƞudܰG.1ouB/fjw|ώi<慎xO:euO/}]?uXg]uܣR0}}xJ'+o}5;speech_tools/doc/arch_doc/tilt_fig02.gif0000644000076400007640000000652007262605664016642 0ustar awbawbGIF87a$,$ڋ޼H扦ʶ L ĢL*̦ JԪjܮ N (8HXhx)9IYiy *:JZjz +;K[k{ , -:լ[~ ;vIh7-n{wt߬}2NrZ˓jn@7ګ a?<^O}#[?*ߏ[UwNO C]7 D݄m w`"x` eXXT")Њx0&C-qcoe >nώZd$z$NIe#Z()Yn _&,ҳ)gY)ʚlB~xӜ.iO gKM92a( A%Z:LAzh^ nzrۘn'r:Ū*ƨ:^]ᚫ뫅`+pfeZҮz-|B̖gx:NЦQx Xj+il =a+b /2 1FL1vܻG]<0Cgk `ր=ͷ/G8l'G؃KN=zW#W_Yۏ7D9\95&߃a毗ke?}A]_˗v17۟w#m[Iګz_!)FdsMz7lr\/ AjY{Nd* 4U$ B%_# чy$oOSvh;F`ڃx8D"(L-r%Ѐd+(VbD.jfE/^iEMI[b/~1Ca9k"4r#ߘCH1!gP.yyJ(Ҋ4/eAL(L`%L!0P$8HIgTP(H)j3$61Yb&*i- ')ӟg %P\ Ѐ iY(E j`4(GP~!fIF:mj)S"bKYI8T)mES=R6uhˠK(#BјդNj5#Eeݒ~Goj5WI u\ei~bn&+< q󐪬87ȣT~k0KjVĆUb-vt2vM,rNx^'.ΡVֲ7SպHr_QQqd YŒvlOJ%-/:% |V2PCw:nx;G MzWVp^-s|we Qpx_@t8gQJQp/_?Tp,\6DaxO!T1$(₩(NW%x5%@_Ynuia(Rap>Wb+W9 [ Y%-zcmu. L 6sPQrNf1D֛YkNWl'w x4R#LVhѠ}HB(6mg3,4p&8jv8@U{bvtn_ =~u〛%+H"t5Q?=ZSu-pVkc&r=Զ~Ж}3~vivDahRH&YGbrg({:҅ĀW;buhw%{x@k}Hy8kfydvg~H_H(8O0zQxoH^Ȇp%(ThPXvNJׇ8(HJvt3,PؤŨi(h׈٨ȍ(Hh爎騎Ȏ(HhSh'vF$T7j'Z5Z N7M4{nt{S&zZGEtKD(&})K|Ǎ(IMYa%NLYW-2+ٍ6{KLؒE}txGU9jד>N~~g./_?o/SO_D

h3ww^#'qQyN{A7o=j6 q~7mr=}?Q vN0G Kho5p! >DYH omB08'@[2" 7 G1hcɠ iE&܈2$sLr!Uve?T'fBXֈn֦5#㚯I(q*bgIa&6:Ş4@_옇H5',3DRX沬ti 뫠7iEHbE8lv7eu}E:x?5i ٍd4]Wdx 3y-޵=(S5VϪ DCjyKHԼR]yj C8|c/\d 3\D;o]X}+IV,-e3` K~Oml_L(ׯK9E+dGNl'.y{nɊv!m滝>/w o;|#ghk^G5].`|qLRȱ1AF%93Gq !;tȕ,Ƶjsd$8TȆpKdSG8 _ ŨVSɒB'¸ё3% F"D#TYHT텳dm_͢lsjԏL?G#/g-B[f uɖǜKX@J_Ά6G-΀Hr\5A]%O|_۝]!}쮦;پ{o+}a+7~xh<[ ^*Z|`}f{C8L_JԻc'.!Xi.'sgAsPT{w}$ɯ`,PyP'prww?OZ{~CW]W9? s|1/|"ޒQvr'xzx;dQ6wS|($@ 9eF#yz"|))I^ÒYđM*ى/i:1 &B9|@Fy3JYxvn{}~%WÔzS_WɂY?`=bb4v1h0mo'p)h"gt jNEvXG =9Ki[JYiIUdd  W+)3ə{}*54]tVf՚4=JiԘ2C9ƤyVAE G)G yɝ )Ii4xiyVi#wiR=cx Wyw*Jjʡ !*#J%zC;speech_tools/doc/arch_doc/track_fig01.gif0000644000076400007640000000653107262605664016773 0ustar awbawbGIF87ag,gڋ޼H扦ʶ L ĢL*̦ JԪjܮ N (8HXhx)9IYiy *:Z`z +;K[k{ < pAla\L<, !@`݀͠ ~@n`>\~ ,Ll?_ퟍeu1H0[ֽ{<(޳>8dAHv3 e8Xsyf:#lPN$9 T+5'ެxbҌK76cԐSKw~ꤷ}JzӮãns?#L}Oo}o/sz-Ox=O'>/# z3_)=ԟ@9l(A O`7<4( LHBJp5l]p۝DBmTl/ a|1 sh<(֏λ{Vbi#n+, a<b&.1~a|,r^S3*)8wH!rlHG&2GLfP &=8Uяv#h>d_ y*Br ] q$(^y,&*ydTԙ-Mf!$5esd%\Mmvf/?y0PS|X e,ZIk<6bfEZ~-kmSz6]Ij: ʴqc\&˥jsVnt]Z7۽ml@/AZR7.t^n}k&Ur5yԠXU{  No `Kx 0Qlaa0?]6Vl+_*TaSaؽ10K-xFX%}_,fܨLfV(U{f\޲,!< cH4gCVݜxms]$ϜsCT9ȃf/\d8 KN~BhLэ{FKwl0K]dFhDYq˦wum]k_ H8fh/޵k`LMl6v-fcܚ7m`ox{eɍ s%ܰmz{7>C-uYrſL[\Y. ?mɝ=r\ ǂ6|2/t^U8qܠ$NglV